Hi,
I have simple Signal where I have 2 lines of code on CalcBar():
- Unconditional GENERATESTOPLOSS,
- and Buy at Market after 11. That's it.
In IB, I see orders:
- Bought at 11, which is OK, Right after that I see:
- STP Order with correct share amount, which I expect as well. BUT AFTER THAT I HAVE:
- after several seconds - My STP order is canceled and New STP order issued.
It happens ONLY in IOG = true. Issue is 100% reproducible.
The only way I could get rid of this CANCEL / Re-SUBMIT of STP orders is after:
- Unchecked Broker events (both on Position change and on Position Filled)
- Put GENERATESTOPLOSS under condition if MarketPosition <> 0
Dear Support. This issue means for me that either I don't understand how it works or it is bug with MC / IB communication.
Why I have STP orders Cancelled and re-created.
No change in position, I always sell /buy the same number of shares.
Please, Investigate my request.
GenerateStopLoss issue with its STP Orders with IB in IOG !
- Kristina MultiCharts
- Posts: 63
- Joined: 04 Sep 2014
- Has thanked: 5 times
- Been thanked: 34 times
Re: GenerateStopLoss issue with its STP Orders with IB in IO
Hello,
We are currently looking into this case on our end. I'll get in touch with you via email as soon as I have some feedback from the engineers.
We are currently looking into this case on our end. I'll get in touch with you via email as soon as I have some feedback from the engineers.
- Kristina MultiCharts
- Posts: 63
- Joined: 04 Sep 2014
- Has thanked: 5 times
- Been thanked: 34 times
Re: GenerateStopLoss issue with its STP Orders with IB in IO
Hello,
The issue was confirmed by our engineers. We are working on the fix. As soon as we have some updates on the ETA we'll let you know.
The issue was confirmed by our engineers. We are working on the fix. As soon as we have some updates on the ETA we'll let you know.
- Kristina MultiCharts
- Posts: 63
- Joined: 04 Sep 2014
- Has thanked: 5 times
- Been thanked: 34 times
Re: GenerateStopLoss issue with its STP Orders with IB in IO
Hello,
Upon further analysis of the case, the engineers confirmed that everything is working as expected
in accordance with your workspace settings.
You selected options for strategy recalculation on "Market Position Change" and "Order Filled" events in Strategy Properties.
In MultiCharts.Net for calculation on these events you need to override these methods:
protected override void OnBrokerPositionChange() and protected override void OnBrokerStategyOrderFilled(bool is_buy, int quantity, double avg_fill_price)
Otherwise, when the strategy is recalculated on these events no orders will be generated and as a result of such calculation all existing orders will be cancelled.
You can either override the methods or uncheck the options to recalculate on "Market Position Change" and "Order Filled" events in Strategy Properties.
Please add the methods below to your signal code:
Upon further analysis of the case, the engineers confirmed that everything is working as expected
in accordance with your workspace settings.
You selected options for strategy recalculation on "Market Position Change" and "Order Filled" events in Strategy Properties.
In MultiCharts.Net for calculation on these events you need to override these methods:
protected override void OnBrokerPositionChange() and protected override void OnBrokerStategyOrderFilled(bool is_buy, int quantity, double avg_fill_price)
Otherwise, when the strategy is recalculated on these events no orders will be generated and as a result of such calculation all existing orders will be cancelled.
You can either override the methods or uncheck the options to recalculate on "Market Position Change" and "Order Filled" events in Strategy Properties.
Please add the methods below to your signal code:
Code: Select all
protected override void OnBrokerPositionChange()
{
base.OnBrokerPositionChange();
CalcBar();
}
protected override void OnBrokerStategyOrderFilled(bool is_buy, int quantity, double avg_fill_price)
{
base.OnBrokerStategyOrderFilled(is_buy, quantity, avg_fill_price);
CalcBar();
}
Re: GenerateStopLoss issue with its STP Orders with IB in IO
Hi, Kristina. Thanks for reply.
Very well explained, I am sure those fixes would work.
However, still have minor questions:
- Why CalcBar() call is not included in base OnBrokerPositionChange() and OnBrokerStategyOrderFilled() functions on the first place and left for custom code to extend that;
-Is these 2 functions ever supposed to be used as stand alone with out CalcBar() call?
This is just for my understanding.
Thanks,
Victor
Very well explained, I am sure those fixes would work.
However, still have minor questions:
- Why CalcBar() call is not included in base OnBrokerPositionChange() and OnBrokerStategyOrderFilled() functions on the first place and left for custom code to extend that;
-Is these 2 functions ever supposed to be used as stand alone with out CalcBar() call?
This is just for my understanding.
Thanks,
Victor
- Kristina MultiCharts
- Posts: 63
- Joined: 04 Sep 2014
- Has thanked: 5 times
- Been thanked: 34 times
Re: GenerateStopLoss issue with its STP Orders with IB in IO
Hello,
CalcBar is not called on "Market Position Change" and "Order Filled" events, OnBrokerPositionChange() and OnBrokerStategyOrderFilled() methods are called on those events. It is up to the user to decide whether to call CalcBar or not. In your case in order for your existing orders not be cancelled and replaced, you need to call CalcBar from those 2 methods. Please use the provided example that I sent you in the previous reply.
CalcBar is not called on "Market Position Change" and "Order Filled" events, OnBrokerPositionChange() and OnBrokerStategyOrderFilled() methods are called on those events. It is up to the user to decide whether to call CalcBar or not. In your case in order for your existing orders not be cancelled and replaced, you need to call CalcBar from those 2 methods. Please use the provided example that I sent you in the previous reply.