Small problem I'm needing help with. Simple Pivot Reversal script, with an EMA confirmation. On study, I can get flags to appear at the proper location; In this case when HIGH is greater than the High Price AND when the EMA is greater than it was on the last bar. HOWEVER, in a strategy it appears late and I'm not sure why. Suggestions? Both Study and Strategy do indeed have the same criteria for flags and strategy entries.
Experimenting I did determine the EMA confirmation is the issue. The flag/strategy entry line up perfectly without it enabled. But it appears in a strategy it doesn't recognize the EMA being higher than it was on the last bar
Strategy;
//EMA
out1 = ema(ema1src, ema1len)
ema1up = useema1 ? out1 > out1[1] : true
ema1down = useema1 ? out1 < out1[1] : true
if (longcondition and ema1up)
strategy.entry(Long
, strategy.long, qty = pos_size, comment=Long
, stop=hprice + syminfo.mintick)
Study;
//EMA1
out1 = ema(ema1src, ema1len)
ema1up = iff(useema1, out1 > out1[1], true)
ema1down = iff(useema1, out1 < out1[1], true)
long_final = long and ema1up
plotshape(long_final, text=Long
, color=color.green, location=location.belowbar, style=shape.labelup, size=size.normal, textcolor=color.white)