Universal MA Cross EA - page 91

 

hi guys, thank you for keeping this thread alive. it's really amaze me to see that much of replies. hopefully someone could learn something from the EA or even better made some money from it. again thank you

 

I downloaded this ma&macd1.02ea to try it, thanks .paulc

 

When using this for GBPJPY there is an 'order modify error 1', This is only sometimes. Would that be due to the server.?

 
Blaiserboy:
When using this for GBPJPY there is an 'order modify error 1', This is only sometimes. Would that be due to the server.?

Blaiserboy, order modify error 1 means "No error returned, but the result is unknown".

 

I think the error is related to the order modification relating to ECN brokers and that 'normalize' has to be inserted into the areas where trailing stop and breakeven are being updated.

 
Blaiserboy:
I think the error is related to the order modification relating to ECN brokers and that 'normalize' has to be inserted into the areas where trailing stop and breakeven are being updated.

Blaiserboy, which version are you getting this error?

 

here is the corrected code

/----------------------- TRAILING STOP FUNCTION

//----------------------- SOURCE : CODERSGURU

//----------------------- MODIFIED : FIREDAVE

void subTrailingStop(int Type)

{

if(Type==OP_BUY) // buy position is opened

{

switch(TrailingStopType)

{

//----------------------- AFTER PROFIT TRAILING STOP

case 1:

iMA(NULL,TimeFrame,SlowMAPeriod,SlowMAshift,SlowMAType,SlowMAPrice,1);

if(Bid-OrderOpenPrice()>Pip*TrailingStop &&

OrderStopLoss()<Bid-Pip*TrailingStop)

{

OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Pip*TrailingStop,Digits),OrderTakeProfit(),0,Green);

return(0);

}

break;

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

case 2:

if(Bid>OrderOpenPrice() &&

OrderStopLoss()<Bid-Pip*TrailingStop)

{

OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Pip*TrailingStop,Digits),OrderTakeProfit(),0,Green);

return(0);

}

break;

//----------------------- DEFAULT : AFTER PROFIT TRAILING STOP

default:

if(Bid-OrderOpenPrice()>Pip*TrailingStop &&

OrderStopLoss()<Bid-Pip*TrailingStop)

{

OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Pip*TrailingStop,Digits),OrderTakeProfit(),0,Green);

return(0);

}

}

}

if(Type==OP_SELL) // sell position is opened

{

switch(TrailingStopType)

{

//----------------------- AFTER PROFIT TRAILING STOP

case 1:

if(OrderOpenPrice()-Ask>Pip*TrailingStop)

{

if(OrderStopLoss()>Ask+Pip*TrailingStop || OrderStopLoss()==0)

{

OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+Pip*TrailingStop,Digits),OrderTakeProfit(),0,Red);

return(0);

}

}

break;

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

case 2:

if(OrderOpenPrice()>Ask)

{

if(OrderStopLoss()>Ask+Pip*TrailingStop || OrderStopLoss()==0)

{

OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+Pip*TrailingStop,Digits),OrderTakeProfit(),0,Red);

return(0);

}

}

break;

//----------------------- DEFAULT : AFTER PROFIT TRAILING STOP

default:

if(OrderOpenPrice()-Ask>Pip*TrailingStop)

{

if(OrderStopLoss()>Ask+Pip*TrailingStop || OrderStopLoss()==0)

{

OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+Pip*TrailingStop,Digits),OrderTakeProfit(),0,Red);

return(0);

}

}

}

}

}

 

Thank you. Looks great. I will be back after testing it.

 

I think you will find it to be an excellent tool......

Good Luck with it

 

Excellent EA, i was trading my ema crossover strategy manual with decent profits coz i have to sleep :P, but this week was awesome with this settings: "UseHourTrade"="True" 1 to 19 in XAUUSD TF M5 this week 180 pips.

NICE WORK!