Kapoor - MSM Jackpot Setup
Kapoor - MSM Jackpot Setup
//
===================================================================================
===================================================================
// ATM
//
===================================================================================
===================================================================
strikeDiff = 50
// index = "NIFTY"
prefix = "NIFTY"
if syminfo.ticker == "NIFTY"
strikeDiff := 50
prefix := "NIFTY"
if syminfo.ticker == "BANKNIFTY"
prefix := "BANKNIFTY"
strikeDiff := 100
if syminfo.ticker == "CNXFINANCE"
prefix := "FINNIFTY"
strikeDiff := 50
if syminfo.ticker == "MIDCPNIFTY"
prefix := "MIDCPNIFTY"
strikeDiff := 25
string putSymbol = na
string callSymbol = na
float callPrice = na
float putPrice = na
if syminfo.ticker == "NIFTY"
strikeDiff := 50
prefix := "NIFTY"
if syminfo.ticker == "BANKNIFTY"
prefix := "BANKNIFTY"
strikeDiff := 100
if syminfo.ticker == "CNXFINANCE"
prefix := "FINNIFTY"
strikeDiff := 50
if syminfo.ticker == "MIDCPNIFTY"
prefix := "MIDCPNIFTY"
strikeDiff := 25
AUTO = "Auto"
DAILY = "Daily"
WEEKLY = "Weekly"
MONTHLY = "Monthly"
QUARTERLY = "Quarterly"
YEARLY = "Yearly"
BIYEARLY = "Biyearly"
TRIYEARLY = "Triyearly"
QUINQUENNIALLY = "Quinquennially"
DECENNIALLY = "Decennially"
TRADITIONAL = "Traditional"
FIBONACCI = "Fibonacci"
WOODIE = "Woodie"
CLASSIC = "Classic"
DM = "DM"
CAMARILLA = "Camarilla"
get_pivot_resolution() =>
resolution = "M"
if pivot_time_frame == AUTO
if timeframe.isintraday
resolution := timeframe.multiplier <= 15 ? "D" : "W"
else if timeframe.isweekly or timeframe.ismonthly
resolution := "12M"
else if pivot_time_frame == DAILY
resolution := "D"
else if pivot_time_frame == WEEKLY
resolution := "W"
else if pivot_time_frame == MONTHLY
resolution := "M"
else if pivot_time_frame == QUARTERLY
resolution := "3M"
else if pivot_time_frame == YEARLY or pivot_time_frame == BIYEARLY or
pivot_time_frame == TRIYEARLY or pivot_time_frame == QUINQUENNIALLY or
pivot_time_frame == DECENNIALLY
resolution := "12M"
resolution
camarilla() =>
pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3
pivot_range = pivotX_prev_high - pivotX_prev_low
array.push(p, pivotX_Median)
array.push(r1, pivotX_prev_close + pivot_range * 1.1 / 12.0)
array.push(s1, pivotX_prev_close - pivot_range * 1.1 / 12.0)
array.push(r2, pivotX_prev_close + pivot_range * 1.1 / 6.0)
array.push(s2, pivotX_prev_close - pivot_range * 1.1 / 6.0)
array.push(r3, pivotX_prev_close + pivot_range * 1.1 / 4.0)
array.push(s3, pivotX_prev_close - pivot_range * 1.1 / 4.0)
array.push(r4, pivotX_prev_close + pivot_range * 1.1 / 2.0)
array.push(s4, pivotX_prev_close - pivot_range * 1.1 / 2.0)
r5_val = pivotX_prev_high / pivotX_prev_low * pivotX_prev_close
array.push(r5, r5_val)
array.push(s5, 2 * pivotX_prev_close - r5_val)
calc_pivot() =>
if kind == CAMARILLA
camarilla()
resolution = get_pivot_resolution()
SIMPLE_DIVISOR = -1
custom_years_divisor = switch pivot_time_frame
BIYEARLY => 2
TRIYEARLY => 3
QUINQUENNIALLY => 5
DECENNIALLY => 10
=> SIMPLE_DIVISOR
calc_OHLC_for_pivot(custom_years_divisor) =>
if custom_years_divisor == SIMPLE_DIVISOR
[open, high, low, close, open[1], high[1], low[1], close[1], time[1],
time_close]
else
var prev_sec_open = float(na)
var prev_sec_high = float(na)
var prev_sec_low = float(na)
var prev_sec_close = float(na)
var prev_sec_time = int(na)
var curr_sec_open = float(na)
var curr_sec_high = float(na)
var curr_sec_low = float(na)
var curr_sec_close = float(na)
if year(time_close) % custom_years_divisor == 0
curr_sec_open := open
curr_sec_high := high
curr_sec_low := low
curr_sec_close := close
prev_sec_high := high[1]
prev_sec_low := low[1]
prev_sec_close := close[1]
prev_sec_time := time[1]
for i = 2 to custom_years_divisor
prev_sec_open := nz(open[i], prev_sec_open)
prev_sec_high := calc_high(prev_sec_high, high[i])
prev_sec_low := calc_low(prev_sec_low, low[i])
prev_sec_time := nz(time[i], prev_sec_time)
[curr_sec_open, curr_sec_high, curr_sec_low, curr_sec_close, prev_sec_open,
prev_sec_high, prev_sec_low, prev_sec_close, prev_sec_time, time_close]
if is_last_premarket
was_last_premarket := true
start_calculate_in_premarket := true
if session.ismarket
was_last_premarket := false
if is_daily_based
if is_last_premarket
pivotX_prev_open := sec_open
pivotX_prev_high := sec_high
pivotX_prev_low := sec_low
pivotX_prev_close := sec_close
pivotX_open := open
pivotX_high := high
pivotX_low := low
else
pivotX_prev_open := prev_sec_open
pivotX_prev_high := prev_sec_high
pivotX_prev_low := prev_sec_low
pivotX_prev_close := prev_sec_close
pivotX_open := sec_open
pivotX_high := sec_high
pivotX_low := sec_low
else
pivotX_prev_high := pivotX_high
pivotX_prev_low := pivotX_low
pivotX_prev_open := pivotX_open
pivotX_prev_close := close[1]
pivotX_open := open
pivotX_high := high
pivotX_low := low
calc_pivot()
for i = 0 to array.size(lines) - 1
if array.size(lines) > 0
line.delete(array.shift(lines))
if array.size(labels) > 0
label.delete(array.shift(labels))
for i = 0 to array.size(arr_time) - 2
if array.size(p) > 0 and p_show
draw_line(i, p, p_color)
draw_label(i, array.get(p, i), "P", p_color)
if array.size(r1) > 0 and r1_show
draw_line(i, r1, r1_color)
draw_label(i, array.get(r1, i), "Resistance1", r1_color)
if array.size(s1) > 0 and s1_show
draw_line(i, s1, s1_color)
draw_label(i, array.get(s1, i), "S1", s1_color)
if array.size(r2) > 0 and r2_show
draw_line(i, r2, r2_color)
draw_label(i, array.get(r2, i), "R2", r2_color)
if array.size(s2) > 0 and s2_show
draw_line(i, s2, s2_color)
draw_label(i, array.get(s2, i), "S2", s2_color)
if array.size(r3) > 0 and r3_show
draw_line(i, r3, r3_color)
draw_label(i, array.get(r3, i), "Resistance 1", r3_color)
if array.size(s3) > 0 and s3_show
draw_line(i, s3, s3_color)
draw_label(i, array.get(s3, i), "Support 1", s3_color)
if array.size(r4) > 0 and r4_show
draw_line(i, r4, r4_color)
draw_label(i, array.get(r4, i), "R4", r4_color)
if array.size(s4) > 0 and s4_show
draw_line(i, s4, s4_color)
draw_label(i, array.get(s4, i), "S4", s4_color)
if array.size(r5) > 0 and r5_show
draw_line(i, r5, r5_color)
draw_label(i, array.get(r5, i), "Resistance 2", r5_color)
if array.size(s5) > 0 and s5_show
draw_line(i, s5, s5_color)
draw_label(i, array.get(s5, i),"Support 2",s5_color)
///////////////////////////////////////////////////////////////// Menu
///////////////////////////////////////////////////////////////// OHLC
///////////////////////////////////////////////////////////////// ADR
adr_func(length, high_low) =>
float result = 0
float adr = 0
if high_low
result := day_open + adr/2 * i_adr_mult //High
else
result := day_open - adr/2 * i_adr_mult //Low
if high_low
result := day_open + adr/2 * i_target_mult //High
else
result := day_open - adr/2 * i_target_mult //Low
///////////////////////////////////////////////////////////////// Menu
///////////////////////////////////////////////////////////////// OHLC
if high_low_D
result_D := D_open + adr_D/2 //High
else
result_D := D_open - adr_D/2 //Low
// Day Formula
r_1_adr_D = adr_func_D(i_length, true)
s_1_adr_D = adr_func_D(i_length, false)
if high_low_W
result_W := W_open + adr_W/2 //High
else
result_W := W_open - adr_W/2 //Low
// Week Formula
r_1_adr_W = adr_func_W(i_length, true)
s_1_adr_W = adr_func_W(i_length, false)
if high_low_M
result_M := M_open + adr_M/2 //High
else
result_M := M_open - adr_M/2 //Low
// Month Formula
r_1_adr_M = adr_func_M(i_length, true)
s_1_adr_M = adr_func_M(i_length, false)
///////////////////////////////////////////////////////////////// Color
///////////////////////////////////////////////////////////////// Labels
///////////////////////////////////////////////////////////////// END
// condition_b =
arrays(a) =>
low < a and high > a ? true : false
// Candlestick Patterns
// find_(bool_) =>
// var float highh = 100000
// bool result = false
// if bool_
// highh := high
// if ta.crossover(close , highh)
// highh := 100000
// result := true
find_(bool_) =>
var float highh = 100000
bool result = false
a_ = ta.barssince(bool_) == 4
if bool_
highh := high
if a_
highh := 100000
if ta.crossover(close , highh)
highh := 100000
result := true
find_s(bool_ ) =>
var float loww = 0.0
bool result = false
a_2 = ta.barssince(bool_) == 4
if bool_
loww := low
if a_2
loww := 0.0
if ta.crossunder(close , loww)
loww := 0.0
result := true
////////////
njndd = input.bool(true , "on/ off strong buy strong sell")
dataHammer = high - low > 3 * (open - close) and (close - low) / (.001 + high -
low) > 0.6 and (open - low) / (.001 + high - low) > 0.6 and bull and adr_test and
njndd
// plotshape(find_(dataHammer) , title='Hammer', location=location.belowbar,
color=color.rgb(15, 135, 182), style=shape.triangleup, text='strong BUY ',
textcolor=color.new(color.green, 0))
// plotshape((dataHammer) , title='Hammer', location=location.belowbar,
color=color.rgb(15, 135, 182), style=shape.triangleup, text='strong BUY above',
textcolor=color.new(color.green, 0))
dataInvertedHammer = high - low > 3 * (open - close) and (high - close) / (.001 +
high - low) > 0.6 and (high - open) / (.001 + high - low) > 0.6 and
bearishCondition and adr_test and njndd
// plotshape(find_s(dataInvertedHammer), title='Inverted Hammer',
location=location.abovebar, color=color.rgb(219, 17, 17), style=shape.triangledown,
text='strong Alert', textcolor=color.new(color.red, 0))
// plotshape((dataInvertedHammer), title='Inverted Hammer',
location=location.belowbar, color=color.rgb(219, 17, 17), style=shape.triangledown,
text='strong Alert Below', textcolor=color.new(color.red, 0))
dataBearishHarami = bearishCondition and close[1] > open[1] and open > close and
open <= close[1] and open[1] <= close and open - close < close[1] - open[1] and
high < high[1] and low > low[1] and adr_test and njndd
// plotshape(find_s(dataBearishHarami), title='Bearish Harami',
location=location.abovebar, color=color.new(color.red, 0),
style=shape.triangledown, text='strong Alert ', textcolor=color.new(color.red, 0))
// plotshape((dataBearishHarami), title='Bearish Harami',
location=location.abovebar, color=color.new(color.red, 0),
style=shape.triangledown, text='strong Alert Below', textcolor=color.new(color.red,
0))
dataBullishHarami = open[1] > close[1] and close > open and close <= open[1] and
close[1] <= open and close - open < open[1] - close[1] and high < high[1] and low
> low[1] and bull and adr_test and njndd
// plotshape( dataBullishHarami , title='Bullish Harami',
location=location.belowbar, color=color.rgb(3, 114, 60), style=shape.triangleup,
text='strong BUY ', textcolor=color.new(color.green, 0))
// plotshape(find_(dataBullishHarami) , title='Bullish Harami',
location=location.belowbar, color=color.rgb(3, 114, 60), style=shape.triangleup,
text='strong BUY ', textcolor=color.new(color.green, 0))
dataBearishEngulfing = bearishCondition and close[1] > open[1] and open > close and
open >= close[1] and open[1] >= close and open - close > close[1] - open[1] and
high > high[1] and low < low[1] and adr_test and njndd
// plotshape(find_s(dataBearishEngulfing), title='Bearish Engulfing',
location=location.abovebar, color=color.new(color.red, 0),
style=shape.triangledown, text='strong Alert', textcolor=color.new(color.red, 0))
// plotshape((dataBearishEngulfing), title='Bearish Engulfing',
location=location.abovebar, color=color.new(color.red, 0),
style=shape.triangledown, text='strong Alert Below', textcolor=color.new(color.red,
0))
dataBullishEngulfing = open[1] > close[1] and close > open and close >= open[1] and
close[1] >= open and close - open > open[1] - close[1] and high > high[1] and low
< low[1] and bull and adr_test and njndd
// plotshape( dataBullishEngulfing , title='Bullish Engulfing',
location=location.belowbar, color=color.rgb(6, 136, 73), style=shape.triangleup,
text='strong BUY ', textcolor=color.new(color.green, 0))
// plotshape(find_(dataBullishEngulfing) , title='Bullish Engulfing',
location=location.belowbar, color=color.rgb(6, 136, 73), style=shape.triangleup,
text='strong BUY ', textcolor=color.new(color.green, 0))
dataHammer_x = high - low > 3 * (open - close) and (close - low) / (.001 + high -
low) > 0.6 and (open - low) / (.001 + high - low) > 0.6 and bull and njnd
plotshape(find_(dataHammer_x) , title='Hammer', location=location.belowbar,
color=color.rgb(15, 135, 182), style=shape.triangleup, text='Alert ',
textcolor=color.new(color.green, 0))
dataInvertedHammer_x = high - low > 3 * (open - close) and (high - close) / (.001
+ high - low) > 0.6 and (high - open) / (.001 + high - low) > 0.6 and
bearishCondition and njnd
plotshape(find_s(dataInvertedHammer_x) , title='Inverted Hammer',
location=location.abovebar, color=color.rgb(219, 17, 17), style=shape.triangledown,
text='Alert ', textcolor=color.new(color.red, 0))
dataBearishHarami_x = bearishCondition and close[1] > open[1] and open > close and
open <= close[1] and open[1] <= close and open - close < close[1] - open[1] and
njnd and high < high[1] and low > low[1]
plotshape(find_s(dataBearishHarami_x) , title='Bearish Harami',
location=location.abovebar, color=color.new(color.red, 0),
style=shape.triangledown, text='Alert ', textcolor=color.new(color.red, 0))
dataBullishHarami_x = open[1] > close[1] and close > open and close <= open[1] and
close[1] <= open and close - open < open[1] - close[1] and bull and njnd and high
< high[1] and low > low[1]
plotshape(find_(dataBullishHarami_x) , title='Bullish Harami',
location=location.belowbar, color=color.rgb(3, 114, 60), style=shape.triangleup,
text='Alert ', textcolor=color.new(color.green, 0))
dataBearishEngulfing_x = bearishCondition and close[1] > open[1] and open > close
and open >= close[1] and open[1] >= close and open - close > close[1] - open[1] and
njnd and high > high[1] and low < low[1]
plotshape(find_s(dataBearishEngulfing_x) , title='Bearish Engulfing',
location=location.abovebar, color=color.new(color.red, 0),
style=shape.triangledown, text='Alert', textcolor=color.new(color.red, 0))
dataBullishEngulfing_x = open[1] > close[1] and close > open and close >= open[1]
and close[1] >= open and close - open > open[1] - close[1] and bull and njnd and
high > high[1] and low < low[1]
plotshape(find_(dataBullishEngulfing_x) , title='Bullish Engulfing',
location=location.belowbar, color=color.rgb(6, 136, 73), style=shape.triangleup,
text='Alert', textcolor=color.new(color.green, 0))
bullishHaramiCond = find_(dataBullishHarami_x)
bullisEngulfingCond = find_(dataBullishEngulfing_x)
bullishHammerCond = find_(dataHammer_x)
bullishHammerCond2 = find_(dataHammer)
bearishHaramiCond = find_s(dataBearishHarami_x)
bearisEngulfingCond = find_s(dataBearishEngulfing_x)
bearishHammerCond = find_s(dataInvertedHammer_x)
bearishInvertedHammerCond = find_s(dataInvertedHammer)
bearishHaramiCond2 = find_s(dataBearishHarami)
bearisEngulfingCond2 = find_s(dataBearishEngulfing)
if bearishHammerCond or bearishHaramiCond or bearisEngulfingCond or
bearishInvertedHammerCond or bearishHaramiCond2 or bearisEngulfingCond2
// label.new(bar_index, high, "", color = color.blue)
label.new(bar_index, high, putSymbol + "\n" + str.tostring(putPrice),style =
label.style_label_down, color = color.orange, textcolor = color.white)