Just a cautionary note for those using Portfolio Trader.
If under any circumstance you send an order from within your CalcBar loop and Bars.Status != EBarState.Close your order will go nowhere, there will be no log/error/warning of this event taking place either.
So if you plan to send an order and have logic so that this action is only performed once, make sure that you are checking for a Bars.Status of close otherwise your orders won't make it to your broker!
Portfolio Trading - Orders getting lost
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Portfolio Trading - Orders getting lost
I think you mean that orders that are submitted intra-bar are only active till the next tick, while orders that are submitted on bar close remain active during the next bar?If under any circumstance you send an order from within your CalcBar loop and Bars.Status != EBarState.Close your order will go nowhere, there will be no log/error/warning of this event taking place either.
Did you use intra-bar order generation (IOG) by the way?
With IOG, existing, pending orders that aren't resubmitted when the strategy calculates again are cancelled. So with IOG, active orders need to be resubmitted on every tick as long as you want to keep them active. Could that explain why your order was lost with no error trace?
Re: Portfolio Trading - Orders getting lost
First there is no way to use IOG with Portfolio Trader (it's not an option), unless IOG is implicitly turned on when the option to align data series is disabled. Although, I have seen that even if data series historical alignment is set to true and the EBarState is equal to None than the order will also go nowhere.I think you mean that orders that are submitted intra-bar are only active till the next tick, while orders that are submitted on bar close remain active during the next bar?If under any circumstance you send an order from within your CalcBar loop and Bars.Status != EBarState.Close your order will go nowhere, there will be no log/error/warning of this event taking place either.
Did you use intra-bar order generation (IOG) by the way?
With IOG, existing, pending orders that aren't resubmitted when the strategy calculates again are cancelled. So with IOG, active orders need to be resubmitted on every tick as long as you want to keep them active. Could that explain why your order was lost with no error trace?
All I know is that when using Portfolio trader if you have more than one data series and more than one strategy that if you submit an order when EBarState is anything other than Close it is as though the call to send the order was never made.
I do find it odd that the MC API puts the onus on the user to check for this bar state before sending their orders or perhaps this is common knowledge for those who are familiar with the platform.
I "think" what might be happening is that IOG like behavior is being leaked into Portfolio Trader even though it is not supported and it is up to the user to ensure that their strategy is not in an IOG like state (if that makes any sense).