The TMA Slope oscillator is a simple slope of a Triangular Moving Average compared and normalized with the Average True Range of the last 100 periods (default setting).
This specific version add 2 triggers to give trading signals according to the slope:
These trading signals should be compared between different timeframes (attached examples), for a better accuracy.
Converted from an MT4 indicator, by a request in the English ProBuilder forum.
//PRC_TMA Slope Norm | indicator
//31.10.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//translated from MT4 code
defparam drawonlastbaronly=true
// --- settings
//eintPeriod = 20
//edblHigh1 = 0.04
//edblLow1 = -0.04
//atrPeriod = 100
// --- end of settings
atr = AverageTrueRange[atrPeriod](close)
dblTma = TriangularAverage[eintPeriod](close)
if barindex>eintPeriod then
dblPrev = dblTma[1]
gadblSlope = ( dblTma - dblPrev ) / atr
if ( gadblSlope[0] > edblHigh1 ) then
if(gadblSlope[0] < gadblSlope[1]) then
gadblUp1 = gadblSlope[0]
gadblUp2 = 0
gadblDn1 = 0
gadblDn2 = 0
gadblMid1 = 0
gadblMid2 = 0
else
gadblUp1 = 0
gadblDn1 = 0
gadblDn2 = 0
gadblUp2 = gadblSlope[0]
gadblMid1 = 0
gadblMid2 = 0
endif
elsif ( gadblSlope[0] < edblLow1 ) then
if(gadblSlope[0] < gadblSlope[1]) then
gadblUp2 = 0
gadblDn1 = 0
gadblUp1 = 0
gadblDn2 = gadblSlope[0]
gadblMid1 = 0
gadblMid2 = 0
else
gadblUp2 = 0
gadblUp1 = 0
gadblDn2 = 0
gadblDn1 = gadblSlope[0]
gadblMid1 = 0
gadblMid2 = 0
endif
else
if(gadblSlope[0] < gadblSlope[1]) then
gadblMid2 = gadblSlope[0]
gadblMid1 = 0
gadblUp1 = 0
gadblUp2 = 0
gadblDn1 = 0
gadblDn2 = 0
else
gadblMid1 = gadblSlope[0]
gadblMid2 = 0
gadblUp1 = 0
gadblUp2 = 0
gadblDn1 = 0
gadblDn2 = 0
endif
endif
endif
if gadblSlope>0 then
offset = edblLow1
else
offset = edblHigh1
endif
drawtext("#gadblSlope#",barindex,offset*2,Dialog,Bold,16)
if gadblSlope>edblHigh1 then
drawtext("Buy Only",barindex,offset*3,Dialog,Standard,18) coloured(0,255,0)
elsif gadblSlope<edblLow1 then
drawtext("Sell Only",barindex,offset*3,Dialog,Standard,18) coloured(255,0,0)
else
drawtext("Ranging",barindex,offset*3,Dialog,Standard,18) coloured(100,100,100)
endif
return gadblUp1 coloured(0,128,0) style(histogram,1), gadblUp2 coloured(0,255,0) style(histogram,1), gadblDn1 coloured(178,34,34) style(histogram,1), gadblDn2 coloured(255,0,0) style(histogram,1), gadblMid1 coloured(0,128,128) style(histogram,1), gadblMid2 coloured(255,105,180) style(histogram,1), edblHigh1 coloured(100,100,100) style(dottedline) , edblLow1 coloured(100,100,100) style(dottedline)