Backtesting help
Can't figure out why this code won't backtest properly. The backtest runs, but no
results and no trades occur. The code seems correct to me. Anybody have any ideas?
- I use Low[], but the result is Open[], why?
- Trading system "Terminator" + expert advisor
- 'Some operator expected' Compilation Error.
These are the journal messages I'm getting:
basic buy EURUSD.spot,M1: OrderSend error 134
tester: PrevBalance: 10000.00, PrevPl: 0.00, PrevEquity 10000.00, PrevMargin: 0. 00, NewMargin: 200000, FreeMargin: -190000.00
Tester: not enough money for buy 100.00 EURUSD.spot at 1.3862 sl: 0.0000 tp:0.0000[2007. 09.17 23:58]
Do I have to enter in a positive amount of free margin somewhere?
basic buy EURUSD.spot,M1: OrderSend error 134
tester: PrevBalance: 10000.00, PrevPl: 0.00, PrevEquity 10000.00, PrevMargin: 0. 00, NewMargin: 200000, FreeMargin: -190000.00
Tester: not enough money for buy 100.00 EURUSD.spot at 1.3862 sl: 0.0000 tp:0.0000[2007. 09.17 23:58]
Do I have to enter in a positive amount of free margin somewhere?
"The code seems correct to me"
Look again.
Okay. I changed to code a little bit. I thought the close order might be mathmatically
incorrect. But that doesn't explain why no orders are being opened and I'm still
getting the same "not enough money" errors.
new code:
new code:
int start() { double PosHigh = High[iHighest(NULL, 0, MODE_HIGH, iBarShift(NULL, 0, OrderOpenTime()), 0)]; int ticket = 0; int PosStart; if(ticket == 0) { if (Close[PERIOD_M1] > Open[PERIOD_M5]) { ticket = OrderSend(Symbol(),OP_BUY,5,Ask,3,NULL,NULL,NULL,0,0,Green); PosStart = Ask; } } if(ticket != 0) { if (Bid > (PosStart + 0.008)) { if (Bid < ((PosHigh - Bid) * 0.75)) { OrderClose(ticket,1,Bid,3,Red); } } } return(0); }
I changed the send order info to what is given in the manual:
(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384, 0,Green)
But what do I put for slippage, tp, and sl, if I don't want to use any of those features? That is, if I only want the order to go through with no slippage, no tp, and no sl? It appears that NULL doesn't work. help?
(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384, 0,Green)
But what do I put for slippage, tp, and sl, if I don't want to use any of those features? That is, if I only want the order to go through with no slippage, no tp, and no sl? It appears that NULL doesn't work. help?
Use 0 for no slippage, 0 for no stoploss, 0 for no takeprofit
Reduce the number of lots if you don't have enough money, or open a demo with more democash