double NormalizeLots(double lots, string pair=""){ if (pair == "") pair = Symbol(); double lotStep = MarketInfo(pair, MODE_LOTSTEP), minLot = MarketInfo(pair, MODE_MINLOT); lots = MathRound(lots/ls) * ls; if (lots < minLot) lots = 0; // or minLot return(lots); }
There is no magic here .... I am just using the OrderSend method:
ticket=OrderSend(Symbol(),OP_BUY,volume,Ask,Slippage,StopLossLevel,TakeProfitLevel,comment,12345,0,LongOrderColor);
I can run it with a volumne of 0.12 in online mode and in offline mode it will throw an error 131.
The issue is that ...
MarketInfo(Symbol(), MODE_LOTSTEP)
returns 0.01 in online mode and 0.1 in offline mode. WHY??????
returns 0.01 in online mode and 0.1 in offline mode. WHY??????
I thought you were talking about running the tester without a net connection to control the spread. Nothing should be changing. Describe exactly your procedure. Did you install in \program files* on Vista/Win7?
Are you talking about an offline chart, like Renko, Range bars etc.? You can not use MarketInfo(Symbol(), ...) or MarketInfo(NULL, ...) because the server has no knowledge of an offline chart. You must use the REAL symbol for those values.
Yes. MT4 is install ed in c:\Program Files\ on Win7.
Are you talking about an offline chart, like Renko, Range bars etc.? You can not use MarketInfo(Symbol(), ...) or MarketInfo(NULL, ...) because the server has no knowledge of an offline chart. You must use the REAL symbol for those values. |
The data I am using was downloaded from histdata.com.
MarketInfo("AUDNZD", MODE_MINLOT)
is returning 0.1 as well. It should return 0.01

- 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,
When I am using MT4 in online mode with my current broker (Oanda) I can use 2 digit lot sizes (e.g: 0.11) but if I do backwards testing on a weekend where I have to use the offline mode in order to be able to use the weekday spreads and not the week-end spreads for the whole testing I can only use 1 digit lot sizes (e.g 0.1). If I try to use 2 digit lot sizes I am getting a 131 error.
Does anyone know where to set the amount of lot size digits for the offline mode?
Thanks,
Wolfgang