Internet Name
Member
Is it possible to have a strategy buy and sell an ATM option rather than shares of stock? I couldn't find anything in the documentation.
Wondering if it's possible to program the strategy feature to buy an ATM option to and backtest its performance rather than just simply 1 share of stock. I'm aware that something similar can be done under the thinkback feature, but I don't believe you can program strategies in the thinkback feature.
Edit: When I say strategy, I mean the strategy feature inside the studies tab where you backtest things. Not just a general strategy.
Ruby:# test_option_strategy_0 #https://usethinkscript.com/threads/zigzag-high-low-with-supply-demand-zones-for-thinkorswim.172/#post-7048 # robert # define swing high and low points input length = 10; def bn = BarNumber(); def lastBar = HighestAll(if IsNaN(close) then 0 else bn); def offset = Min(length - 1, lastBar - bn); def swingLo = low < Lowest(low[1], length - 1) and low == GetValue(Lowest(low, length), -offset); def swinghi = high > highest(high[1], length - 1) and high == GetValue(highest( high, length), -offset); input verify_signals = no; addverticalline(verify_signals and swinglo, "low", color.red); addverticalline(verify_signals and swinghi, "hi", color.green); def buy = swinglo; def sell = swinghi; input order_size = 1; addOrder(OrderType.BUY_TO_OPEN, buy, open[-1], order_size, color.green, color.green, "buy"); addOrder(OrderType.SELL_TO_CLOSE, sell, open[-1], order_size, color.red, color.red, "sell"); # AddOrder ( int type, IDataHolder condition, IDataHolder price, IDataHolder tradeSize, CustomColor tickColor, CustomColor arrowColor, String name); # #
Michalg are there share links for these studies? I would like to try the upper and lower studies if possible?Buy call on the 1 min when 5 min 9 & 3 SMA crosses. Sell on exhaustion.
http://tos.mx/NLMLRwoMichalg are there share links for these studies? I would like to try the upper and lower studies if possible?
Thank you!
Curious what your slope degree is.Thanks Halcy. I found a workaround that works good enough for what I'm trying to do.
- I went to Trade -> All Products (it could probably also be done under the Analyze tab).
- On the Trade grid, I turned on 2 columns and as many rows as possible. Then shrunk all the bottom grids and expanded the top 2 as tall as they could go.
- On the right grid, I have the stock with the strategy I want to look at.
- Then on the left grid, I can enter in whichever option I want to look at. The option chain doesn't have any past expiration dates, but you can still pull up past expirations as long as you enter the long form option string name in the ticker box. I have a separate strategy on the option chart where I can just tell it what date and time to buy and sell, and it will tell me what the profit/loss would've been.
So all I have to do is just figure out when the strategy wanted to buy and sell the ATM option, and then manually input it into the option grid on the left. I can give the codes I'm using if anyone is interested.
It's not going to answer a question like "what is my profit if I buy an ATM call option when the price goes above premarket high over a 90 day period", but it does a pretty good job at isolated day trades. The only issue I'm seeing so far is that the Bid/Ask data is a bit spotty. But the midpoint price still works.
Does this help? https://usethinkscript.com/threads/...the-money-option-in-strategy.9180/#post-84758How to get the ATM call price for the previous week open ? and will it extract the previous week date automatically, or there is no other way than manually type it -every week- ?
Curious what your slope degree is.
hello, Does this work for longer times ?for example on swing trade timeframehttp://tos.mx/NLMLRwo
Make sure you update the right hand chart to the call/Put you want.
Buy call on the 2 min when 5 min 9 & 3 SMA crosses. Sell on exhaustion.
Yeah just play around with it. Make sure the timeframes go together thoughhello, Does this work for longer times ?for example on swing trade timeframe
like Daily & 4hrs on the split ?Yeah just play around with it. Make sure the timeframes go together though
There would be less entries on Daily.. But yeah any timeframe!like Daily & 4hrs on the split ?
Great! been playing around with it just to make sure I have it correct, you didn’t add the 3&9 sma’s in your link unless I missed somethinglike Daily & 4hrs on the split ?
Sorry! You should prepare for an entry short or long depending on whether they cross. I added the SMA below.Great! been playing around with it just to make sure I have it correct, you didn’t add the 3&9 sma’s in your link unless I missed something
Thanks for all you have shared here so far. What in your plan of action when the non-colored (black) bars appear?Sorry! You should prepare for an entry short or long depending on whether they cross. I added the SMA below.
http://tos.mx/bgpa3LB
Happy to help! Black means neutral so you should anticipate a trend change to either the up or downside. On my chart it’s supposed to be yellow not black though.Thanks for all you have shared here so far. What in your plan of action when the non-colored (black) bars appear?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
E | Stock price on an options chart. | Questions | 2 | |
G | Strategy for PnL with Options | Questions | 1 | |
F | Options gamma not working now | Questions | 0 | |
Day Trading 0DTE SPX Options | Questions | 1 | ||
D | Custom script not executing intraday options trade | Questions | 2 |
Start a new thread and receive assistance from our community.
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.
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.