Will this work for Option Traders?

Adeodatus

Member
Over the spring, I've been coding a use volume and implied vol. indicator (adjustable, start at .50) to paste a buy bubble and an exit.
Its super-fast and will only be visible on optionable stocks. Because of that, I'm not 100% sure the extended hours call is valid.

Code:
# Inputs
input bubbleoffset = 3; # Offset for chart bubbles (in ticks)
input maxIV = 0.5; # Maximum implied volatility threshold for buy signals (e.g., 50%)
input price = close; # Price for moving averages
input superfast_length = 9; # Length for fastest MA
input fast_length = 14; # Length for intermediate MA
input slow_length = 21; # Length for slowest MA
input displace = 0; # Displacement for MAs

# Volume Calculations
def buyvol = Round(((high - open) + (close - low)) / 2 / (high - low) * volume(), 0);
def sellvol = Round(((low - open) + (close - high)) / 2 / (high - low) * volume(), 0);
def buyvolper = buyvol / volume() * 100;
def sellvolper = AbsValue(sellvol) / volume() * 100;

# Moving Average Calculations
def mov_avg9 = ExpAverage(price[-displace], superfast_length);
def mov_avg14 = ExpAverage(price[-displace], fast_length);
def mov_avg21 = ExpAverage(price[-displace], slow_length);

# Moving Average Aliases
def Superfast = mov_avg9;
def Fast = mov_avg14;
def Slow = mov_avg21;

# Buy and Close Buy Signals with Implied Volatility Filter
def buy = mov_avg9 > mov_avg14 and mov_avg14 > mov_avg21 and low > mov_avg9 and Imp_Volatility() < maxIV;
def stopbuy = mov_avg9 <= mov_avg14 or Imp_Volatility() >= maxIV;
def buynow = !buy[1] and buy;
def buysignal = CompoundValue(1, if buynow and !stopbuy then 1 else if buysignal[1] == 1 and stopbuy then 0 else buysignal[1], 0);
def Buy_Signal = buysignal[1] == 0 and buysignal == 1;
def Close_Buy = buysignal[1] == 1 and buysignal == 0;

# Bar Identification for Volume Bubbles
def last = !IsNaN(close) and IsNaN(close[-1]);
def prev = !IsNaN(close[1]) and IsNaN(close[-2]);

# Chart Bubbles
# Buying Volume Bubble (Green)
AddChartBubble(last or prev,
if last then high + TickSize() * bubbleoffset else low - TickSize() * bubbleoffset,
"BuyVol: " + buyvol,
Color.GREEN,
if last then yes else no);

# Buy Signal Bubble (Cyan)
AddChartBubble(Buy_Signal,
low - TickSize() * bubbleoffset,
"BUY: " + low + "\nIV: " + Round(Imp_Volatility() * 100, 2) + "%",
Color.CYAN,
no);

# Close Buy Signal Bubble (Red)
AddChartBubble(Close_Buy,
high + TickSize() * bubbleoffset,
"Close Buy: " + high + "\nIV: " + Round(Imp_Volatility() * 100, 2) + "%",
Color.RED,
yes);

# Optional Commented-Out Bubbles for Total and Selling Volume
#AddChartBubble(last or prev, if last then high + TickSize() * bubbleoffset else low - TickSize() * bubbleoffset, "TVol: " + volume(), Color.LIGHT_GRAY, if last then yes else no);
#AddChartBubble(last or prev, if last then high + TickSize() * bubbleoffset else low - TickSize() * bubbleoffset, "SellVol: " + AbsValue(sellvol), Color.RED, if last then yes else no);

Any feedback is appreciated ~Adeo
 
Last edited by a moderator:

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
236 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