If else block

36 views
Skip to first unread message

T Lin

unread,
Nov 2, 2022, 11:40:28 PM11/2/22
to OptionStack
Hello,
I have a basic question, how can I put an if else block in When block. I would like to set strike variable to two different value based on condition. 
If condition 1, set strike variable to AtTheMoney,
Else if condition 2, set strike variable to "assigned PutVertical Higher Strike"

Here is the link.
Thank you!
T Lin

OptionStack

unread,
Nov 3, 2022, 12:00:10 AM11/3/22
to OptionStack
Under the Advanced Options of the WHEN block, you can enable the "ELSE" option (i.e. If-Else)  You can enable the Advanced Options by clicking on the "Gear Icon" of the WHEN block.

IF_ELSE.png

You can then set the StrikeVariable as the PriceClose WHEN condition 1 is triggered (i.e. At The Money), ELSE set the StrikeVariable to the strikePrice of the selected put.


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.

T Lin

unread,
Nov 4, 2022, 6:57:51 PM11/4/22
to OptionStack
Thank you very much! 
Reply all
Reply to author
Forward
0 new messages