This is a backtest result on Metatrader4, USDJPY, H1.
The backtest data is imported by 'Data Manager', 'Export to MT4' function.
Error 1:
Minus PT cause 'OrderModify error 4051'
2003.06.18 13:00:14 Strategy 1.44.100 USDJPY,H1: - SQ LOG 2003.06.18 13:00 Modifying order with ticket: 41, SL: 1.41400000 and PT: -0.91300000
2003.06.18 13:00:14 Strategy 1.44.100 USDJPY,H1: invalid takeprofit for OrderModify function
2003.06.18 13:00:14 Strategy 1.44.100 USDJPY,H1: OrderModify error 4051
2003.06.18 14:00:00 Strategy 1.44.100 USDJPY,H1: - SQ LOG 2003.06.18 14:00 Modifying order with ticket: 42, SL: 1.45400000 and PT: -0.91200000
2003.06.18 14:00:00 Strategy 1.44.100 USDJPY,H1: invalid takeprofit for OrderModify function
2003.06.18 14:00:00 Strategy 1.44.100 USDJPY,H1: OrderModify error 4051
2003.06.18 15:00:25 Strategy 1.44.100 USDJPY,H1: - SQ LOG 2003.06.18 15:00 Modifying order with ticket: 43, SL: 1.49800000 and PT: -0.91200000
2003.06.18 15:00:25 Strategy 1.44.100 USDJPY,H1: invalid takeprofit for OrderModify function
2003.06.18 15:00:25 Strategy 1.44.100 USDJPY,H1: OrderModify error 4051
Error 2:
It opens orders at a very far price. Sometimes try to open at a minus price.
Current price is '118.338', but try to order with price -0.03500000
2003.06.18 08:00:00 Strategy 1.44.100 USDJPY,H1: - SQ LOG 2003.06.18 08:00 Opening order type BUY STOP with price -0.03500000. Current market prices: 118.33800000 / 118.33800000
Current price is '118.554', but try to order with price 0.03700000
2003.06.18 13:00:14 Strategy 1.44.100 USDJPY,H1: - SQ LOG 2003.06.18 13:00 Opening order type SELL STOP with price 0.03700000. Current market prices: 118.55400000 / 118.55400000
Current price is '118.466', but try to order with price 0.03800000.
2003.06.18 14:00:00 Strategy 1.44.100 USDJPY,H1: - SQ LOG 2003.06.18 14:00 Opening order type SELL STOP with price 0.03800000. Current market prices: 118.46600000 / 118.46600000
Status changed from New to Waiting for information
NAPA, did it work well for you on default broker's data? does the problem occur only on exported tick data?
please confirm
I have tested on the default data and it works correctly. no negative values and order are placed accordingly
Attachment 20220921.zip added
Steps:
Generate a code by B136 Dev4
Install Metatrader4
Run backtest on the Real account.
Result:
There are many "OrderModify error 130", but there is no "OrderModify error 4051".
Because our broker doesn't supply the year 2003 data, I can't test it.