Hello!
I use a strategy that predominantly uses stop orders, which it generates every new bar at the desired entry. I had the misfortune today of having my buy stop order filled on the bid price only for the trade price to then immediately reverse from that position without touching the fill price. In almost 1,000 trades this year, this has been the first time the strategy and the broker have become desynchronised in this manner. As far as the strat was concerned going by the trade price that it could 'see,' the order should never have been filled and it should still have been short, except of course it was long. It cost me a small fortune because a reversal signal was not generated until some time and many pips later, but of course this is my fault for not thinking ahead.
I have been looking into this, and I don't want to abandon stop orders (with which this is an inherent issue of course, because the trade price seen by the strat won't always be the price on offer), but I note that recalculate on broker events is enabled by default for signals. If I were to enable IOG on a one order per bar basis would this have been able to correct itself after the initial 'false' fill?
Thank you very much for your time.
Signals - when a stop order is filled outside of trade price
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Hello jr123,
"Recalculate on broker events" option allows sending orders generated intra-bar only when IOG is enabled. Depending on the IOG option you have selected and your code the strategy can send different amount of orders:
For example you have two entry and two exit lines for sending orders in your code.
With option 1 (limit each order command in this signal to one entry and one exit per bar) both entry and exit lines of code will generate an order (entries *1* and *3*, exits *2* and *4*).
With option 2 (Limit this signal to one entry and one exit per bar) only one entry and one exit line of code can generate an order (entry *1*, exit *2*).
Option 3 is self explaining.
"Recalculate on broker events" option allows sending orders generated intra-bar only when IOG is enabled. Depending on the IOG option you have selected and your code the strategy can send different amount of orders:
For example you have two entry and two exit lines for sending orders in your code.
With option 1 (limit each order command in this signal to one entry and one exit per bar) both entry and exit lines of code will generate an order (entries *1* and *3*, exits *2* and *4*).
With option 2 (Limit this signal to one entry and one exit per bar) only one entry and one exit line of code can generate an order (entry *1*, exit *2*).
Option 3 is self explaining.
Code: Select all
buy ("*1*") next bar at market;
buy ("*3*") next bar at market;
sell ("*2*") next bar at market;
sell ("*4*") next bar at market;
Henry, thanks very much. Using stop orders, I was thinking that I probably get filled at the bid and the ask quite often while the mid price hasn't caught up to that price point, but 99.9% of the time it will within a few seconds (generally even less), hence why I so rarely see this behaviour and desync. However checking the strat like this (on broker event) might cause the position to correct itself too many times than is necessary. I was therefore thinking of instead using the from strategy to broker mp synchroniser signal with a 10,000 ms check rate. I think this would generally give the price a bit of time to follow through while still giving me some protection against the signal being incorrect for a long period of time?
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
jr123, please elaborate the exact issue you have. Provide accurate issue description and attach screenshots and code demonstrating it (if possible). What exactly do you want to improve?