Error 134 on first order with backtesting

 

Hi,


after I run the backtesting EA get error 134:

2017.08.06 22:23:59.658 2017.08.02 01:47:28  Tester: PrevBalance: 50000.00, PrevPL: 0.00, PrevEquity 50000.00, PrevMargin: 0.00, NewMargin: 118059, FreeMargin: -68059.00

2017.08.06 22:23:59.658 2017.08.02 01:47:28  Tester: not enough money for sell 1.00 EURUSD at 1.18047 sl: 0.00000 tp: 1.17997 [2017.08.02 01:47]

2017.08.06 22:23:59.658 2017.08.02 01:47:27  MACD Sample EURUSD,M5: Error opening SELL order : 134

2017.08.06 22:23:59.658 2017.08.02 01:47:27  MACD Sample EURUSD,M5: OrderSend error 134

2017.08.06 22:23:59.658 2017.08.02 01:47:27  Tester: PrevBalance: 50000.00, PrevPL: 0.00, PrevEquity 50000.00, PrevMargin: 0.00, NewMargin: 118061, FreeMargin: -68061.00

2017.08.06 22:23:59.658 2017.08.02 01:47:27  Tester: not enough money for sell 1.00 EURUSD at 1.18049 sl: 0.00000 tp: 1.17999 [2017.08.02 01:47]

2017.08.06 22:23:49.283 2017.08.02 00:00:00  MACD Sample inputs: TakeProfit=50; Lots=1; TrailingStop=30; MACDOpenLevel=3; MACDCloseLevel=2; MATrendPeriod=26; 

2017.08.06 22:23:49.268 TestGenerator: current spread 23 used


EA do not open any order. 


MT4 build 1090, broker XM.com






 
You must have multiple open orders to exhaust your free margin.
Risk depends on your initial stop loss and lot size.
  • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
  • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
  • Do NOT use TickValue by itself - DeltaPerLot
  • You must normalize lots properly and check against min and max.
  • You must also check FreeMargin to avoid stop out
Reason: