Did you make this picture with backtesting after the market had closed ?
In that case look to the spread of your broker this moment....
Thanks both.. I did the backtest when markets were still open. How can i fix this?
make a printstatement to see what is your spread " double Spread=Bid-Ask; "
Print("Spread ",Spread);
There are tools to set the spread, they have been mentioned recently . . .
https://www.mql5.com/en/forum/138405 and https://www.mql5.com/en/forum/138459 you can get SpreadGenerator here: SpreadGenerator the instructions are in the script, open in MetaEditor and read carefully.
Thanks, another question. Why is it closing anyway positions in the next bar? Stoploss has not been reached yet.
Solved that problem too, there was an error in the code.
Last thing and then i fixed this ea..
Everytime the setupbar condition is true it opens too many positions (300-400)... how to fix this? There's no difference in putting an
double ordtot=OrdersTotal(); if(ordtot<NPosMax){blabla}
or not...
i tried also with a for
for(ordtot=0;ordtot<NPosMax;ordtot++)
but with no results... I temporary solved writing 0 instead of MagicNumber, but the ea needs it...
for(ordtot=0;ordtot<NPosMax;ordtot++){ /* if (setupBARb==true && !New_Bar()) { ticket=OrderSend(Symbol(),OP_BUY,Lotti/2,prezzo,3,Low[1]-buffer,prezzo+Atr,"Momentum Method",0,0); OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES); ticketTL=OrderSend(Symbol(),OP_BUY,Lotti/2,prezzo,3,Low[1]-buffer,0,"Momentum Method",0,0); OrderSelect(ticketTL,SELECT_BY_TICKET,MODE_TRADES);}*/ if (setupBARs==true && !New_Bar()) { ticket=OrderSend(Symbol(),OP_SELL,Lotti/2,prezzo,3,prezzo+StopLoss*Punto,prezzo-Atr,"Momentum Method",MagicNumber,0,Green); OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES); /*ticketTL=OrderSend(Symbol(),OP_SELL,Lotti/2,prezzo,3,0,0,"Momentum Method",0,0); OrderSelect(ticketTL,SELECT_BY_TICKET,MODE_TRADES);*/} } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone, i have a problem with this ea. I think the images can explain themselves.