Slow reactions on CalcBar()

Questions about MultiCharts .NET and user contributed studies.
uniquepito
Posts: 6
Joined: 16 Jan 2014
Has thanked: 3 times

Slow reactions on CalcBar()

Postby uniquepito » 31 Jan 2014

Hello
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);
but then I want to cancel stoploss order immediately after this order is placed via

Code: Select all

tradingProfile.CancelOrder(stopLossOrderId);
It won't cancel stopLossOrder immediately and because FX market volatility is high it happens that from time to time it opens me new Sell order, because Bar reached stopLoss point and stopLoss order is not cancelled yet (but buyOrder is closed already).

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.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Slow reactions on CalcBar()

Postby Henry MultiСharts » 03 Feb 2014

Hello uniquepito,

Please send me (support@multicharts.com) the following information for analysis of this case:
- What exact version and build number of MultiCharts .NET are you running? (in MultiCharts go to Help tab-> About);
- workspace you are using;
- in PowerLanguage .NET editor->File->Export->the study you are having problem with. Send me the study export file;
- Please attach a detailed problem description and highlight the problem on the screenshots.


Return to “MultiCharts .NET”