Download MetaTrader 5

Stoploss is ignored in strategy tester

To add comments, please log in or register
Bruno
7
Bruno  

I don't know if this is standard procedure and the test can't use stop losses, but I found no way to use them in the strategy tester.


I tried both the following code, but the stop loss get's completely ignored:

int slippage = 10;
double stoploss = 0.0001;
int MagicNumber = 123;

ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, slippage, stoploss, 0., "sell", MagicNumber, 0, Lime);
int slippage = 10;
double stoploss = NormalizeDouble(0.0001, digits);
int MagicNumber = 123;

ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, slippage, stoploss, 0., "sell", MagicNumber, 0, Lime);


Any ideas?

whroeder1
14781
whroeder1  
double stoploss = 0.0001;
  1. Tester is irrelevant.
  2. The SL price must be above the Ask for a sell.
  3. What are Function return values ? How do I use them ? - MQL4 forum
  4. Trailing Bar Entry EA - MQL4 forum
Bruno
7
Bruno  

Thank you, you solved my problem.

I had it all wrong about how the stoploss worked.

To add comments, please log in or register