Help

#1
Hello,

In real time the indicators are calculated as the price raises and low in the last candle. Therefore just as the price the indicator to oscillate until it finalizes the candle and it leaves the following one.
I need that the indicator only calculates once the candle has finalized. That it sentences must add to the following indicator.

BG2a=HHV(LLV(L,6)+ATR(6),6);
BR2a=LLV(HHV(H,6)-ATR(6),6);
Candlecolor = IIf(Close>BG2a ,colorBlue,IIf(Close < BR2a,colorRed,colorYellow));
He=EMA(High,5);
Le=EMA(Low,5);
Ce=EMA(Close,5);
Ae=(He+Ref(He,-1)+Ref(He,-2)+Ref(He,-3)+Ref(He,-4)+
Le+Ref(Le,-1)+Ref(Le,-2)+Ref(Le,-3)+Ref(Le,-4)+
Ce+Ref(Ce,-1)+Ref(Ce,-2)+Ref(Ce,-3)+Ref(Ce,-4))/15;

Plot(Ae,"EMA Average:",CandleColor,styleLine+styleThick);


Greetings,
 
#2
hi

Code:
/* I need that the indicator only calculates once the candle has finalized. */
finalized= Ref(Ae,-1);
Plot(finalized,"EMA Average:",CandleColor,styleLine+styleThick);
 
#4
ok
i think now you understand that REF(mycondition,-1) is the previous bar
So also you can Shift the paint line, and the color -1 bar with the same thinking, and you can see the accurate of visible calculation once the candle has finalized.

Code:
/* I need that the indicator only calculates once the candle has finalized. */
finalized= Ref(Ae,-1);
Candlecolor_finalized=Ref(Candlecolor, -1);
Plot(finalized,"EMAAverage:",Candlecolor_finalized,styleLine+styleThick,0,0,-1);
 
Last edited:

Similar threads