New position after rolling

42 views
Skip to first unread message

T Lin

unread,
Nov 4, 2022, 7:11:42 PM11/4/22
to OptionStack
Hello,
I am testing a strategy while I sell a put vertical. When a condition is met, the vertical will be rolled. But before the rolling position closed, I don't want any new put vertical open. How can I do this?
Below is the link and with this code, new position opens before rolling vertical is closed.


Thank you!
T Lin

OptionStack

unread,
Nov 4, 2022, 7:29:43 PM11/4/22
to OptionStack
If you want to prevent any new positions from being entered while a "rolled position" is still open, you can use the netOpenPositions method to check if there are any rolled positions open, and only enter a trade if no positions are open.

In your example, only trade Put Vertical WHEN:
  •  VIX is between 25 - 32 AND
  • netOpenPositions (Rolled Position) equals zero

checkOpenRolledPositions.png




The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory or other services by OptionStack. In addition, the content of the website offers no opinion with respect to the suitability of any security or any specific investment.  There are no guarantees as to accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. Past performance is no indication or guarantee of future results. All investments involve risk – including loss of principal. You should consult with an investment professional before making any investment decisions.
Reply all
Reply to author
Forward
0 new messages