OrderCheck() returns nothing in Strategy Tester

ammer.jens  

Hello, I want to check on margin before opening a trade and was thus using the OrderCheck() function as follows but it always returns zero for all values? Is this function not working in Strategy Tester?

         MqlTradeRequest      TradeRequest;
         MqlTradeCheckResult  TradeCheckResult;
         
         // Check Order
         TradeRequest.action       =TRADE_ACTION_DEAL;
         TradeRequest.symbol       =Symbol();
         TradeRequest.volume       =Lot_Sum;
         TradeRequest.type         =ORDER_TYPE_BUY;
         TradeRequest.type_filling =ORDER_FILLING_FOK; // Cannot figure out which one is default!
         // TradeRequest.position // Check for SELL order
         // TradeRequest.position_by // Check for SELL order

         OrderCheck(TradeRequest,TradeCheckResult);

         message+="TradeCheckResult.retcode      = "+(string)TradeResult.retcode+"\n";
         message+="TradeCheckResult.margin       = "+(string)TradeResult.deal+"\n";
         message+="TradeCheckResult.margin_free  = "+(string)TradeResult.order+"\n";
         message+="TradeCheckResult.margin_level = "+(string)TradeResult.volume+"\n";
         message+="TradeCheckResult.comment      = "+TradeResult.comment+"\n";

Afterwards, I use the Buy function of CTrade to open the trade and this works, so "Lot_Sum" seems not to be the issue...

CT.Buy(Lot_Sum);
Vladimir Karputov  
The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
ammer.jens  
Oh dear, need to stop for today... I used TradeResult and not TradeCheckResult.... too obvious. Sorry for that!
Reason: