This may apply to chart trading too, but I've been running Portfolio Trader for a few months now and have noticed that if an order doesn't fill completely the stop that normally generates on the fill isn't generated until the current bar closes (these are limit orders). I'm using 15 min bars so the delay can be significant. What is a good way to deal with this programmatically?
Thanks
Portfolio Trader--stop generation on partial fills [SOLVED]
I've been looking at this thread and even though it's regular MC it seems to relate to my question. It starts with a question specifically about Portfolio Trader but am I correct in thinking the solutions discussed are not? My understanding is IOG isn't supported.
Very interested in any ideas regarding the problem.
Thanks
Edit: forgot to post the thread! viewtopic.php?f=1&t=47959
Very interested in any ideas regarding the problem.
Thanks
Edit: forgot to post the thread! viewtopic.php?f=1&t=47959
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Hello darob,
There are two ways to address this situation:
1) Stop generating the order in the code if it is partially filled, then the exit orders will be generated.
2) Use Unmanged orders (TradeManager) to place the stop order to exit the position. You will need to monitor the open position size and adjust the quantity for the exit order accordingly.
There are two ways to address this situation:
1) Stop generating the order in the code if it is partially filled, then the exit orders will be generated.
2) Use Unmanged orders (TradeManager) to place the stop order to exit the position. You will need to monitor the open position size and adjust the quantity for the exit order accordingly.
Hi Henry, I'm liking option 1 and now I'm reviewing my code and per the attached screenshot it already should only be generating the order if StrategyInfoMarketPositionAtBroker == 0. If I understand this correctly the script is acting on this information at Bar.Close. So how do I force this to happen intra-bar in Portfolio Trader? Sorry if I'm being clueless here and missing something obvious (highly likely).
Edit: I assume there'd need to be a timeout so as to not sabotage orders that take a few seconds to fill completely? Thanks again.Is this simple change enough to force a recalculation at a higher resolution (assuming the 2nd data series is 30 sec or something) and give me quicker stop placement on partial fills? The backtest results are identical but I don't see a way to test this except in live trading.
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Hello darob,
I have further discussed this inquiry with our engineers and apologize for confusion.
Unfortunately there is no way to have an order cancelled and exits sent inside a 15 min bar in Portfolio Trader.
The most efficient solution will be using a lower resolution on data1 for trading.
Using unmanaged orders will still work, but requires more programming.
I have further discussed this inquiry with our engineers and apologize for confusion.
Unfortunately there is no way to have an order cancelled and exits sent inside a 15 min bar in Portfolio Trader.
The most efficient solution will be using a lower resolution on data1 for trading.
Using unmanaged orders will still work, but requires more programming.
- Henry MultiСharts
- Posts: 9165
- Joined: Aug 25 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Darob, you do not need to have Length of data2. You need to specify data2 in the function constructor. See example here.I was afraid you were going to say that. So in the following, how do you get m_averagefc1.length to act on BarsOfData(2)? I think I have m_averagefc1.price figured out.
Screen Shot 2016-12-11 at 6.02.04 PM.png
Many thanks