//@version=5
indicator("Crypto Daily Options Master [FREE]", overlay=true, max_labels_count=50)
// === STRATEGY TOGGLES (Input allows user to turn strategies on/off) ===
show_oi_fade = input.bool(true, "OI Wall Fade Strategy")
show_volume_spike = input.bool(true, "Volume Spike Strategy")
show_gamma_flip = input.bool(true, "Gamma Flip Strategy")
show_iv_crush = input.bool(true, "IV Crush Strategy")
show_correlation = input.bool(true, "BTC/ETH Correlation")
// === RISK MANAGEMENT (Inputs that define risk parameters) ===
capital = input.int(50000, "Capital (₹)", minval=10000, maxval=1000000)
risk_percent = input.float(2.0, "Risk % per Trade", minval=0.5, maxval=5.0)
contract_size = input.int(5, "Contracts per Trade", minval=1, maxval=20)
// === SIMPLE TIME DETECTION (Works if Chart Timezone is IST) ===
current_hour = hour
current_minute = minute
is_morning = current_hour >= 6 and current_hour < 10 // Defines the 6 AM to 10 AM window
is_early_morning = current_hour >= 6 and current_hour < 7
is_late_morning = current_hour >= 9 and current_hour < 10
// === CORE INDICATORS (FREE VERSION) ===
// Volume Analysis
volume_ma = ta.sma(volume, 20) // Calculate 20-period Simple Moving Average of Volume
volume_ratio = volume / volume_ma
volume_spike = volume_ratio > 2.5 // Check if current volume is 2.5x the average
// Volatility Analysis (Using Average True Range - ATR)
atr_period = 14
atr_value = ta.atr(atr_period)
atr_percent = atr_value / close * 100
low_volatility = atr_percent < 1.2
high_volatility = atr_percent > 2.0
// Price Momentum
price_change_5m = (close - close[5]) / close[5] * 100 // Percentage change over 5 bars
price_change_30m = (close - close[30]) / close[30] * 100
is_uptrend = ta.ema(close, 10) > ta.ema(close, 20) // 10 EMA above 20 EMA
is_downtrend = ta.ema(close, 10) < ta.ema(close, 20)
// === CALCULATE ATM STRIKE ===
// Finds the nearest strike price rounded to the nearest 100 (approximation)
current_atm_strike = math.round(close / 100) * 100
// === 1. OI WALL FADE STRATEGY (6-7 AM) ===
// Triggers if strategy is enabled, time is early morning, and volatility is low
if show_oi_fade and is_early_morning and low_volatility
// Calculation for strike prices (5% Out-of-the-Money and a further hedge)
call_strike = math.round(close * 1.05 / 100) * 100
hedge_strike = call_strike + 200
risk_per_trade = capital * risk_percent / 100
position_size = math.min(contract_size, math.floor(risk_per_trade / 800))
// Draw a label on the chart for the signal
label.new(bar_index, high,
"🎯 OI WALL FADE\n" +
"SELL " + str.tostring(call_strike) + " CE\n" +
"BUY " + str.tostring(hedge_strike) + " CE\n" +
"Credit: ~₹600-800\n" +
"Size: " + str.tostring(position_size) + " lots\n" +
"Risk: ₹" + str.tostring(risk_per_trade),
color=color.rgb(200, 50, 50), /* Darker Red for visibility */
style=label.style_label_down,
textcolor=color.white,
size=size.normal)
// Send an alert if the signal occurs on the last bar
if barstate.islast
alert("OI WALL FADE: Sell " + str.tostring(call_strike) + "CE + Buy " +
str.tostring(hedge_strike) + "CE | Credit Spread", alert.freq_once_per_bar_close)
// === 2. VOLUME SPIKE MOMENTUM (6-10 AM) ===
if show_volume_spike and is_morning and volume_spike and price_change_5m > 0.15
risk_per_trade = capital * risk_percent / 100
position_size = math.min(contract_size, math.floor(risk_per_trade / 1200))
label.new(bar_index, low,
"🚀 VOLUME SPIKE\n" +
"BUY " + str.tostring(current_atm_strike) + " CE\n" +
"Volume: " + str.tostring(volume_ratio, "#.##") + "x\n" +
"Target: +80% | Stop: -40%\n" +
"Size: " + str.tostring(position_size) + " lots",
color=color.rgb(0, 150, 0), /* Darker Green for visibility */
style=label.style_label_up,
textcolor=color.white,
size=size.normal)
if barstate.islast
alert("VOLUME SPIKE: BUY " + str.tostring(current_atm_strike) + "CE | Volume: " +
str.tostring(volume_ratio, "#.##") + "x", alert.freq_once_per_bar_close)
// === 3. GAMMA FLIP STRANGLE (8-9 AM) ===
if show_gamma_flip and current_hour >= 8 and current_hour < 9 and low_volatility
call_strike = math.round(close * 1.02 / 100) * 100 // 2% OTM Call
put_strike = math.round(close * 0.98 / 100) * 100 // 2% OTM Put
risk_per_trade = capital * risk_percent / 100
position_size = math.min(contract_size, math.floor(risk_per_trade / 600))
label.new(bar_index, high,
"🔄 GAMMA FLIP\n" +
"SELL " + str.tostring(call_strike) + " CE\n" +
"SELL " + str.tostring(put_strike) + " PE\n" +
"Credit: ₹900-1100\n" +
"Target: 60% | Stop: 200%\n" +
"Size: " + str.tostring(position_size) + " lots",
color=color.rgb(200, 100, 0), /* Darker Orange for visibility */
style=label.style_label_down,
textcolor=color.white,
size=size.normal)
if barstate.islast
alert("GAMMA FLIP: Sell Strangle " + str.tostring(call_strike) + "CE & " +
str.tostring(put_strike) + "PE", alert.freq_once_per_bar_close)
// === 4. IV CRUSH CONDOR (9-10 AM) ===
// Checks if volatility is contracting (ATR is shrinking)
iv_compression = ta.atr(14) < ta.atr(14)[1] and ta.atr(14)[1] < ta.atr(14)[2]
if show_iv_crush and current_hour >= 9 and current_hour < 10 and iv_compression
// Defines the strikes for a short iron condor setup
short_call = math.round(close * 1.03 / 100) * 100
long_call = short_call + 200
short_put = math.round(close * 0.97 / 100) * 100
long_put = short_put - 200
risk_per_trade = capital * risk_percent / 100
position_size = math.min(contract_size, math.floor(risk_per_trade / 400))
label.new(bar_index, high,
"📉 IV CRUSH CONDOR\n" +
"SELL " + str.tostring(short_call) + "C/" + str.tostring(short_put) + "P\n" +
"BUY " + str.tostring(long_call) + "C/" + str.tostring(long_put) + "P\n" +
"Credit: ₹1400-1800\n" +
"Size: " + str.tostring(position_size) + " lots",
color=color.rgb(100, 0, 100), /* Darker Purple for visibility */
style=label.style_label_down,
textcolor=color.white,
size=size.normal)
if barstate.islast
alert("IV CRUSH: Iron Condor " + str.tostring(short_call) + "C-" +
str.tostring(long_call) + "C & " + str.tostring(short_put) + "P-" +
str.tostring(long_put) + "P", alert.freq_once_per_bar_close)
// === 5. SIMPLE CORRELATION (6-10 AM) ===
if show_correlation and is_morning
btc_trend = ta.ema(close, 10) > ta.ema(close, 30)
momentum = ta.rsi(close, 14) > 55
if btc_trend and momentum and price_change_30m > 0.3
risk_per_trade = capital * risk_percent / 100
position_size = math.min(contract_size, math.floor(risk_per_trade / 900))
label.new(bar_index, low,
"📊 TREND MOMENTUM\n" +
"BUY " + str.tostring(current_atm_strike) + " CE\n" +
"RSI: " + str.tostring(ta.rsi(close, 14), "#.##") + "\n" +
"Trend: Strong Up\n" +
"Size: " + str.tostring(position_size) + " lots",
color=color.rgb(0, 50, 150), /* Darker Blue for visibility */
style=label.style_label_up,
textcolor=color.white,
size=size.normal)
if barstate.islast
alert("TREND MOMENTUM: BUY " + str.tostring(current_atm_strike) + "CE | RSI: " +
str.tostring(ta.rsi(close, 14), "#.##"), alert.freq_once_per_bar_close)
// === RISK MANAGEMENT DISPLAY (Table) ===
// Creates a table in the top right corner of the chart
var table risk_table = table.new(position.top_right, 2, 10,
bgcolor=color.rgb(230, 230, 230), /* Very light gray background */
border_width=1,
border_color=color.black)
if barstate.islast
total_risk = capital * risk_percent / 100
daily_risk = total_risk * 2
margin_required = contract_size * 15000 // Approximate margin
// Populates the table with risk metrics (Text color is dark black by default)
table.cell(risk_table, 0, 0, "💰 RISK MANAGER",
bgcolor=color.rgb(255, 223, 0), text_color=color.black)
table.cell(risk_table, 0, 1, "Capital: ₹" + str.tostring(capital), text_color=color.black)
table.cell(risk_table, 0, 2, "Risk/Trade: ₹" + str.tostring(total_risk), text_color=color.black)
table.cell(risk_table, 0, 3, "Daily Risk: ₹" + str.tostring(daily_risk), text_color=color.black)
table.cell(risk_table, 0, 4, "Contracts: " + str.tostring(contract_size), text_color=color.black)
table.cell(risk_table, 0, 5, "Margin: ₹" + str.tostring(margin_required), text_color=color.black)
table.cell(risk_table, 0, 6, "Time: " + str.tostring(current_hour) + ":" +
str.tostring(current_minute), text_color=color.black)
table.cell(risk_table, 0, 7, "Volatility: " + str.tostring(atr_percent, "#.##") + "%", text_color=color.black)
table.cell(risk_table, 0, 8, "Volume: " + str.tostring(volume_ratio, "#.##") + "x", text_color=color.black)
table.cell(risk_table, 0, 9, "Trades Today: 3-4", text_color=color.black)
// === VISUAL MARKERS & INFO LABELS ===
// Plotting shapes to visually confirm where the logic triggers
plotshape(show_oi_fade and is_early_morning and low_volatility, style=shape.triangleup, location=location.abovebar, color=color.red, size=size.small, title="OI Fade Signal")
plotshape(show_volume_spike and volume_spike and price_change_5m > 0.15, style=shape.circle, location=location.belowbar, color=color.green, size=size.small, title="Volume Spike")
plotshape(show_gamma_flip and current_hour >= 8 and current_hour < 9 and low_volatility, style=shape.diamond, location=location.abovebar, color=color.orange, size=size.small, title="Gamma Flip")
plotshape(show_iv_crush and current_hour >= 9 and current_hour < 10 and iv_compression, style=shape.square, location=location.abovebar, color=color.purple, size=size.small, title="IV Crush")
plot(close, "BTC Price", color=color.blue, linewidth=1)
plot(current_atm_strike, "ATM Strike", color=color.gray, linewidth=1, style=plot.style_circles)
if barstate.islast
label.new(bar_index, low * 0.985,
"⏰ NOTE: Set TradingView Timezone to Asia/Calcutta (IST)",
color=color.rgb(200, 200, 200), /* Light Gray background for note */
style=label.style_label_center,
textcolor=color.black, /* Black text */
size=size.normal,
yloc=yloc.belowbar)