I have a strategy that only generates sell signals (on positions bought by another strategy) However, running it in the Strategy Monitor occasionally creates short positions as if the Portfolio Sync fails to function properly.
I have not been able to figure out why these occasions happen other than thinking this must be an intermittent problem, because other times it works as expected.
Snapshot below of the Order window depicts this problem: the strategy is run in SM on a 1-minute bar and a dataset with 6 symbols with Auto-Place enabled. At 9:32:05 it generates and places a sell signal on symbol CRM which is immediately filled on the existing long position. However, 1 minute later it places again the same order which is now placed as a short sell signal since obviously the long position is not existing anymore. It is also worth noting that additional sell signals for other symbols (PYPL and MS,) correctly and as expected, generated errors.
Fyi, I have also included the Portfolio Synch settings
I have not been able to figure out why these occasions happen other than thinking this must be an intermittent problem, because other times it works as expected.
Snapshot below of the Order window depicts this problem: the strategy is run in SM on a 1-minute bar and a dataset with 6 symbols with Auto-Place enabled. At 9:32:05 it generates and places a sell signal on symbol CRM which is immediately filled on the existing long position. However, 1 minute later it places again the same order which is now placed as a short sell signal since obviously the long position is not existing anymore. It is also worth noting that additional sell signals for other symbols (PYPL and MS,) correctly and as expected, generated errors.
Fyi, I have also included the Portfolio Synch settings
Rename
Without knowing anything about your strategy except that it only sells, I can't explain the second sell - unless the strategy assigns a number to Transaction.Quantity, and then all bets for Portfolio Sync are off.
That said, Live Positions is not designed to trade positions from other strategies. When the strategy first initializes it syncs to the live broker positions, but then it keeps track of buying and selling live positions from the strategy. But your strategy isn't creating new positions, another strategy is doing that.
Maybe Glitch can add/correct/confirm this.
That said, Live Positions is not designed to trade positions from other strategies. When the strategy first initializes it syncs to the live broker positions, but then it keeps track of buying and selling live positions from the strategy. But your strategy isn't creating new positions, another strategy is doing that.
Maybe Glitch can add/correct/confirm this.
In fact, my strategy does assign a number to Transaction.Quantity. So are you suggesting that this might be the culprit? Because I can simply delete that line of the code and just rely on the Portfolio Sync to find/adjust the exit quantity (which is the full position)
Yes, you definitely have to do that.
When you assign a quantity, it essentially becomes a manual order.
Removing that assignment should prevent that second sell, but I'm not convinced that you'll sync to new positions from another strategy. Let me know! :)
When you assign a quantity, it essentially becomes a manual order.
Removing that assignment should prevent that second sell, but I'm not convinced that you'll sync to new positions from another strategy. Let me know! :)
I will make the change and report back here, however, since this has been occasional and intermittent it may need at least few days of testing.
Should I also uncheck "Use Live Positions" as per your explanation in the previous post?
Should I also uncheck "Use Live Positions" as per your explanation in the previous post?
You've got me at a disadvantage because I can't see what you programmed to trigger the exit or even what enables the exit logic.
I'd be interested to know if it worked properly with Use Live Positions. The first trade should, but after that I have my doubts.
I'd be interested to know if it worked properly with Use Live Positions. The first trade should, but after that I have my doubts.
I ran a quick test today and actually think it will work with Live Positions. I don't recommended the way you're doing it, but as long as the two Strategies synchronize correctly (specialized code may be required for that), the "sell side" strategy should pick up a position that appears in the account - even if it was created from another strategy or as a discretionary trade.
Your Response
Post
Edit Post
Login is required