PROBLEM #1
Some trades were missing in the MT5 terminal that are present in SQX. Every tick, real spread Ducas data. I'm testing specifically on GOLD. The missing trade days produced these logs in MT5:
2022.04.16 17:47:13.544 Core 01 2014.02.14 13:00:00 ---VERBOSE--- 2014.02.14 13:00 Computing Money Management for order - Risk fixed % of account
2022.04.16 17:47:13.544 Core 01 2014.02.14 13:00:00 ---VERBOSE--- 2014.02.14 13:00 Computing Money Management - Smallest_Lot: 0.01000000, Largest_Lot: 100.00000000, Computed LotSize: 0.15000000
2022.04.16 17:47:13.544 Core 01 2014.02.14 13:00:00 ---VERBOSE--- 2014.02.14 13:00 Max money to risk: 100.53419000, SL:1304.79000000, Max 1 lot trade drawdown: 638.50000000, Point value: 100.00000000
2022.04.16 17:47:13.544 Core 01 2014.02.14 13:00:00 ---VERBOSE--- 2014.02.14 13:00 Based on its logic, the strategy tried to place market order at incorrect price. Market price: 1311.17500000, order price: 1311.18000000 (this is NOT an error)
It is a market order so why should this happen? It should put the order through anyways or try again immediately with updated prices. If we ignore the condition and just put the trade through with the following code then all but one of the missing trades start working in the terminal:
//---------------------------------------------------------------------------- bool checkOrderPriceValid(ENUM_ORDER_TYPE orderType, string symbol, double price, double marketPrice){ if(orderType == ORDER_TYPE_BUY || orderType == ORDER_TYPE_SELL){ if(sqDoublesAreEqual(marketPrice, price)){ return true; } else { VerboseLog("Based on its logic, the strategy tried to place market order at incorrect price. Market price: ", DoubleToString(marketPrice), ", order price: ", DoubleToString(price), " (this is NOT an error)"); VerboseLog("Putting through anyways"); return true; } } return checkStopPriceValid(orderType, symbol, price, marketPrice, "stop/limit order"); }
PROBLEM 2:
Some of the exits are inaccurate notice the trade in the screenshot 2014.04.04 buy in at 1299.258 is fine but the exit at 1301.787 is way off, it should be 1300.20 like in SQX.