Hi @adeelq79
Here’s the basic version…
Use enough units to calculate all the averages correctly and as expected, the combination of five timeframes and their corresponding units is a challenge for your computer… 🙂
DefParam DrawOnLastBarOnly=True
length=20
mult=1.2
src=close
TimeFrame(5 minutes)
lag=floor((length-1)/2)
myzlema5=average[length,1](src+(src-src[lag]))
atr5=averagetruerange[length](close)
volatil5=highest[length*3](atr5)*mult
if close > myzlema5+volatil5 then
DrawText("TF 5min",-300,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bullish",-200,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
elsif close < myzlema5-volatil5 then
DrawText("TF 5min",-300,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bearish",-100,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
else
DrawText("TF 5min",-300,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Neutral",-100,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
EndIf
TimeFrame(15 minute)
myzlema15=average[length,1](src+(src-src[lag]))
atr15=averagetruerange[length](close)
volatil15=highest[length*3](atr15)*mult
if close > myzlema15+volatil15 then
DrawText("TF 15min",-300,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bullish",-200,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
elsif close < myzlema15-volatil15 then
DrawText("TF 15min",-300,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bearish",-100,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
else
DrawText("TF 15min",-300,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Neutral",-100,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
endif
TimeFrame(1 hour)
myzlema1H=average[length,1](src+(src-src[lag]))
atr1H=averagetruerange[length](close)
volatil1H=highest[length*3](atr1H)*mult
if close > myzlema1H+volatil1H then
DrawText("TF 1hour",-300,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bullish",-200,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
elsif close < myzlema1H-volatil1H then
DrawText("TF 1hour",-300,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bearish",-100,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
else
DrawText("TF 1hour",-300,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Neutral",-100,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
endif
TimeFrame(4 hour)
myzlema4H=average[length,1](src+(src-src[lag]))
atr4H=averagetruerange[length](close)
volatil4H=highest[length*3](atr4H)*mult
if close > myzlema4H+volatil4H then
DrawText("TF 4hour",-300,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bullish",-200,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
elsif close < myzlema4H-volatil4H then
DrawText("TF 4hour",-300,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bearish",-100,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
else
DrawText("TF 4hour",-300,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Neutral",-100,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
endif
TimeFrame(1 day)
myzlema1D=average[length,1](src+(src-src[lag]))
atr1D=averagetruerange[length](close)
volatil1D=highest[length*3](atr1D)*mult
if close > myzlema1D+volatil1D then
DrawText("TF 1day",-300,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bullish",-200,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
elsif close < myzlema1D-volatil1D then
DrawText("TF 1 day",-300,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Bearish",-100,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
else
DrawText("TF 1 day",-300,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
DrawText("Neutral",-100,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
endif
return (myzlema5+volatil5)as "zlema5+vol5" Coloured("Red"),(myzlema5-volatil5) as "zlema5-vol5" Coloured("Red"),(myzlema15+volatil15)as "zlema15+vol15" Coloured("Green"),(myzlema15-volatil15) as "zlema15-vol15" Coloured("Green"),(myzlema1H+volatil1H)as "zlema1H+vol1H" Coloured("Blue"),(myzlema1H-volatil1H) as "zlema1H-vol1H" Coloured("Blue"),(myzlema4H+volatil4H)as "zlema4H+vol4H" Coloured("Yellow"),(myzlema4H-volatil4H) as "zlema4H-vol4H" Coloured("Yellow"),(myzlema1D+volatil1D)as "zlema1D+vol1D" Coloured("Purple"),(myzlema1D-volatil1D) as "zlema1D-vol1D" Coloured("Purple")