so that’s about it, new to Forex, took a basic MACD EA and tweaked it to an 83% hit rate AND a 1:3 Risk:Reward ratio, so a pretty solid build to move to demo… or it WOULD be, if the trailing stop worked all the time.
the T/P is set at 80, the Trailing Stop at 30, so why i the “average loss” 10x the “average profit”? because every once in a while the stop doesn’t happen, and I lose 1500$!? when combing through the strategy tester sometimes the stop takes over 2 hours to “modify” onto the order.
Is there any code to insert into the EA to make a standard trailing stop modification, so it happens right away? (I know in demo/live I could run a separate EA for the s/l, but I can’t backtest 2 EAs at once)
What follows is every line with trailing stop on it:
input double Stoploss =30; ...
//--- check for trailing stop
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
//--- modify order and exit
if(!OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green))
Print("OrderModify error ",GetLastError());
return;
}
}
}
//--- check for trailing stop
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
//--- modify order and exit
if(!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red))
Print("OrderModify error ",GetLastError());
return;
}
}
}