how to create a function that get boolean on EMA crossover?

 

i would like to create an EA to trade when finding the previous candle signal.

EMA value...

FasterEMA = 4, SlowerEMA = 5.

As i know, i can code the checking current new bar candle performed or not, if new bar candle on chart performed, i will issue a signal flag to check EMA value, whether it have any signal? if no signal, pass return (0), if signal available, pass "buy" or "sell" signal.

i need help who can creat this function for me that i can include in my EA.

Below is what i needed on a new function.

1. check what is the previous EMA signal, if there is a signal, return a signal whether is "buy" or "sell", if no signal, return value false.

Note : with EMA setting...... FasterEMA = 4, SlowerEMA = 5. (The function will be use in any Timeframe that attach).

Pls kindly help. and i had attach a indicator, hope anyone could kindly help me with it. Thanks.

Files:
 

You can retrieve values from any indicator with iCustom(). Once you have the values, you can code your logic appropriately..

https://book.mql4.com/samples/shared

hth

V

 
Viffer:

You can retrieve values from any indicator with iCustom(). Once you have the values, you can code your logic appropriately..

https://book.mql4.com/samples/shared

hth

V


Are you mean that, i should recode the EMA_crossover to match my EA?
 
joelloh:

Are you mean that, i should recode the EMA_crossover to match my EA?

Nope, all the logic for your indicator stays in the indicator. You will need to build an EA to take actions. iCustom() in your EA will reference the values generated in the indicator buffers. If the indicator generates a certain signal / value, build your EA around what you want to do with the signal.

V

Reason: