SPX iron fly strategy

vasiche

New member
Hello, I am looking for some help here but please let me know if this is not the right place or if this kind of help may be not available. I understand everybody has lots of other things to do, but would appreciate any help with this (even if just pointing me somewhere so I can learn how to do this myself; I've done coding in the past but never in thinkorswim).

I would like to back test a - what seems to be - pretty simple strategy in Thinkorswim. I know one can utilize strategies to do (back)testing on charts and generate a report so that's what I hope for: to use a strategy to backtest this approach to see what the profit/loss would be over 4-6 months back.

The strategy is based on trading SPX options and looks like this:

  • On days of SPX expirations (so Mondays, Wednesdays and Fridays, and if possible excluding holidays but not critical if it's too much coding to exclude them), sell to open an iron fly with the same expiration date at 10 AM.
  • The iron fly should be something like (SPX strikes based on 6/28/21): for example, sell one put and one call at the 4280 strike, buy one put at the 4275 strike and buy one call at the 4285 strike. For the strategy automation, the strike for short put and call should be set to the nearest strike relative to SPX price at that time (for example, if at 10 AM SPX = 4256, the nearest strike would be 4255). The long put and call should be set at -/+5 from the short strike, respectively.
  • Buy to close the iron fly at 3 PM at the market price.

Thank you for any input and/or help.
 
Last edited:
@vasiche Unfortunately, your Strategy would be difficult to impossible to automate due to the limited Date/Time and Option Chain lookup capabilities of Thinkscript... I wouldn't even begin to attempt to automate such a task as I could produce results manually and more accurately in far less time... Sometimes we have to pick our battles wisely... But perhaps someone else will feel up to helping achieve this - but don't hold your breath...
 
Both OnDemand and PaperTrading are very inaccurate/unreliable/incapable in regards to backtesting... Our choices are using a Strategy or manual calculation... But, beyond all that, it is the lack of available functions that is the root of the problem in relation to your description... Do feel free to work at it but be prepared for a lot of coding in an effort to accomplish very little compared to other languages... It is for that reason that I do complex backtesting manually or, even better, in realtime... Remember, the use of AddOrder() can only process after the close of a bar whereas realtime can use every price change... Therein lies the major flaw in Strategies...
 
Hello, I am looking for some help here but please let me know if this is not the right place or if this kind of help may be not available. I understand everybody has lots of other things to do, but would appreciate any help with this (even if just pointing me somewhere so I can learn how to do this myself; I've done coding in the past but never in thinkorswim).

I would like to back test a - what seems to be - pretty simple strategy in Thinkorswim. I know one can utilize strategies to do (back)testing on charts and generate a report so that's what I hope for: to use a strategy to backtest this approach to see what the profit/loss would be over 4-6 months back.

The strategy is based on trading SPX options and looks like this:

  • On days of SPX expirations (so Mondays, Wednesdays and Fridays, and if possible excluding holidays but not critical if it's too much coding to exclude them), sell to open an iron fly with the same expiration date at 10 AM.
  • The iron fly should be something like (SPX strikes based on 6/28/21): for example, sell one put and one call at the 4280 strike, buy one put at the 4275 strike and buy one call at the 4285 strike. For the strategy automation, the strike for short put and call should be set to the nearest strike relative to SPX price at that time (for example, if at 10 AM SPX = 4256, the nearest strike would be 4255). The long put and call should be set at -/+5 from the short strike, respectively.
  • Buy to close the iron fly at 3 PM at the market price.

Looks like a very tight spread.
Thank you for any input and/or help.
 
Both OnDemand and PaperTrading are very inaccurate/unreliable/incapable in regards to backtesting... Our choices are using a Strategy or manual calculation... But, beyond all that, it is the lack of available functions that is the root of the problem in relation to your description... Do feel free to work at it but be prepared for a lot of coding in an effort to accomplish very little compared to other languages... It is for that reason that I do complex backtesting manually or, even better, in realtime... Remember, the use of AddOrder() can only process after the close of a bar whereas realtime can use every price change... Therein lies the major flaw in Strategies...
Thanks, appreciate this input, @rad14733 . It looks like custom scripts may be easier, but will likely require SPX options data as well. I may stick to OnDemand for my immediate needs.
 
Thanks, appreciate this input, @rad14733 . It looks like custom scripts may be easier, but will likely require SPX options data as well. I may stick to OnDemand for my immediate needs.

Sure, OnDemand is fine for manual backtesting and should perform fairly close to monitoring realtime trades... The inaccuracy part comes in when trying to use Strategies or Active Trader... Good luck...
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
336 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top