0% found this document useful (0 votes)
77 views15 pages

ND

This document defines an indicator script for analyzing stock price data and generating trading signals. It includes inputs for tuning EMA and RSI parameters. It calculates various moving averages, EMA crossovers, and RSI values to determine buy/sell signals. It also calculates daily and weekly pivot points and plots these values along with the signals on the chart for analysis.

Uploaded by

tyson tyson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views15 pages

ND

This document defines an indicator script for analyzing stock price data and generating trading signals. It includes inputs for tuning EMA and RSI parameters. It calculates various moving averages, EMA crossovers, and RSI values to determine buy/sell signals. It also calculates daily and weekly pivot points and plots these values along with the signals on the chart for analysis.

Uploaded by

tyson tyson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 15

//@version=5

indicator("NARENDRA JACKPOT SYSTEM",overlay = true)


//created by @DerrickLaFlame

// Get user input


vwaplength = input(title='VWAP Length', defval=1)
emaSource1 = input(title='EMA 1 Source', defval=close)
emaLength1 = input(title='EMA 1 Length', defval=7)
emaSource2 = input(title='EMA 2 Source', defval=close)
emaLength2 = input(title='EMA 2 Length', defval=25)
rsilimit = input(title='RSI Limit (RISKY)', defval=65)
rsiminimum = input(title='RSI Minimum (WAIT FOR DIP)', defval=51)

/// MVWAP ///


avlength = input(title='MVWAP Length', defval=21)
av = ta.ema(ta.vwap, avlength)
plotav = plot(av, color=color.new(color.fuchsia, 0), title='MVWAP')
mvwap = av

// Get values
ema1 = ta.ema(emaSource1, emaLength1)
ema2 = ta.ema(emaSource2, emaLength2)

/// VWAP ///


cvwap = ta.ema(ta.vwap, vwaplength)
plotvwap = plot(cvwap, color=color.new(color.yellow, 0), title='VWAP', linewidth=3)

Check1 = ema1 >= mvwap


Check2 = ema2 >= mvwap
Check3 = cvwap >= mvwap

Cross = Check1 and Check2


Crossup = Cross and Check3

Buy = Crossup and ta.rsi(close, 14)


Risky = Crossup and ta.rsi(close, 14) > rsilimit
BuyDip = Crossup and ta.rsi(close, 14) < rsiminimum
GoodBuy = Buy and ta.rsi(close, 14) < rsilimit
GreatBuy = GoodBuy and ta.rsi(close, 14) > rsiminimum

//Test
Long = Buy == 1 ? 1 : 0
Short = Buy != 1 ? 1 : 0

Longtrigger = ta.crossover(Long, 0.5)


Shorttrigger = ta.crossover(Short, 0.5)

plotshape(Longtrigger, title='Long Entry', location=location.belowbar,


color=color.new(color.green, 0), style=shape.triangleup, text='Long')
plotshape(Shorttrigger, title='Short Entry', location=location.abovebar,
color=color.new(color.red, 0), style=shape.triangledown, text='Short')

// Plot signals to chart


plotshape(Buy, title='Buy Alert', location=location.belowbar,
color=color.new(color.white, 100), style=shape.triangleup, text='')
plotshape(Risky, title='Risky', location=location.abovebar,
color=color.new(color.red, 100), style=shape.triangledown, text='')
plotshape(BuyDip, title='WAIT', location=location.abovebar,
color=color.new(color.orange, 100), style=shape.triangledown, text='')
plotshape(GreatBuy, title='Enter Here', location=location.belowbar,
color=color.new(color.green, 100), style=shape.triangleup, text='')
plot(ta.ema(emaSource1, emaLength1), color=color.new(color.yellow, 0), linewidth=1,
title='EMA1')
plot(ta.ema(emaSource2, emaLength2), color=color.new(color.orange, 0), linewidth=1,
title='EMA2')

// Alerts
alertcondition(Longtrigger, title='Long Alert', message='Long Alert')
alertcondition(Shorttrigger, title='Short Alert', message='Short Alert')

//Barcolor
barcolor(Long == 1 ? color.green : color.red, title='Bar Color')

// Cloud
displacement_A = 26
displacement_B = 26
conversion_len = 9
base_line_len = 26
senkou_B_len = 51

f(x) =>
total_volume = math.sum(volume, x)
volume_weighted_high = math.sum(high * volume, x) / total_volume
volume_weighted_low = math.sum(low * volume, x) / total_volume
(volume_weighted_high + volume_weighted_low) / 2

conversion_line = f(conversion_len)
base_line = f(base_line_len)
senkou_A = (conversion_line + base_line) / 2
senkou_B = f(senkou_B_len)

disp_d_pivots = input(false, title='Display Daily pivots?')


disp_w_pivots = input(false, title='Display Weekly pivots?')
//disp_m_pivots = input(false, title="Display Monthly pivots?")
disp_d_gann = input(true, title='Display Daily GANN Levels?')
disp_w_gann = input(false, title='Display Weekly GANN Levels?')
//disp_m_gann = input(false, title="Display Monthly GANN Levels?")

gansqr(x) =>
math.round(x * x * 100) / 100
two_dec(x) =>
math.round(x * 100) / 100

//Get previous day/week bar and avoiding realtime calculation by taking the
previous to current bar
popen_d = request.security(syminfo.tickerid, 'D', open[1], barmerge.gaps_off,
barmerge.lookahead_on)
phigh_d = request.security(syminfo.tickerid, 'D', high[1], barmerge.gaps_off,
barmerge.lookahead_on)
plow_d = request.security(syminfo.tickerid, 'D', low[1], barmerge.gaps_off,
barmerge.lookahead_on)
pclose_d = request.security(syminfo.tickerid, 'D', close[1], barmerge.gaps_off,
barmerge.lookahead_on)

popen_w = request.security(syminfo.tickerid, 'W', open[1], barmerge.gaps_off,


barmerge.lookahead_on)
phigh_w = request.security(syminfo.tickerid, 'W', high[1], barmerge.gaps_off,
barmerge.lookahead_on)
plow_w = request.security(syminfo.tickerid, 'W', low[1], barmerge.gaps_off,
barmerge.lookahead_on)
pclose_w = request.security(syminfo.tickerid, 'W', close[1], barmerge.gaps_off,
barmerge.lookahead_on)

//popen_m = security(syminfo.tickerid, "M", open[1], barmerge.gaps_off,


barmerge.lookahead_on)
//phigh_m = security(syminfo.tickerid, "M", high[1], barmerge.gaps_off,
barmerge.lookahead_on)
//plow_m = security(syminfo.tickerid, "M", low[1], barmerge.gaps_off,
barmerge.lookahead_on)
//pclose_m = security(syminfo.tickerid, "M", close[1], barmerge.gaps_off,
barmerge.lookahead_on)

PP_d = 0.0
R1_d = 0.0
R2_d = 0.0
R3_d = 0.0
S1_d = 0.0
S2_d = 0.0
S3_d = 0.0

/// We will be calculating "Fibonacci" Pivots for Intraday trading


PP_d := (phigh_d + plow_d + pclose_d) / 3
R1_d := PP_d + (phigh_d - plow_d) * 0.382
S1_d := PP_d - (phigh_d - plow_d) * 0.382
R2_d := PP_d + (phigh_d - plow_d) * 0.618
S2_d := PP_d - (phigh_d - plow_d) * 0.618
R3_d := PP_d + (phigh_d - plow_d) * 1.000
S3_d := PP_d - (phigh_d - plow_d) * 1.000

PP_d := two_dec(PP_d)
R1_d := two_dec(R1_d)
S1_d := two_dec(S1_d)
R2_d := two_dec(R2_d)
S2_d := two_dec(S2_d)
R3_d := two_dec(R3_d)
S3_d := two_dec(S3_d)

PP_w = 0.0
R1_w = 0.0
R2_w = 0.0
R3_w = 0.0
S1_w = 0.0
S2_w = 0.0
S3_w = 0.0

/// We will be calculating "Fibonacci" Pivots for Intraday trading


PP_w := (phigh_w + plow_w + pclose_w) / 3
R1_w := PP_w + (phigh_w - plow_w) * 0.382
S1_w := PP_w - (phigh_w - plow_w) * 0.382
R2_w := PP_w + (phigh_w - plow_w) * 0.618
S2_w := PP_w - (phigh_w - plow_w) * 0.618
R3_w := PP_w + (phigh_w - plow_w) * 1.000
S3_w := PP_w - (phigh_w - plow_w) * 1.000

PP_w := two_dec(PP_w)
R1_w := two_dec(R1_w)
S1_w := two_dec(S1_w)
R2_w := two_dec(R2_w)
S2_w := two_dec(S2_w)
R3_w := two_dec(R3_w)
S3_w := two_dec(S3_w)

//PP_m = 0.0
//R1_m = 0.0, R2_m = 0.0, R3_m = 0.0
//S1_m = 0.0, S2_m = 0.0, S3_m = 0.0

/// We will be calculating "Fibonacci" Pivots for Intraday trading


//PP_m := (phigh_m + plow_m + pclose_m) / 3
//R1_m := PP_m + (phigh_m - plow_m) * 0.382
//S1_m := PP_m - (phigh_m - plow_m) * 0.382
//R2_m := PP_m + (phigh_m - plow_m) * 0.618
//S2_m := PP_m - (phigh_m - plow_m) * 0.618
//R3_m := PP_m + (phigh_m - plow_m) * 1.000
//S3_m := PP_m - (phigh_m - plow_m) * 1.000

//PP_m := two_dec(PP_m)
//R1_m := two_dec(R1_m)
//S1_m := two_dec(S1_m)
//R2_m := two_dec(R2_m)
//S2_m := two_dec(S2_m)
//R3_m := two_dec(R3_m)
//S3_m := two_dec(S3_m)

label_size = input.string('small', options=['auto', 'tiny', 'small', 'normal',


'large', 'huge'], title='Label size')
off_mult = 15

l_size = label_size == 'auto' ? size.auto : label_size == 'tiny' ? size.tiny :


label_size == 'small' ? size.small : label_size == 'normal' ? size.normal :
label_size == 'large' ? size.large : size.huge

plot(disp_d_pivots ? PP_d : na, color=color.new(color.blue, 0), title='Pivot_d')


plot(disp_d_pivots ? R1_d : na, color=color.new(color.orange, 0), title='R1_d',
linewidth=1)
plot(disp_d_pivots ? R2_d : na, color=color.new(color.orange, 0), title='R2_d',
linewidth=1)
plot(disp_d_pivots ? R3_d : na, color=color.new(color.red, 0), title='R3_d',
linewidth=1)
plot(disp_d_pivots ? S1_d : na, color=color.new(color.green, 0), title='S1_d',
linewidth=1)
plot(disp_d_pivots ? S2_d : na, color=color.new(color.green, 0), title='S2_d',
linewidth=1)
plot(disp_d_pivots ? S3_d : na, color=color.new(color.lime, 0), title='S3_d',
linewidth=1)
plot(disp_w_pivots ? PP_w : na, color=color.new(color.blue, 0), title='Pivot_w')
plot(disp_w_pivots ? R1_w : na, color=color.new(color.orange, 0), title='R1_w',
linewidth=1)
plot(disp_w_pivots ? R2_w : na, color=color.new(color.orange, 0), title='R2_w',
linewidth=1)
plot(disp_w_pivots ? R3_w : na, color=color.new(color.red, 0), title='R3_w',
linewidth=1)
plot(disp_w_pivots ? S1_w : na, color=color.new(color.green, 0), title='S1_w',
linewidth=1)
plot(disp_w_pivots ? S2_w : na, color=color.new(color.green, 0), title='S2_w',
linewidth=1)
plot(disp_w_pivots ? S3_w : na, color=color.new(color.lime, 0), title='S3_w',
linewidth=1)

//plot(disp_m_pivots ? PP_m : na, color=color.blue, title="Pivot_m")


//plot(disp_m_pivots ? R1_m : na, color=color.orange, title="R1_m", linewidth=1)
//plot(disp_m_pivots ? R2_m : na, color=color.orange, title="R2_m", linewidth=1)
//plot(disp_m_pivots ? R3_m : na, color=color.red, title="R3_m", linewidth=1)
//plot(disp_m_pivots ? S1_m : na, color=color.green, title="S1_m", linewidth=1)
//plot(disp_m_pivots ? S2_m : na, color=color.green, title="S2_m", linewidth=1)
//plot(disp_m_pivots ? S3_m : na, color=color.lime, title="S3_m", linewidth=1)

ll_offset = timenow + math.round(ta.change(time) * off_mult)

pivot_d_label = disp_d_pivots ? label.new(x=ll_offset, y=PP_d, xloc=xloc.bar_time,


yloc=yloc.price, text='Daily-Pivot ║ ' + str.tostring(PP_d),
style=label.style_none, textcolor=color.blue, size=l_size) : na
label.delete(pivot_d_label[1])
R1_d_label = disp_d_pivots ? label.new(x=ll_offset, y=R1_d, xloc=xloc.bar_time,
yloc=yloc.price, text='Daily-R1 ║ ' + str.tostring(R1_d), style=label.style_none,
textcolor=color.orange, size=l_size) : na
label.delete(R1_d_label[1])
R2_d_label = disp_d_pivots ? label.new(x=ll_offset, y=R2_d, xloc=xloc.bar_time,
yloc=yloc.price, text='Daily-R2 ║ ' + str.tostring(R2_d), style=label.style_none,
textcolor=color.orange, size=l_size) : na
label.delete(R2_d_label[1])
R3_d_label = disp_d_pivots ? label.new(x=ll_offset, y=R3_d, xloc=xloc.bar_time,
yloc=yloc.price, text='Daily-R3 ║ ' + str.tostring(R3_d), style=label.style_none,
textcolor=color.red, size=l_size) : na
label.delete(R3_d_label[1])

S1_d_label = disp_d_pivots ? label.new(x=ll_offset, y=S1_d, xloc=xloc.bar_time,


yloc=yloc.price, text='Daily-S1 ║ ' + str.tostring(S1_d), style=label.style_none,
textcolor=color.green, size=l_size) : na
label.delete(S1_d_label[1])
S2_d_label = disp_d_pivots ? label.new(x=ll_offset, y=S2_d, xloc=xloc.bar_time,
yloc=yloc.price, text='Daily-S2 ║ ' + str.tostring(S2_d), style=label.style_none,
textcolor=color.green, size=l_size) : na
label.delete(S2_d_label[1])
S3_d_label = disp_d_pivots ? label.new(x=ll_offset, y=S3_d, xloc=xloc.bar_time,
yloc=yloc.price, text='Daily-S3 ║ ' + str.tostring(S3_d), style=label.style_none,
textcolor=color.lime, size=l_size) : na
label.delete(S3_d_label[1])

pivot_w_label = disp_w_pivots ? label.new(x=ll_offset, y=PP_w, xloc=xloc.bar_time,


yloc=yloc.price, text='Weekly-Pivot ║ ' + str.tostring(PP_w),
style=label.style_none, textcolor=color.blue, size=l_size) : na
label.delete(pivot_w_label[1])
R1_w_label = disp_w_pivots ? label.new(x=ll_offset, y=R1_w, xloc=xloc.bar_time,
yloc=yloc.price, text='Weekly-R1 ║ ' + str.tostring(R1_w), style=label.style_none,
textcolor=color.orange, size=l_size) : na
label.delete(R1_w_label[1])
R2_w_label = disp_w_pivots ? label.new(x=ll_offset, y=R2_w, xloc=xloc.bar_time,
yloc=yloc.price, text='Weekly-R2 ║ ' + str.tostring(R2_w), style=label.style_none,
textcolor=color.orange, size=l_size) : na
label.delete(R2_w_label[1])
R3_w_label = disp_w_pivots ? label.new(x=ll_offset, y=R3_w, xloc=xloc.bar_time,
yloc=yloc.price, text='Weekly-R3 ║ ' + str.tostring(R3_w), style=label.style_none,
textcolor=color.red, size=l_size) : na
label.delete(R3_w_label[1])

S1_w_label = disp_w_pivots ? label.new(x=ll_offset, y=S1_w, xloc=xloc.bar_time,


yloc=yloc.price, text='Weekly-S1 ║ ' + str.tostring(S1_w), style=label.style_none,
textcolor=color.green, size=l_size) : na
label.delete(S1_w_label[1])
S2_w_label = disp_w_pivots ? label.new(x=ll_offset, y=S2_w, xloc=xloc.bar_time,
yloc=yloc.price, text='Weekly-S2 ║ ' + str.tostring(S2_w), style=label.style_none,
textcolor=color.green, size=l_size) : na
label.delete(S2_w_label[1])
S3_w_label = disp_w_pivots ? label.new(x=ll_offset, y=S3_w, xloc=xloc.bar_time,
yloc=yloc.price, text='Weekly-S3 ║ ' + str.tostring(S3_w), style=label.style_none,
textcolor=color.lime, size=l_size) : na
label.delete(S3_w_label[1])

//pivot_m_label = disp_m_pivots ? label.new(x=ll_offset, y=PP_m,


xloc=xloc.bar_time, yloc=yloc.price, text="Monthly-Pivot ║ " + tostring(PP_m),
style=label.style_none, textcolor=color.blue, size=l_size) : na
//label.delete(pivot_m_label[1])
//R1_m_label = disp_m_pivots ? label.new(x=ll_offset, y=R1_m, xloc=xloc.bar_time,
yloc=yloc.price, text="Monthly-R1 ║ " + tostring(R1_m), style=label.style_none,
textcolor=color.orange, size=l_size) : na
//label.delete(R1_m_label[1])
//R2_m_label = disp_m_pivots ? label.new(x=ll_offset, y=R2_m, xloc=xloc.bar_time,
yloc=yloc.price, text="Monthly-R2 ║ " + tostring(R2_m), style=label.style_none,
textcolor=color.orange, size=l_size) : na
//label.delete(R2_m_label[1])
//R3_m_label = disp_m_pivots ? label.new(x=ll_offset, y=R3_m, xloc=xloc.bar_time,
yloc=yloc.price, text="Monthly-R3 ║ " + tostring(R3_m), style=label.style_none,
textcolor=color.red, size=l_size) : na
//label.delete(R3_m_label[1])

//S1_m_label = disp_m_pivots ? label.new(x=ll_offset, y=S1_m, xloc=xloc.bar_time,


yloc=yloc.price, text="Monthly-S1 ║ " + tostring(S1_m), style=label.style_none,
textcolor=color.green, size=l_size) : na
//label.delete(S1_m_label[1])
//S2_m_label = disp_m_pivots ? label.new(x=ll_offset, y=S2_m, xloc=xloc.bar_time,
yloc=yloc.price, text="Monthly-S2 ║ " + tostring(S2_m), style=label.style_none,
textcolor=color.green, size=l_size) : na
//label.delete(S2_m_label[1])
//S3_m_label = disp_m_pivots ? label.new(x=ll_offset, y=S3_m, xloc=xloc.bar_time,
yloc=yloc.price, text="Monthly-S3 ║ " + tostring(S3_m), style=label.style_none,
textcolor=color.lime, size=l_size) : na
//label.delete(S3_m_label[1])

///////////////////////////////////////////
// GANN Levels
//////////////////////////////////////////
G540N_d = 0.0
G360N_d = 0.0
G270N_d = 0.0
G180N_d = 0.0
G135N_d = 0.0
G90N_d = 0.0
G45N_d = 0.0
G45P_d = 0.0
G90P_d = 0.0
G135P_d = 0.0
G180P_d = 0.0
G270P_d = 0.0
G360P_d = 0.0
G540P_d = 0.0
Gkey_d = 0.0

Gkey_d := math.sqrt(pclose_d)

G540N_d := gansqr(Gkey_d - 3)
G360N_d := gansqr(Gkey_d - 1)
G270N_d := gansqr(Gkey_d - 0.75)
G180N_d := gansqr(Gkey_d - 0.5)
G135N_d := gansqr(Gkey_d - 0.375)
G90N_d := gansqr(Gkey_d - 0.25)
G45N_d := gansqr(Gkey_d - 0.125)
G45P_d := gansqr(Gkey_d + 0.125)
G90P_d := gansqr(Gkey_d + 0.25)
G135P_d := gansqr(Gkey_d + 0.375)
G180P_d := gansqr(Gkey_d + 0.5)
G270P_d := gansqr(Gkey_d + 0.75)
G360P_d := gansqr(Gkey_d + 1)
G540P_d := gansqr(Gkey_d + 3)

////////////////////////
// PLOT GANN LEVELS //

plot(disp_d_gann ? G540N_d : na, color=color.new(color.red, 0), title='Day Res')


plot(disp_d_gann ? G180N_d : na, color=color.new(color.gray, 0), title='TGT 3',
linewidth=1)
plot(disp_d_gann ? G135N_d : na, color=color.new(color.gray, 0), title='TGT 2',
linewidth=1)
plot(disp_d_gann ? G90N_d : na, color=color.new(color.gray, 0), title='TGT1',
linewidth=1)
plot(disp_d_gann ? G45N_d : na, color=color.new(color.maroon, 0), title='Day BUY',
linewidth=1)
plot(disp_d_gann ? G540P_d : na, color=color.new(color.green, 0), title='Day Sup')
plot(disp_d_gann ? G180P_d : na, color=color.new(color.gray, 0), title='Day T3',
linewidth=1)
plot(disp_d_gann ? G135P_d : na, color=color.new(color.gray, 0), title='Day T2',
linewidth=1)
plot(disp_d_gann ? G90P_d : na, color=color.new(color.gray, 0), title='Day T1',
linewidth=1)
plot(disp_d_gann ? G45P_d : na, color=color.new(color.green, 0), title='Day SELL',
linewidth=1)

label_g540n_d = disp_d_gann ? label.new(x=ll_offset, y=G540N_d, xloc=xloc.bar_time,


yloc=yloc.price, text=' Day Supp ║ ' + str.tostring(G540N_d),
style=label.style_none, textcolor=color.orange, size=l_size) : na
label.delete(label_g540n_d[1])

label_g180n_d = disp_d_gann ? label.new(x=ll_offset, y=G180N_d, xloc=xloc.bar_time,


yloc=yloc.price, text='TGT 3 ║ ' + str.tostring(G180N_d), style=label.style_none,
textcolor=color.red, size=l_size) : na
label.delete(label_g180n_d[1])

label_g135n_d = disp_d_gann ? label.new(x=ll_offset, y=G135N_d, xloc=xloc.bar_time,


yloc=yloc.price, text='TGT 2 ║ ' + str.tostring(G135N_d), style=label.style_none,
textcolor=color.red, size=l_size) : na
label.delete(label_g135n_d[1])

label_g90n_d = disp_d_gann ? label.new(x=ll_offset, y=G90N_d, xloc=xloc.bar_time,


yloc=yloc.price, text='TGT 1 ║ ' + str.tostring(G90N_d), style=label.style_none,
textcolor=color.red, size=l_size) : na
label.delete(label_g90n_d[1])

label_g45n_d = disp_d_gann ? label.new(x=ll_offset, y=G45N_d, xloc=xloc.bar_time,


yloc=yloc.price, text='ADITYA RESEARCH INTRADAY SELL ║ ' + str.tostring(G45N_d),
style=label.style_none, textcolor=color.red, size=l_size) : na
label.delete(label_g45n_d[1])

label_g540p_d = disp_d_gann ? label.new(x=ll_offset, y=G540P_d, xloc=xloc.bar_time,


yloc=yloc.price, text='Day Res ║ ' + str.tostring(G540P_d), style=label.style_none,
textcolor=color.rgb(245, 29, 29), size=l_size) : na
label.delete(label_g540p_d[1])

label_g180p_d = disp_d_gann ? label.new(x=ll_offset, y=G180P_d, xloc=xloc.bar_time,


yloc=yloc.price, text='TGT 3 ║ ' + str.tostring(G180P_d), style=label.style_none,
textcolor=color.green, size=l_size) : na
label.delete(label_g180p_d[1])

label_g135p_d = disp_d_gann ? label.new(x=ll_offset, y=G135P_d, xloc=xloc.bar_time,


yloc=yloc.price, text='TGT 2 ║ ' + str.tostring(G135P_d), style=label.style_none,
textcolor=color.rgb(23, 233, 76), size=l_size) : na
label.delete(label_g135p_d[1])

label_g90p_d = disp_d_gann ? label.new(x=ll_offset, y=G90P_d, xloc=xloc.bar_time,


yloc=yloc.price, text='TGT 1 ║ ' + str.tostring(G90P_d), style=label.style_none,
textcolor=color.rgb(68, 204, 75), size=l_size) : na
label.delete(label_g90p_d[1])

label_g45p_d = disp_d_gann ? label.new(x=ll_offset, y=G45P_d, xloc=xloc.bar_time,


yloc=yloc.price, text=' ADITYA RESEARCH INTRADAY BUY ║ ' + str.tostring(G45P_d),
style=label.style_none, textcolor=color.green, size=l_size) : na
label.delete(label_g45p_d[1])

///// yaha tak done ////


/////////////////////////
/////// Weekly GANN
G720N_w = 0.0
G540N_w = 0.0
G360N_w = 0.0
G270N_w = 0.0
G180N_w = 0.0
G90N_w = 0.0
G45N_w = 0.0
G45P_w = 0.0
G90P_w = 0.0
G180P_w = 0.0
G270P_w = 0.0
G360P_w = 0.0
G540P_w = 0.0
G720P_w = 0.0
Gkey_w = 0.0

Gkey_w := math.sqrt(pclose_w)

G720N_w := gansqr(Gkey_w - 4)
G540N_w := gansqr(Gkey_w - 3)
G360N_w := gansqr(Gkey_w - 2)
G270N_w := gansqr(Gkey_w - 1.5)
G180N_w := gansqr(Gkey_w - 1)
G90N_w := gansqr(Gkey_w - 0.5)
G45N_w := gansqr(Gkey_w - 0.25)
G45P_w := gansqr(Gkey_w + 0.25)
G90P_w := gansqr(Gkey_w + 0.5)
G180P_w := gansqr(Gkey_w + 1)
G270P_w := gansqr(Gkey_w + 1.5)
G360P_w := gansqr(Gkey_w + 2)
G540P_w := gansqr(Gkey_w + 3)
G720P_w := gansqr(Gkey_w + 4)

////////////////////////
// PLOT GANN LEVELS //

plot(disp_w_gann ? G720N_w : na, color=color.new(color.blue, 0), title='Wk Sup')


plot(disp_w_gann ? G270N_w : na, color=color.new(color.red, 0), title='WK T3',
linewidth=1)
plot(disp_w_gann ? G180N_w : na, color=color.new(color.green, 0), title='WK T2',
linewidth=1)
plot(disp_w_gann ? G90N_w : na, color=color.new(color.green, 0), title='WK T1',
linewidth=1)
plot(disp_w_gann ? G45N_w : na, color=color.new(color.lime, 0), title='Wk Sell
Below', linewidth=1)
plot(disp_w_gann ? G720P_w : na, color=color.new(color.blue, 0), title='Wk Res')
plot(disp_w_gann ? G270P_w : na, color=color.new(color.red, 0), title='WK T3',
linewidth=1)
plot(disp_w_gann ? G180P_w : na, color=color.new(color.green, 0), title='WK T2',
linewidth=1)
plot(disp_w_gann ? G90P_w : na, color=color.new(color.green, 0), title='WK T1',
linewidth=1)
plot(disp_w_gann ? G45P_w : na, color=color.new(color.lime, 0), title='Wk Buy
Above', linewidth=1)

label_g720n_w = disp_w_gann ? label.new(x=ll_offset, y=G720N_w, xloc=xloc.bar_time,


yloc=yloc.price, text='Wk Sup ║ ' + str.tostring(G720N_w), style=label.style_none,
textcolor=color.blue, size=l_size) : na
label.delete(label_g720n_w[1])

label_g270n_w = disp_w_gann ? label.new(x=ll_offset, y=G270N_w, xloc=xloc.bar_time,


yloc=yloc.price, text='WK T3 ║ ' + str.tostring(G270N_w), style=label.style_none,
textcolor=color.blue, size=l_size) : na
label.delete(label_g270n_w[1])

label_g180n_w = disp_w_gann ? label.new(x=ll_offset, y=G180N_w, xloc=xloc.bar_time,


yloc=yloc.price, text='WK T2 ║ ' + str.tostring(G180N_w), style=label.style_none,
textcolor=color.blue, size=l_size) : na
label.delete(label_g180n_w[1])

label_g90n_w = disp_w_gann ? label.new(x=ll_offset, y=G90N_w, xloc=xloc.bar_time,


yloc=yloc.price, text='WK T1 ║ ' + str.tostring(G90N_w), style=label.style_none,
textcolor=color.blue, size=l_size) : na
label.delete(label_g90n_w[1])

label_g45n_w = disp_w_gann ? label.new(x=ll_offset, y=G45N_w, xloc=xloc.bar_time,


yloc=yloc.price, text='WK Sell Below ║ ' + str.tostring(G45N_w),
style=label.style_none, textcolor=color.blue, size=l_size) : na
label.delete(label_g45n_w[1])

label_g720p_w = disp_w_gann ? label.new(x=ll_offset, y=G720P_w, xloc=xloc.bar_time,


yloc=yloc.price, text='Wk Res ║ ' + str.tostring(G720P_w), style=label.style_none,
textcolor=color.blue, size=l_size) : na
label.delete(label_g720p_w[1])

label_g270p_w = disp_w_gann ? label.new(x=ll_offset, y=G270P_w, xloc=xloc.bar_time,


yloc=yloc.price, text='WK T3 ║ ' + str.tostring(G270P_w), style=label.style_none,
textcolor=color.blue, size=l_size) : na
label.delete(label_g270p_w[1])

label_g180p_w = disp_w_gann ? label.new(x=ll_offset, y=G180P_w, xloc=xloc.bar_time,


yloc=yloc.price, text='WK T2 ║ ' + str.tostring(G180P_w), style=label.style_none,
textcolor=color.blue, size=l_size) : na
label.delete(label_g180p_w[1])

label_g90p_w = disp_w_gann ? label.new(x=ll_offset, y=G90P_w, xloc=xloc.bar_time,


yloc=yloc.price, text='WK T1 ║ ' + str.tostring(G90P_w), style=label.style_none,
textcolor=color.blue, size=l_size) : na
label.delete(label_g90p_w[1])

label_g45p_w = disp_w_gann ? label.new(x=ll_offset, y=G45P_w, xloc=xloc.bar_time,


yloc=yloc.price, text='WK Buy Above ║ ' + str.tostring(G45P_w),
style=label.style_none, textcolor=color.blue, size=l_size) : na
label.delete(label_g45p_w[1])

//////////////////
// Monthly Gann

//G720N_m = 0.0, G540N_m=0.0, G360N_m=0.0, G270N_m=0.0, G180N_m=0.0


//G90N_m=0.0, G45N_m=0.0, G45P_m=0.0, G90P_m=0.0
//G180P_m=0.0, G270P_m=0.0, G360P_m=0.0, G540P_m=0.0, G720P_m=0.0
//Gkey_m=0.0

//Gkey_m := sqrt(pclose_m)

//G720N_m:= gansqr(Gkey_m-4)
//G540N_m:= gansqr(Gkey_m-3)
//G360N_m:= gansqr(Gkey_m-2)
//G270N_m:= gansqr(Gkey_m-1.5)
//G180N_m:= gansqr(Gkey_m-1)
//G90N_m:= gansqr(Gkey_m-0.5)
//G45N_m:= gansqr(Gkey_m-0.25)
//G45P_m:= gansqr(Gkey_m+0.25)
//G90P_m:= gansqr(Gkey_m+0.5)
//G180P_m:= gansqr(Gkey_m+1)
//G270P_m:= gansqr(Gkey_m+1.5)
//G360P_m:= gansqr(Gkey_m+2)
//G540P_m:= gansqr(Gkey_m+3)
//G720P_m:= gansqr(Gkey_m+4)

////////////////////////
// PLOT GANN LEVELS //

//plot(disp_m_gann ? G720N_m : na, color=color.blue, title="G720N_m")


//plot(disp_m_gann ? G540N_m : na, color=color.orange, title="G540N_m",
linewidth=1)
//plot(disp_m_gann ? G360N_m : na, color=color.orange, title="G360N_m",
linewidth=1)
//plot(disp_m_gann ? G270N_m : na, color=color.red, title="G270N_m", linewidth=1)
//plot(disp_m_gann ? G180N_m : na, color=color.green, title="G180N_m", linewidth=1)
//plot(disp_m_gann ? G90N_m : na, color=color.green, title="G90N_m", linewidth=1)
//plot(disp_m_gann ? G45N_m : na, color=color.lime, title="G45N_m", linewidth=1)
//plot(disp_m_gann ? G720P_m : na, color=color.blue, title="G720P_m")
//plot(disp_m_gann ? G540P_m : na, color=color.orange, title="G540P_m",
linewidth=1)
//plot(disp_m_gann ? G360P_m : na, color=color.orange, title="G360P_m",
linewidth=1)
//plot(disp_m_gann ? G270P_m : na, color=color.red, title="G270P_m", linewidth=1)
//plot(disp_m_gann ? G180P_m : na, color=color.green, title="G180P_m", linewidth=1)
//plot(disp_m_gann ? G90P_m : na, color=color.green, title="G90P_m", linewidth=1)
//plot(disp_m_gann ? G45P_m : na, color=color.lime, title="G45P_m", linewidth=1)

//label_g720n_m = disp_m_gann ? label.new(x=ll_offset, y=G720N_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G720N ║ " +
tostring(G720N_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g720n_m[1])

//label_g540n_m = disp_m_gann ? label.new(x=ll_offset, y=G540N_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G540N ║ " +
tostring(G540N_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g540n_m[1])

//label_g360n_m = disp_m_gann ? label.new(x=ll_offset, y=G360N_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G360N ║ " +
tostring(G360N_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g360n_m[1])

//label_g270n_m = disp_m_gann ? label.new(x=ll_offset, y=G270N_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G270N ║ " +
tostring(G270N_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g270n_m[1])

//label_g180n_m = disp_m_gann ? label.new(x=ll_offset, y=G180N_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G180N ║ " +
tostring(G180N_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g180n_m[1])

//label_g90n_m = disp_m_gann ? label.new(x=ll_offset, y=G90N_m, xloc=xloc.bar_time,


yloc=yloc.price, text=" Monthly G90N ║ " + tostring(G90N_m),
//style=label.style_none, textcolor=color.blue, size=l_size) : na
//label.delete(label_g90n_m[1])

//label_g45n_m = disp_m_gann ? label.new(x=ll_offset, y=G45N_m, xloc=xloc.bar_time,


yloc=yloc.price, text=" Monthly G45N ║ " + tostring(G45N_m),
//style=label.style_none, textcolor=color.blue, size=l_size) : na
//label.delete(label_g45n_m[1])

//label_g720p_m = disp_m_gann ? label.new(x=ll_offset, y=G720P_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G720P ║ " +
tostring(G720P_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g720p_m[1])

//label_g540p_m = disp_m_gann ? label.new(x=ll_offset, y=G540P_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G540P ║ " +
tostring(G540P_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g540p_m[1])

//label_g360p_m = disp_m_gann ? label.new(x=ll_offset, y=G360P_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G360P ║ " +
tostring(G360P_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g360p_m[1])

//label_g270p_m = disp_m_gann ? label.new(x=ll_offset, y=G270P_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G270P ║ " +
tostring(G270P_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g270p_m[1])

//label_g180p_m = disp_m_gann ? label.new(x=ll_offset, y=G180P_m,


xloc=xloc.bar_time, yloc=yloc.price, text=" Monthly G180P ║ " +
tostring(G180P_m), //style=label.style_none, textcolor=color.blue, size=l_size) :
na
//label.delete(label_g180p_m[1])
//label_g90p_m = disp_m_gann ? label.new(x=ll_offset, y=G90P_m, xloc=xloc.bar_time,
yloc=yloc.price, text="Monthly G90N ║ " + tostring(G90N_m), style=label.style_none,
//textcolor=color.blue, size=l_size) : na
//label.delete(label_g90p_m[1])

//label_g45p_m = disp_m_gann ? label.new(x=ll_offset, y=G45P_m, xloc=xloc.bar_time,


yloc=yloc.price, text="Monthly G45P ║ " + tostring(G45P_m), style=label.style_none,
//textcolor=color.blue, size=l_size) : na
//label.delete(label_g45p_m[1])

maPeriods4 = input(66, 'MA 4')


maPeriods5 = input(180, 'MA 5')
maPeriods9 = input(77, 'MA 9')
maPeriods10 = input(231, 'MA 10')

// MA4 Plot
plot(ta.sma(close, maPeriods4), '66', color.new(color.white, 0), linewidth=1)

// MA5 Plot
plot(ta.sma(close, maPeriods5), '180', color.new(color.green, 0), linewidth=1)

// MA9 Plot
plot(ta.sma(close, maPeriods9), '77', color.new(color.white, 0), linewidth=1,
style=plot.style_circles)

// MA10 Plot
plot(ta.sma(close, maPeriods10), '231', color.new(color.green, 0), linewidth=1,
style=plot.style_circles)

// Original Script > @DonovanWall


// Adapted Version > @guikroth
//
// Updated PineScript to version 5
// Republished by > @tvenn

//////////////////////////////////////////////////////////////////////////
// Settings for 5min chart, BTCUSDC. For Other coin, change the parameters
//////////////////////////////////////////////////////////////////////////

// Color variables
upColor = color.white
midColor = #90bff9
downColor = color.blue

// Source
src = input(defval=close, title="Source")

// Sampling Period
// Settings for 5min chart, BTCUSDC. For Other coin, change the paremeters
per = input.int(defval=100, minval=1, title="Sampling Period")

// Range Multiplier
mult = input.float(defval=3.0, minval=0.1, title="Range Multiplier")

// Smooth Average Range


smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
smoothrng = ta.ema(avrng, wper) * m
smoothrng
smrng = smoothrng(src, per, mult)

// Range Filter
rngfilt(x, r) =>
rngfilt = x
rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r
:
x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
rngfilt
filt = rngfilt(src, smrng)

// Filter Direction
upward = 0.0
upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])
downward = 0.0
downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 :
nz(downward[1])

// Target Bands
hband = filt + smrng
lband = filt - smrng

// Colors
filtcolor = upward > 0 ? upColor : downward > 0 ? downColor : midColor
barcolor = src > filt and src > src[1] and upward > 0 ? upColor :
src > filt and src < src[1] and upward > 0 ? upColor :
src < filt and src < src[1] and downward > 0 ? downColor :
src < filt and src > src[1] and downward > 0 ? downColor : midColor

filtplot = plot(filt, color=filtcolor, linewidth=2, title="Range Filter")

// Target
hbandplot = plot(hband, color=color.new(upColor, 70), title="High Target")
lbandplot = plot(lband, color=color.new(downColor, 70), title="Low Target")

// Fills
fill(hbandplot, filtplot, color=color.new(upColor, 90), title="High Target Range")
fill(lbandplot, filtplot, color=color.new(downColor, 90), title="Low Target Range")

// Bar Color
barcolor(barcolor)

// Break Outs
longCond = bool(na)
shortCond = bool(na)
longCond := src > filt and src > src[1] and upward > 0 or
src > filt and src < src[1] and upward > 0
shortCond := src < filt and src < src[1] and downward > 0 or
src < filt and src > src[1] and downward > 0

CondIni = 0
CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1]
longCondition = longCond and CondIni[1] == -1
shortCondition = shortCond and CondIni[1] == 1

//Alerts
plotshape(longCondition, title="Buy Signal", text="Buy", textcolor=color.white,
style=shape.labelup, size=size.small, location=location.belowbar,
color=color.new(#aaaaaa, 20))
plotshape(shortCondition, title="Sell Signal", text="Sell", textcolor=color.white,
style=shape.labeldown, size=size.small, location=location.abovebar,
color=color.new(downColor, 20))

alertcondition(longCondition, title="Buy alert on Range Filter", message="Buy alert


on Range Filter")
alertcondition(shortCondition, title="Sell alert on Range Filter", message="Sell
alert on Range Filter")
alertcondition(longCondition or shortCondition, title="Buy and Sell alert on Range
Filter", message="Buy and Sell alert on Range Filter")

// For use as a Strategy


//
___________________________________________________________________________________
________________________

// 1. Replace the word "indicator" on line 2 with the word "strategy"


// 2. Uncomment the code below by highlighting it and pressing Ctl + '/'

// Settings for 5min BTCUSDT. For other timeframes and assets, adjust the
parameters within the settings menu.
//
___________________________________________________________________________________
________________________

// grp_STRAT = "Strategy settings"


// timeInput = input.time(timestamp("1 Nov 2022 00:00 +0000"), title="Start
date", group=grp_STRAT)
// tpInPips = input.int(400, title="TP (in pips)", group=grp_STRAT)
// slInPips = input.int(100, title="SL (in pips)", group=grp_STRAT)

// timePeriod = time >= timeInput


// notInTrade = strategy.position_size <= 0

// if(longCondition and timePeriod and notInTrade)


// strategy.entry("Long", strategy.long)
// strategy.exit("Exit long", "Long", loss=slInPips, profit=tpInPips)
// if(shortCondition and timePeriod and notInTrade)
// strategy.entry("Short", strategy.short)
// strategy.exit("Exit short", "Short", loss=slInPips, profit=tpInPips)

You might also like