Dear MultiCharts fans,
today, I was seeing an issue with a stop loss order not submitted to the broker. Here is the string of events:
* a stop-order is triggered, surprisingly far away from the market price
* because of that, the signal wasn't aware the order filled
* this seems to have caused the stop-loss order to not being submitted
What I would have liked to see:
* submission of the stop-loss order the moment the order was filled - pretty much regardless if my signal agrees with the position being opened or not
Further info:
* I am working with daily data in Portfolio Trader
* the signal is set to recalculate on order filled, but not on market position change
* mode is set to Sync
What am I missing?
Thank you,
best regards, Felix
stop loss not submitted [SOLVED]
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: stop loss not submitted
Hello fbertram,
Is there any particular reason why the 'recalculate on position change" is not used?
Stop order price is determined by your code. Most likely you need to re-configure the inputs or check the price calculation in the code itself.* a stop-order is triggered, surprisingly far away from the market price
Judging by what you have described, the strategy must have been synced. I see the only possible reason of this - the order status was not received from the broker.* because of that, the signal wasn't aware the order filled
* this seems to have caused the stop-loss order to not being submitted
...
* the signal is set to recalculate on order filled, but not on market position change
* mode is set to Sync
Is there any particular reason why the 'recalculate on position change" is not used?
Re: stop loss not submitted
Andrew, there are two options for recalculate setting: (a) market position change, and (b) order filled. I understand these correspond to different response messages received from broker.Is there any particular reason why the 'recalculate on position change" is not used?
1. Is one more responsive than the other and are you recommending that setting recalculate on market position change is to be preferred?
2. What exact broker responses do these correspond to? Take IB as example for answering the question.
Thanks.
- fbertram
- Posts: 166
- Joined: 16 Oct 2014
- Location: Seattle, USA
- Has thanked: 36 times
- Been thanked: 76 times
- Contact:
Re: stop loss not submitted
Hi Andrew,
thanks a lot for your response. The only reason why I didn't use 'recalculate on position change' is because MultiCharts has it disabled by default...
I was able to understand a little better what happened. Actually MultiCharts didn't fail to place the stop-loss order. Instead, IB was executing the order after the regular trading session ended - which is why MultiCharts didn't see it. See my other thread.
Thank you,
best regards, Felix
thanks a lot for your response. The only reason why I didn't use 'recalculate on position change' is because MultiCharts has it disabled by default...
I was able to understand a little better what happened. Actually MultiCharts didn't fail to place the stop-loss order. Instead, IB was executing the order after the regular trading session ended - which is why MultiCharts didn't see it. See my other thread.
Thank you,
best regards, Felix
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: stop loss not submitted [SOLVED]
That is correct.Andrew, there are two options for recalculate setting: (a) market position change, and (b) order filled. I understand these correspond to different response messages received from broker.
The point is: those message can come asynchronically and also sometimes some of them may even get lost. This is why there are 2 options.1. Is one more responsive than the other and are you recommending that setting recalculate on market position change is to be preferred?
2. What exact broker responses do these correspond to? Take IB as example for answering the question.
You actually did the right thing. It is not accidential that the "market position change" is not checked there. Otherwise it would trigger recalculation on every market position change for the whole portfolio.The only reason why I didn't use 'recalculate on position change' is because MultiCharts has it disabled by default...
Re: stop loss not submitted
The point is: those message can come asynchronically and also sometimes some of them may even get lost. This is why there are 2 options.
Andrew, thanks for clarifying. Two more questions to clear my confusion on this topic:You actually did the right thing. It is not accidential that the "market position change" is not checked there. Otherwise it would trigger recalculation on every market position chnage for the whole portfolio.
1. I should leave the "market position change" unchecked to not trigger frequent recalculation?
2. What exactly is meant by "recalculation" since any order action in PL code has a "next bar" clause and orders will not fire until next bar. So how does immediate recalculation on order fill help? What is being recalculated?
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: stop loss not submitted
Yes.1. I should leave the "market position change" unchecked to not trigger frequent recalculation?
Example 1:2. What exactly is meant by "recalculation" since any order action in PL code has a "next bar" clause and orders will not fire until next bar. So how does immediate recalculation on order fill help? What is being recalculated?
Code: Select all
Buy next bar market;
SetStopLoss(50);
SetProfitTarget(100);
On close of bar 51 all 3 orders are generated.
On open of bar 52 the market order is triggered.
When bar 52 is not yet closed the order is filled.
The stop loss and profit target orders are sent even though the IOG is not used/allowed.
Example 2:
Code: Select all
Buy next bar market;
SetStopLoss(50);
SetProfitTarget(100);
The same as above.
Example 3:
Code: Select all
[IntrabarOrderGeneration=true]
Buy next bar market;
SetStopLoss(50);
SetProfitTarget(100);
On close of bar 51 all 3 orders are generated.
On open of bar 52 the market order is triggered.
If before the second tick of bar 52 the order is filled, the code is recalculated before the second tick.
The stop loss and profit target orders are sent at the second tick of the bar 52.
Example 4:
Code: Select all
[IntrabarOrderGeneration=true]
Buy next bar market;
SetStopLoss(50);
SetProfitTarget(100);
On close of bar 51 all 3 orders are generated.
On open of bar 52 the market order is triggered.
If before the second tick of bar 52 the order is filled, the code is NOT recalculated before the second tick.
The code is recalculated at the second tick of the bar 52.
The stop loss and profit target orders are sent at the third tick of the bar 52.