Universal MA Cross EA code help

 

Hello.

I have started using the Universal MA Cross EA developed here at TSD.

The version I use is 8.2 by firedave modified by codersguru.

The problem I am having with it is the trailing stop function, where it modifies the order sometimes many times a second and as i have more than one copy of the EA running my broker just cuts my feed after getting 10 order modifications a second for a few minutes.

Get around is to disable the TS feature and using a second EA to manage the SL TP and TS function but this has the disadvantage of having the same parameters to all the currencies i trade and that docent work out two well.

The question I have is would one of you coders have a look at the source and identify the value that causes this and show me how to change range to say one order modification to every 5 pip change.

I can generally understand simple coding but my talent is limited to cut and paste / trial and error and this code is way above me.

Files:
 
Saila Omen:
Hello.

I have started using the Universal MA Cross EA developed here at TSD.

The version I use is 8.2 by firedave modified by codersguru.

The problem I am having with it is the trailing stop function, where it modifies the order sometimes many times a second and as i have more than one copy of the EA running my broker just cuts my feed after getting 10 order modifications a second for a few minutes.

Get around is to disable the TS feature and using a second EA to manage the SL TP and TS function but this has the disadvantage of having the same parameters to all the currencies i trade and that docent work out two well.

The question I have is would one of you coders have a look at the source and identify the value that causes this and show me how to change range to say one order modification to every 5 pip change.

I can generally understand simple coding but my talent is limited to cut and paste / trial and error and this code is way above me.

Hi Saila Omen,

Pretty sure its a 5 digit broker problem, was fixed in this version

https://www.mql5.com/en/forum/general

post# 736

 

mrtools thank you for your reply.

I have tried most of the versions and have the same problem with all of them.

UniversalMACrossEA1.mq4

universalMACrossEAV1.1.mq4

universalMACrossEA + ecn 1.02.mq4

universalMACrossEA[5 Dig]-V4.mq4

universalMACrossEA 8.2.mq4

I am on a 5 digit broker and committed to version 8.2 in my post No:1 (used to adding the extra digit by now).

Hope someone has a moment to look at the code and identify the section where the time frame of the order modification is that is causing the disturbance between me and my broker.

Not giving up on this EA i love it and will just use external TS until someone helps me figure it out.

 
Saila Omen:
mrtools thank you for your reply.

I have tried most of the versions and have the same problem with all of them.

UniversalMACrossEA1.mq4

universalMACrossEAV1.1.mq4

universalMACrossEA + ecn 1.02.mq4

universalMACrossEA[5 Dig]-V4.mq4

universalMACrossEA 8.2.mq4

I am on a 5 digit broker and committed to version 8.2 in my post No:1 (used to adding the extra digit by now).

Hope someone has a moment to look at the code and identify the section where the time frame of the order modification is that is causing the disturbance between me and my broker.

Not giving up on this EA i love it and will just use external TS until someone helps me figure it out.

I have not tested this but this should work. It will only allow the trailing stop function to be executed once per bar.

Put this at the top of the EA anywhere before the init() function.

datetime bartime=0;

Then at around line 207 add these 2 lines and a curly brace at the end of this section:

//----------------------- TRAILING STOP SECTION

if(bartime!=Time[0]){

bartime=Time[0];

if(TrailingStop>0 && subTotalTrade()>0)

{

total = OrdersTotal();

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()<=OP_SELL &&

OrderSymbol()==Symbol() &&

OrderMagicNumber()==MagicNumber)

{

subTrailingStop(OrderType());

}

}

}

}
 

cyber1

Thank You So Much.

Works like a charm both back testing and froward on my demo account, I am really grateful.