Plotting the EMA for the upper and lower wick of either green or red candles in MQL5

Viewed 20

Can someone explain to me how I am able to calculate the EMA of only the RED or GREEN candle wicks in MQL5?

So I have the PineScript code because my MQL5 code isn’t as clear.

Thanks in advance for taking the time to look over my question.

// defining what direction a candle has 
greenCandle =   (close > open)
redCandle =     (close < open)

// defining what the upper/lower wick of a candle is 
UMA = if close > open
    high - close 
else 
    high - open 

LMA = if close > open 
    low - open 
else 
    low - close 

// calculating the exponential moving average of the upper/ lower wick
UMAX = ta.ema(UMA, 9)
LMAX = ta.ema(LMA, 9)

0 Answers
Related