TMAGi is an oscillator based on three moving averages and the +DI and -DI lines of the ADX indicator. It indicates the market state: uptrend/downtrend/flat.
Configurable parameters:
//PRC_TMAGi | indicator
//05.10.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from MT4 version
// --- settings
FastMA=8
MidMA=16
SlowMA=25
SlowingSMA=3
SlowingLWMA=8
// --- end of settings
ma1=average[FastMA]
ma2=average[MidMA]
ma3=average[SlowMA]
Buf = Abs(ma1-ma2)+Abs(ma2-ma3)+Abs(ma1-ma3)
idi=DIplus[14](high)-DIminus[14](low)
Buf = Buf * (idi/pointsize)
SG = average[SlowingSMA](Buf)
BS = WeightedAverage[SlowingLWMA](Buf)
return SG coloured(30,144,255) style(dottedline,3), BS coloured(220,20,60) style(line,3), 0 coloured(169,169,169) style(dottedline)