a simple question

Created at 11 Aug 2020, 04:50
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!
SA

samuel.jus.cornelio

Joined 19.03.2020

a simple question
11 Aug 2020, 04:50


 

Hello everyone, a little help. How could I code a simple two EMA crossover bot I need the code referring only to the crossing of the EMAs Thank you very much for your attention


@samuel.jus.cornelio
Replies

PanagiotisCharalampous
11 Aug 2020, 08:07

Hi samuel.jus.cornelio,

You can use the HasCrossedAbove and HasCrossedBelow methods.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

samuel.jus.cornelio
11 Aug 2020, 16:01

RE:

PanagiotisCharalampous said:

Hi samuel.jus.cornelio,

You can use the HasCrossedAbove and HasCrossedBelow methods.

Best Regards,

Panagiotis 

Join us on Telegram

 

This Way??

 

 if (_rsi.Result.LastValue < 45)
                    if (_Ema1.Result.LastValue. HasCrossedBelow  _Ema2.ResultLastValue)



                        ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, "bot", StopLoss, TakeProfit);


@samuel.jus.cornelio

PanagiotisCharalampous
11 Aug 2020, 16:35

Hi samuel.jus.cornelio,

There are examples in the links above.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

samuel.jus.cornelio
11 Aug 2020, 17:44

RE:

PanagiotisCharalampous said:

Hi samuel.jus.cornelio,

There are examples in the links above.

Best Regards,

Panagiotis 

Join us on Telegram

 

Dear Sir Panagiotis I tried the example cited but was unsuccessful. Could you please give me a concrete example of a code where an Ema crosses another EMA. Thank you so much

 

 

 

Below is the code I tried if (_Ema1.Result.HasCrossedBelow (MarketSeries.Close, 0) _Ema2.Result.LastValue)


@samuel.jus.cornelio

PanagiotisCharalampous
12 Aug 2020, 07:49

Hi samuel.jus.cornelio,

Your code is wrong. Try the below

_Ema1.Result.HasCrossedBelow(_Ema2.Result, 0)

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

samuel.jus.cornelio
12 Aug 2020, 22:07

RE:

PanagiotisCharalampous said:

Hi samuel.jus.cornelio,

Your code is wrong. Try the below

_Ema1.Result.HasCrossedBelow(_Ema2.Result, 0)

Best Regards,

Panagiotis 

Join us on Telegram

 

THANK YOU SO MUCH THAT I NEEDED. My bot is working perfectly


@samuel.jus.cornelio