A detector for the indicator “ATR Worm“.
This indicator allows me to define the moment to open a trade.
As well as a safe distance to the next peaks / troughs (that distance not being respected, the considered trade won’t be taken).
With 2 scenarios :
In the case of the first scenario, I take the trade on the blue spot ;
In the case of the second one, I take the trade on the red spot ;
// General parameters
Pips = 0.5
monATR=AverageTrueRange[14](close)
monATR2=(AverageTrueRange[14](close)) * 2
// Results display
IF Close > Close[1] AND Close >= Low-Pips*pipsize+monatr THEN
result = 2
ELSIF Close < Close[1] AND Close <= High+Pips*pipsize-monatr THEN
result = -2
ELSIF Close > Close[1] AND Close >= Low[1]-Pips*pipsize+monatr THEN
result = 1
ELSIF Close < Close[1] AND Close <= High[1]+Pips*pipsize-monatr THEN
result = -1
ELSE
result = 0
ENDIF
// Colours display
IF result = 1 THEN
r = 127
g = 255
b = 0
ELSIF result = 2 THEN
r = 255
g = 0
b = 0
ELSIF result = -1 THEN
r = 127
g = 255
b = 0
ELSIF result = -2 THEN
r = 255
g = 0
b = 0
ELSE
r = 255
g = 255
b = 255
ENDIF
// 0 Line
DRAWHLINE (0) COLOURED ("grey") STYLE (line,1)
RETURN result COLOURED (r,g,b) STYLE (histogram)