Hi all, I need help on fetching right data in the 'for' loop (code is done, pls help correct if wrong somewhere).
Requirement is ...
If Close > EMA(C,20)
then Low of the candle - EMA(C,20)
Else
then EMA(C,20) - High of the candle
And the values need to get plotted over the candle (above/below).
I plotted but unable to retrieve right value. Additionally last recent 3 candles alone need to get plotted.
Can somebody help for the below code.
Requirement is ...
If Close > EMA(C,20)
then Low of the candle - EMA(C,20)
Else
then EMA(C,20) - High of the candle
And the values need to get plotted over the candle (above/below).
I plotted but unable to retrieve right value. Additionally last recent 3 candles alone need to get plotted.
Can somebody help for the below code.
HTML:
Plot(EMA(C,20), "20 (e)MA", colorWhite, styleThick );
Buy = C > EMA(C,20);
Sell = EMA(C,20) > C;
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText("Up \n@" + NumToStr((L[i] - EMA(C[i],20)),1.2), i, L[ i ],colorYellow );
if( Sell[i] ) PlotText("Down \n@" + NumToStr((EMA(C[i],20) - H[i]),1.2), i, H[ i ], colorWhite );
}
Last edited: