Pinescript v3 Compatibility Framework (v4 Migration Tool)Pinescript v3 Compatibility Framework (v4 Migration Tool)
This code makes most v3 scripts work in v4 with only a few minor changes below. Place the framework code before the first input statement.
You can totally delete all comments.
Pros:
- to port to v4 you only need to make a few simple changes, not affecting the core v3 code functionality
Cons:
- without #include - large redundant code block, but can be reduced as needed
- no proper syntax highlighting, intellisence for substitute constant names
Make the following changes in v3 script:
1. standard types can't be var names, color_transp can't be in a function, rename in v3 script:
color() => color.new()
bool => bool_
integer => integer_
float => float_
string => string_
2. init na requires explicit type declaration
float a = na
color col = na
3. persistent var init (optional):
s = na
s := nz(s , s) // or s := na(s ) ? 0 : s
// can be replaced with var s
var s = 0
s := s + 1
___________________________________________________________
Key features of Pinescript v4 (FYI):
1. optional explicit type declaration/conversion (you still can't cast series to int)
float s
2. persistent var modifier
var s
var float s
3. string series - persistent strings now can be used in cond and output to screen dynamically
4. label and line objects
- can be dynamically created, deleted, modified using get/set functions, moved before/after the current bar
- can be in if or a function unlike plot
- max limit: 50-55 label, and 50-55 line drawing objects in addition to already existing plots - both not affected by max plot outputs 64
- can only be used in the main chart
- can serve as the only output function - at least one is required: plot, barcolor, line, label etc.
- dynamic var values (including strings) can be output to screen as text using label.new and to_string
str = close >= open ? "up" : "down"
label.new(bar_index, high, text=str)
col = close >= open ? color.green : color.red
label.new(bar_index, na, "close = " + tostring(close), color=col, textcolor=color.white, style=label.style_labeldown, yloc=yloc.abovebar)
// create new objects, delete old ones
l = line.new(bar_index, high, bar_index , low , width=4)
line.delete(l )
// free object buffer by deleting old objects first, then create new ones
var l = na
line.delete(l)
l = line.new(bar_index, high, bar_index , low , width=4)
Tool
Trend Strength IndicatorThis indicator uses Heiken Ashi candle data to plot trend strength signals to your chart.
Bright Green: Heiken Ashi candle data is still putting in higher lows and higher highs, and the price closed above the previous low.
Dark Green: Heiken Ashi candle closed green, but had a lower low or lower high (trend weakening).
Bright Red: Heiken Ashi candle data is still putting in lower lows and lower highs, and the price closed below the previous high.
Dark Red: Heiken Ashi candle closed red, but had a higher low or higher high (trend weakening).
Optional: I included a setting for allowing high RSI values to overrule Heiken Ashi values (disabled by default).
This kind of indicator is best used for managing open positions rather than entering trades. It works on all timeframes and instruments.
Feel free to contact me if you have any questions :)
Regards,
- Matt
PS. Here's a snapshot of it against a Heiken Ashi chart for reference:
Pullback Trading Tool R5-65 by JustUncleLBy request this is an updated version of the "PullBack Trading Tool": removes experimental "OCC" channel, added option to display ribbons or just single moving average lines, added alert arrows for "PB" exits, added alertcondition for TV alarm subsystem, added some extract options for Pivot points and general cleanup of code.
Description:
This project incorporates the majority of the indicators needed to analyse and trade Trends for Pullbacks, swings and reversals.
Incorporated within this tool are the following indicators:
1. Major industry (Banks) recognised important EMAs in an EMA Ribbon:
Lime = EMA5 (Optional Display)
DodgerBlue = EMA12 (Optional Display)
Red = EMA36 (Optional display)
Green = EMA89
Blue = EMA200
Black = EMA633
2. The 5 EMA (default) High/Low/Close Price Action Channel (PAC), the PAC channel display is disabled by default.
3. Optionally display Fractals and optional Fractal levels
4. Optional HH, LH, LL, HL finder.
5. Optional Buy/Sell "PB" exit Alerts with Optional 200EMA filter.
6. Coloured coded Bar high lighting based on the PAC:
blue = bar closed above PAC
red = bar closed below PAC
gray = bar closed inside PAC
7. Alert condition sent to TradingView's Alarm subsystem for PB exits.
8. Pivot points with optional labels.
9. EMA5-12 Ribbon is displayed by default.
10.EMA12-36 Ribbon is displayed by default
Set up and hints:
I am unable to provide a full description here, as Pullback Trading incorporates a full trading Methodology, there are a number of articles and books written on the subject.
Set the chart to Heikin Ashi Candles (optional).
I also add a "Sweetspot Gold R3" indicator to the chart as well to help with support and resistance finding and shows where the important "00" lines are.
First on a weekly basis say Sunday night or Monday morning, analyse the Daily and Weekly charts to establish overall trends, and support/resistant levels. Draw significant mini trend lines (2/3 TL), vertical trend lines (VTL) and S/R levels. Can use the Pivots points to guide VTL drawing and Fractals to help guide 2/3 TL drawing.
Once the trend direction and any potential major reversals highlighted, drop down to lower timeframe chart and draw appropriate mini Trend line (2/3 TL) matching the established momentum direction. Take note of potential pull backs from and of the EMAs, in particular the EMA5-12 ribbon, EMA12-36 Ribbon and the 200EMA. Can use the Pivots and/or Fractals points to guide your 2/3 TL drawing.
Set a TradingView alarm on the "PBTOOL alert", with the default settings this normally occurs before or during the Break of the manually drawn TL lines.
Once alerted check to see if the TL is broken and is returning to trend away from the EMA lines, this is indicated by bar colour change to trend directional colour.
You can trade that alert or drop down to even lower time frames and perform the same TL analysis there to find trades at the lower TF. Trading at lower TF you will allow tighter Stop loss settings.
Other than the "SweetSpot Gold R3" indicator, you should not need any other indicator to successfully trade trends for Pullbacks and reversals. If you really want another indicator I suggest a momentum one for example: AO ( Awesome Oscillator ), MACD or Squeeze Momentum.
Scalping PullBack Tool R1 by JustUncleLDescription
This study project is a Scalping Pullback trading Tool that incorporates the majority of the indicators needed to analyse and scalp Trends for Pull Backs and reversals on 1min, 5min or 15min charts. The set up utilies Heikin Ashi candle charts. Incorporated within this tool are the following indicators:
1. Major industry (Banks) recognised important EMAs in an EMA Ribbon:
Green = EMA89
Blue = EMA200
Black = EMA633
2. The 36EMA (default) High/Low+Close Price Action Channel (PAC).
3. Fractals
4. HH, LH, LL, HL finder to help with drawing Trend lines and mini Trend Lines.
5. Coloured coded Bar high lighting based on the PAC:
blue = bar closed above PAC
red = bar closed below PAC
gray = bar closed inside PAC
red line = EMA36 of bar close
Setup and hints:
Set the chart to Heikin Ashi Candles.
Add "Sweetspot Gold10" indicator to the chart as well to help with support and resistance finding and shows where the important "00" and "0" lines are.
When price is above the PAC(blue bars) we are only looking to buy as price comes back to the PAC
When price is below the PAC(red bars), we are only looking to sell when price comes back to the PAC
What we’re looking for when price comes back into the PAC we draw mini Trendlines utilising the Fractals and HH/LL points to guide your TL drawing.
Now look for the trend to pull back and break the drawn TL. That's is when we place the scalp trade.
So we are looking for continuation signals in terms of a strong, momentum driven pullbacks (normally short term 10-20 pips) of the EMA36.
The other EMAs are there to check for other Pullbacks when EMA36 is broken.
Other than the SweetSpot Gold10 indicator, you should not need any other indicator to scalp the pullbacks.
References:
Fractals V8 by RicardoSantos
Price Action Trading System v0.3 by JustUncleL
SweetSpot Gold10 R1 by JustUncleL
www.swing-trade-stocks.com
www.forexstrategiesresources.com
B3 Buyer-Seller BreakoutsB3 Buyer-Seller Breakouts = If a bar is showing that it is moving in a direction with highs lows and close, all of which are >respectively< moving against the open from the bar before, then it prints indicating buyers or sellers bringing momentum. The arrows and cloud carry into the next bar to give lots of awareness of the micro-term momentum. The cloud represents the better price range from which to add to a position.
This study repaints within the bar, most of my indicators do not, but this one is about timing to get an edge on adding to your already in play position, becoming part of the needed momentum to hit profit targets faster. Also, this theory helps you add to winners, and if you never add to losers, you now have statistical odds in your favor. I got the idea for the study reading about turtle trader method and how that statistical edge is really why it works, always adding on every breakout. Keep in mind that I never buy or sell breakouts to initiate trades, only to scale in.
~Cheers!~ ~B3
B3 Bar Cycle MTF (fix)Apologies, there was an error in printing for the thick gray boxes, happened when MTF was switched on. All better, and here is the details from before:
This is an interesting study that can be used as a tool for determining trend direction, and also could be a trailing stop setter. I use it as a gauge on MTF settings. If on, you can look at the bar cycle of the 1h while on the 15m giving you a lot of information in one tool. If a line is missing high or low, it is because it was broken, if both exist you are trading in range and cloud appears. If both sides break you get thick gray boxes above and below bar.
Get used to editing the inputs to suit your liking. Often 3-5 length and always looking at different resolutions to get a big picture story. You could put multiple instances of the study up to see them simultaneously. I based the idea off of Krausz's 3 day cycle which you can read about in his teachings. I tend to find it looking better using Heikin Ashi bar-style.
B3 Bar Cycle MTFThis is an interesting study that can be used as a tool for determining trend direction, and also could be a trailing stop setter. I use it as a gauge on MTF settings, in the pic MTF is turned off. If on, you can look at the bar cycle of the 1h while on the 15m giving you a lot of information in one tool. If a line is missing high or low, it is because it was broken, if both exist you are trading in range and cloud appears. If both sides break you get thick gray boxes above and below bar.
Get used to editing the inputs to suit your liking. Often 3-5 length and always looking at different resolutions to get a big picture story. You could put multiple instances of the study up to see them simultaneously. I based the idea off of Krausz's 3 day cycle which you can read about in his teachings. I tend to find it looking better using Heikin Ashi bar-style.