EMA HasCrossedAbove

Created at 16 Aug 2018, 10:38
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
US

usdissanayake@gmail.com

Joined 16.08.2018

EMA HasCrossedAbove
16 Aug 2018, 10:38


    Hi

I want to use HasCrossedAbove methord for last index. Please can you help me to do that.

Please see the below for my coding. please correct me 

MovingAverage _ema5 = Indicators.MovingAverage(Price, 5, MovingAverageType.Exponential);
WeightedMovingAverage  _Wma = Indicators.WeightedMovingAverage(Price, 14);


if(  _ema5.Result.HasCrossedAbove(_Wma.Result, 0))

{

}

 

thanks


@usdissanayake@gmail.com
Replies

PanagiotisCharalampous
16 Aug 2018, 12:01

Hi usdissanayake@gmail.com,

Thanks for posting in our forum. You can change your if statement to the following

if(  _ema5.Result.HasCrossedAbove(_Wma.Result, 1))

{

}

This will check if EMA has crossed WMA during the previous bar.

Best Regards,

Panagiotis


@PanagiotisCharalampous