0% found this document useful (0 votes)
324 views3 pages

NG Indicator With Trend

The document defines calculations to plot daily, weekly, and monthly pivot points and levels on a chart based on historical price data. It calculates pivot point ranges (R1-R4, S1-S4) for the previous day, week, and month using high, low, and close prices. It then plots these values on the chart with customizable colors and styles. It also adds calculations for a CCI indicator and buffer lines above and below price to identify trends and signals.

Uploaded by

Sriram Ganesh
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)
324 views3 pages

NG Indicator With Trend

The document defines calculations to plot daily, weekly, and monthly pivot points and levels on a chart based on historical price data. It calculates pivot point ranges (R1-R4, S1-S4) for the previous day, week, and month using high, low, and close prices. It then plots these values on the chart with customizable colors and styles. It also adds calculations for a CCI indicator and buffer lines above and below price to identify trends and signals.

Uploaded by

Sriram Ganesh
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/ 3

study(title="GANESH Pivot Point", shorttitle=" ganesh Pivot Point", overlay = true)

width = input(3, minval=1)


xHigh = security(tickerid,"D", high[1])
xLow = security(tickerid,"D", low[1])
xClose = security(tickerid,"D", close[1])
wHigh = security(tickerid,"W", high[1])
wLow = security(tickerid,"W", low[1])
wClose = security(tickerid,"W", close[1])
mHigh = security(tickerid,"M", high[1])
mLow = security(tickerid,"M", low[1])
mClose = security(tickerid,"M", close[1])
gPA =(xHigh-xLow) / 6.840149
gPB = (xHigh-xLow) / 4.239631
gPR = xClose+(gPA/2)
gPS = xClose-(gPA/2)
gR1 = gPR+gPB
gS1 = gPS-gPB
gR2 = gR1+gPB
gS2 = gS1-gPB
gR3 = gR2+gPB
gS3 = gS2-gPB
gR4 = gR3+gPB
gS4 = gS3-gPB

hPA =(wHigh-wLow) / 6.840149


hPB = (wHigh-wLow) / 4.239631
hPR = wClose+(hPA/2)
hPS = wClose-(hPA/2)
hR1 = hPR+hPB
hS1 = hPS-hPB
hR2 = hR1+hPB
hS2 = hS1-hPB
hR3 = hR2+hPB
hS3 = hS2-hPB
hR4 = hR3+hPB
hS4 = hS3-hPB

iPA =(mHigh-mLow) / 6.840149


iPB = (mHigh-mLow) / 4.239631
iPR = mClose+(iPA/2)
iPS = mClose-(iPA/2)
iR1 = iPR+iPB
iS1 = iPS-iPB
iR2 = iR1+iPB
iS2 = iS1-iPB
iR3 = iR2+iPB
iS3 = iS2-iPB
iR4 = iR3+iPB
iS4 = iS3-iPB

plot(xHigh, color=#ffffff, title="previous day high", style = cross, linewidth =


width)
plot(xLow, color=#ffffff, title="previous day LOW", style = cross, linewidth =
width)
plot(wHigh, color=#08bbeb, title="previous week high", style = cross, linewidth =
width)
plot(wLow, color=#f106c0, title="previous week LOW", style = cross, linewidth =
width)
plot(mHigh, color=#e1b60b, title="previous month high", style = cross, linewidth =
width)
plot(mLow, color=#da1c24, title="previous month LOW", style = cross, linewidth =
width)

plot(gS1, color=#ffffff, title="S1", style = line, linewidth = width)


plot(gS2, color=#ffffff, title="S2", style = line, linewidth = width)
plot(gS3, color=#ffffff, title="S3", style = line, linewidth = width)
plot(gS4, color=#ffffff, title="S4", style = line, linewidth = width)
plot(gR1, color=#ffffff, title="R1", style = line, linewidth = width)
plot(gR2, color=#ffffff, title="R2", style = line, linewidth = width)
plot(gR3, color=#ffffff, title="R3", style = line, linewidth = width)
plot(gR4, color=#ffffff, title="R4", style = line, linewidth = width)
plot(gPR, color=#e10b36, title="GPR", style = circles, linewidth = width)
plot(gPS, color=#e10b36, title="GPS", style = circles, linewidth = width)

plot(hS1, color=#f106c0, title="wS1", style = line, linewidth = width)


plot(hS2, color=#f106c0, title="wS2", style = line, linewidth = width)
plot(hS3, color=#f106c0, title="wS3", style = line, linewidth = width)
plot(hS4, color=#f106c0, title="wS4", style = line, linewidth = width)
plot(hR1, color=#08bbeb, title="wR1", style = line, linewidth = width)
plot(hR2, color=#08bbeb, title="wR2", style = line, linewidth = width)
plot(hR3, color=#08bbeb, title="wR3", style = line, linewidth = width)
plot(hR4, color=#08bbeb, title="wR4", style = line, linewidth = width)
plot(hPR, color=#0ca252, title="wGPR", style = circles, linewidth = width)
plot(hPS, color=#0ca252, title="wGPS", style = circles, linewidth = width)

plot(iS1, color=#da1c24, title="mS1", style = line, linewidth = width)


plot(iS2, color=#da1c24, title="mS2", style = line, linewidth = width)
plot(iS3, color=#da1c24, title="mS3", style = line, linewidth = width)
plot(iS4, color=#da1c24, title="mS4", style = line, linewidth = width)
plot(iR1, color=#e1b60b, title="mR1", style = line, linewidth = width)
plot(iR2, color=#e1b60b, title="mR2", style = line, linewidth = width)
plot(iR3, color=#e1b60b, title="mR3", style = line, linewidth = width)
plot(iR4, color=#e1b60b, title="mR4", style = line, linewidth = width)
plot(iPR, color=#0220f9, title="mGPR", style = circles, linewidth = width)
plot(iPS, color=#0220f9, title="mGPS", style = circles, linewidth = width)

//@version=2
CCI = input(20)
ATR = input(5)
Multiplier=input(1,title='ATR Multiplier')
original=input(true,title='original coloring')
thisCCI = cci(close, CCI)
lastCCI = nz(thisCCI[1])
bufferDn= high + Multiplier * sma(tr,ATR)
bufferUp= low - Multiplier * sma(tr,ATR)
if (thisCCI >= 0 and lastCCI < 0)
bufferUp := bufferDn[1]
if (thisCCI <= 0 and lastCCI > 0)
bufferDn := bufferUp[1]

if (thisCCI >= 0)
if (bufferUp < bufferUp[1])
bufferUp := bufferUp[1]
else
if (thisCCI <= 0)
if (bufferDn > bufferDn[1])
bufferDn := bufferDn[1]
x=thisCCI >= 0 ?bufferUp:thisCCI <= 0 ?bufferDn:x[1]
swap=x>x[1]?1:x<x[1]?-1:swap[1]
swap2=swap==1?lime:red
swap3=thisCCI >=0 ?lime:red
swap4=original?swap3:swap2
plot(x,color=swap4,transp=0,linewidth=3)

You might also like