Adding filter to an existing ea

 

HI traders,

I have quite a good EA, but I think it would work even better when I add a filter to it.

Firstly, I will describe, how it works now: It is based on MA - when a candle crosses MA, it opens a trade by the beginning of the next candle (in the same direction as it crosse the candle). The closing condition is as follows: when the MA crosses candle in the opposite direction, or when it hits SL/TSL.

Now I would like to suggest a possible change to it: There would be one more condition. We open a trade only when the candle crosses MA - and at the same time both the candle and the MA must be rising(and vise versa). If the candle is going up, but the MA is still on decrease, we donť open a trade (and vise versa). We postpone a trade and execete it by the time the MA turns to the same direction as the candle. (It is not necessary to open a trade only when the MA crosses a candle...) We close the current trade at the same time we open a new one (bacically, we have one opened position all the time).

We expect, that the new vesion will have a great potential - we did a manual backtest, and the results were promising.

Could someone try to make a change to the code I am attaching? Or just give me a feedback, so that I know that it is really possible to code such change.fx_ma_robot_all_brokers.mq4

Thank you very much in advance!

Martin

 
 

Hi Alberto,

Thank you for the change, but it does not work fine at all on my account. (My broker is Alpari UK) It shows almost no trades and the average win is 1000 smaller than average loss. There must be sg wrong...

 

new version with only your rules changed

Michal,

Try this version.

Check the comments to find my changes.

Robert

 

Alpari

Michal Tesarik:
Hi Alberto, Thank you for the change, but it does not work fine at all on my account. (My broker is Alpari UK) It shows almost no trades and the average win is 1000 smaller than average loss. There must be sg wrong...

Something that may be an issue, I have recently found that indicators compiled on the lastest MT4 builds (406) do not work on Alpari live platforms it appears that Alpari live accounts are still on build 226 or at least that was the case just a few weeks ago when i had issues trying to get an indicator to work on a live Alpari platform.

Regards CJA

 

minor bug fix

Michal,

New version with minor bug fix. Stoploss and Takeprofit were not checked properly.

Did a quick check for September and more profit with stoploss 0 and takeprofit 0.

That means only exit at signals.

Robert

Reason: