I've tried to test automated trading strategy in one LMAX - FX account via Multicharts .net SE and I find out that reactions on placed order are terribly slow or at least behave weird.
For instance when I have placed buy order for 15 contracts and stop loss order too and when condition is met I'd like to take profit so I execute:
Code: Select all
OrderParams param = PrepareOrderParams(MTPA_OrdrActn.eMTPA_OA_Sell, MTPA_OrdrCtgry.eMTPA_OC_Market, StrategyInfo.MarketPositionAtBroker, MTPA_OrdrTimeInForce.eMTPA_TIF_IOC);
buyOrderId = tradingProfile.PlaceOrder(param);
Code: Select all
tradingProfile.CancelOrder(stopLossOrderId);
I did some tests and find out that even happens when I have Buy order placed and I do not have stopLoss order and I execute just Sell order, value in StrategyInfo.MarketPositionAtBroker is not changed even few calls of CalcBar().
Could anybody please tell me what I'm doing wrong, or why is this behavior so strange and help me how to avoid that? I need to execute on one CalcBar() 1-3 orders (to modify price/qunantity or cancel orders) when the conditions are met but it happens that those orders are delayed on next CalcBar when the conditions are different and I need to execute another order with changed parameters which are obviously not changed.
Thank you.