This indicator show possible beginning and end of a ‘flat trend’ (ranging market), based on ADX (with DI plus and DI minus) and Parabolic SAR indicator position according to the current price Close.
Converted from MT4 indicator by a request in the indicator’s forum.
//PRC_FlatTrend | indicator
//26.03.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
PADX=DIplus[14](close)
NADX=DIminus[14](close)
PSAR = SAR[0.02,0.02,0.2]
ExtMapBuffer1=0
ExtMapBuffer2=0
ExtMapBuffer3=0
ExtMapBuffer4=0
if (Psar < Close AND PADX > NADX) then
ExtMapBuffer2=1
endif
if (Psar < Close AND NADX > PADX) then
ExtMapBuffer4=1
endif
if (Psar > Close AND NADX > PADX) then
ExtMapBuffer1=1
endif
if (Psar > Close AND PADX > NADX) then
ExtMapBuffer3=1
endif
return ExtMapBuffer1 coloured(255,0,0) style(histogram,2), ExtMapBuffer2 coloured(50,205,50) style(histogram,2), ExtMapBuffer3 coloured(250,128,114) style(histogram), ExtMapBuffer4 coloured(144,238,144) style(histogram)