This indicator follows on the previous #TheStrat indicators which compliment the work of @RobInTheBlack (Twitter Handle) who has helped countless traders with this pure price action based strategy that he developed over the past 27 years of trading, It is called #TheStrat
This indicator will number the different candle types as mentioned here: https://www.newtraderu.com/2019/02/13/what-do-we-know-to-be-true-about-price-action/
The Moving Average period in the configuration is used to determine which side of the candle the 1 and 3 candles are displayed.
I recommend importing the .ITF in order to load the variables, but for those interested here is the code:
//Spacing = 3
//Tollerance = 0
//MovingAverage = 40
InsideBar = high < high[1]-tollerance*pointsize and low > low[1]+tollerance*pointsize
OutsideBar = high > high[1]+tollerance*pointsize and low < low[1]-tollerance*pointsize
TwoUp = high > high[1]+tollerance*pointsize and low > low[1]+tollerance*pointsize
TwoDown = low < low[1]-tollerance*pointsize and high < high[1]-tollerance*pointsize
Up = close > open+tollerance*pointsize
Down = close < Open-tollerance*pointsize
If TwoUp Then
drawtext("2↑",barindex,low-spacing*pointsize,dialog,standard,12) coloured(0,255,0)
ElsIf TwoDown Then
drawtext("2↓",barindex,high+spacing*pointsize,dialog,standard,12) coloured(255,0,0)
ElsIf InsideBar Then
If low > Average[MovingAverage](close) Then
drawtext("1",barindex,low-spacing*pointsize,dialog,standard,12) coloured(255,165,0)
Else
drawtext("1",barindex,high+spacing*pointsize,dialog,standard,12) coloured(255,165,0)
EndIf
ElsIf OutsideBar Then
If low > Average[MovingAverage](close) Then
drawtext("3",barindex,low-spacing*pointsize,dialog,standard,12) coloured(0,0,255)
Else
drawtext("3",barindex,high+spacing*pointsize,dialog,standard,12) coloured(0,0,255)
EndIf
EndIf
Return