Option Straddle based on Moving Average


2019 Donor
open and close between avgexp. i meant high and low between avgexp. straddles on a daily time frame in a column if ema 200 is between the high and low of a daily bar than by a straddle 30-45 days out

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

Here is a script that plots an arrow when EMA crosses between High and Low of the day.
Is this what you are looking for?


input duration = 200;
def lo = low;
def hi = high;
def cl = close;

def _EMA = MovingAverage(AverageType.EXPONENTIAL, cl, duration);

def emabetween = if (_EMA <= hi and _EMA >= lo) then 1 else 0;

plot EmaBetweenHighLow = emabetween;

plot EMA = _EMA;
2 General Questions:
  1. Is it possible to show the above indicator Only ONCE and Only if it occurred in the last 5 days? Avoid noise and ignore older signals
  2. How do I make this indicator to show only on daily aggregation chart? Noisy in 5 min charts
Thanks in advance
Couldn't sleep until I figure this out, but I finally got it working the way I want it.
In this modified script, you can specify LookbackDays (number of days to look back) for this condition.
Basically if the condition occurred too long ago, then it won't show it.
If you want to see all past indicators, you can specify 0 for LookbackDays

Note: TOS indicates that this might cause performance issues. If you see any sluggishness, use the previous version.

#LookbackDays = 0 will show all past indicators, or specify number of days to look back

declare hide_on_intraday;

input Duration = 200;
input LookbackDays = 0;
def lo = low;
def hi = high;
def cl = close;

def _EMA = MovingAverage(AverageType.EXPONENTIAL, cl, Duration);
def NumberOfBars = HighestAll(if !IsNaN(close) then BarNumber() else Double.NEGATIVE_INFINITY);

def emabetween = if ( (LookbackDays <= 0 or BarNumber() > NumberOfBars-LookbackDays ) AND (_EMA <= hi and _EMA >= lo) ) then 1 else 0;

plot EmaBetweenHighLow = emabetween;

plot EMA = _EMA;

Here it is. You can add this to a Custom Column script.
It shows "A" if the EMA crossed between high and low in the last 5 days.

def _EMA = MovingAverage(AverageType.EXPONENTIAL, close, 200);

def emabetween = if ( (_EMA[0] <= high[0] and _EMA[0] >= low[0]) or (_EMA[1] <= high[1] and _EMA[1] >= low[1]) or (_EMA[2] <= high[2] and _EMA[2] >= low[2]) or (_EMA[3] <= high[3] and _EMA[3] >= low[3]) or (_EMA[4] <= high[4] and _EMA[4] >= low[4]) ) then 1 else 0;

AddLabel(emabetween, "A", Color.DARK_RED);
AddLabel(!emabetween, " ");
Last edited:
If you are adding the signal column, probably it would be good to know the approximate straddle cost as well.
You can add this column which approximate theoretical cost of a straddle that is 45 days out.

#Approximate theoretical cost of Straddle 45 days out
2 * (0.4 * ImpVolatility() * Sqrt (45/365)) * close
Please let me know how this indicator works for you.

I usually buy 45 day straddle when I see a stock is moving in a tight channel and expecting a catalyst or a surprise in the next 45 days. I will try this as well.
How do you manage to buy when it is high volatility as the premium decay will be fast on both CALL and put . Do you but ITM OR OTM OR any specific delta value options consider buying . What is the expected return such as 300% to 500% of return expected?

With similar idea I want to generate 500-800% but did not see any such combination for options
My approach is not that sophisticated, so take it with a grain of salt.
If a stock moved down to 200 MA and holding there, I see it as buyers and sellers are in equilibrium. On of that if there is another catalyst is in the wings, then the big move is imminent. It doesn't always work out like that. Also, some stocks by nature operate in a channel for long periods of time, I ignore them.

Also, you are right about high volatility, At the money could be expensive. I try to use FIBs to guess how it might move and buy something in that range with in my risk profile.

I don't look for 300% to 500%, instead I look for a quick 50% gain on total premium paid.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
352 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.