100% found this document useful (1 vote)
109 views

Ajju-Up and Down Trading Signal

This document defines a study for analyzing financial data using technical indicators like PSAR, EMA, HMA and ATR zones. It inputs parameters for the indicators and plots the results on a chart along with bar coloring based on the indicator values.

Uploaded by

Ajay Twitter
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
100% found this document useful (1 vote)
109 views

Ajju-Up and Down Trading Signal

This document defines a study for analyzing financial data using technical indicators like PSAR, EMA, HMA and ATR zones. It inputs parameters for the indicators and plots the results on a chart along with bar coloring based on the indicator values.

Uploaded by

Ajay Twitter
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/ 2

//@version=4

study(title="Ajju", shorttitle="Ajju", overlay=true)

pSARbeginningValue = input(2, minval=0, maxval=10, title="PSAR Beginning Value")


pSARendValue = input(2, minval=1, maxval=10, title="PSAR End Value")
pSARmultiplierValue = input(2, minval=0, maxval=10, title=" PSAR Multiplier Value"
)

pSARbeginningMethod = pSARbeginningValue * .01


pSARendMethod = pSARendValue * .10
pSARmultiplierMethod = pSARmultiplierValue * .01

pSAR_UpValue = sar(pSARbeginningMethod, pSARmultiplierMethod,


pSARendMethod)
pSAR_DownValue = sar(pSARbeginningMethod, pSARmultiplierMethod,
pSARendMethod)

pSAR_UpColor = close >= pSAR_DownValue ? color.green : na


pSAR_DownColor = close <= pSAR_UpValue ? color.red : na

plot(pSAR_UpValue ? pSAR_UpValue : na, style=plot.style_circles,


color=pSAR_UpColor, linewidth=1, title="Upside PSAR")
plot(pSAR_DownValue ? pSAR_DownValue : na, style=plot.style_circles,
color=pSAR_DownColor, linewidth=1, title="Downside PSAR")

zoneSource = input(hl2, title="Source")


zoneLength = input(type=input.integer, defval=10, title="ATR Zone Length")
zoneMultiplier = input(type=input.float, defval=3.0, step=0.1, title="ATR Zone
Multiplier")
zoneATR = atr(zoneLength)

downZone =zoneSource+(zoneMultiplier*zoneATR)
downZoneNew = nz(downZone[1], downZone)
downZone := close[1] < downZoneNew ? min(downZone, downZoneNew) : downZone
upZone =zoneSource-(zoneMultiplier*zoneATR)
upZoneNew = nz(upZone[1],upZone)
upZone := close[1] > upZoneNew ? max(upZone,upZoneNew) : upZone

zoneDecider = 1
zoneDecider := nz(zoneDecider[1], zoneDecider)
zoneDecider := zoneDecider == -1 and close > downZoneNew ? 1 : zoneDecider == 1
and close < upZoneNew ? -1 : zoneDecider

redZone = zoneDecider == -1 and zoneDecider[1] == 1


greenZone = zoneDecider == 1 and zoneDecider[1] == -1
downZoneColor = (zoneDecider == -1 ? color.red : color.gray)
upZoneColor = (zoneDecider == 1 ? color.green : color.gray)

downZonePlot = plot(zoneDecider == 1 ? na : downZone, style=plot.style_linebr,


linewidth=2, color=color.red, title="Down Zone")

plotshape(redZone ? downZone : na, location=location.absolute, style=shape.diamond,


size=size.tiny, color=color.red, transp=0, title="Down Zone Start")
plotshape(redZone? downZone : na, location=location.absolute,
style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white,
transp=0, title="Down", text="Down")

upZonePlot = plot(zoneDecider == 1 ? upZone : na, style=plot.style_linebr,


linewidth=2, color=color.green, title="Up Zone")

plotshape(greenZone ? upZone : na, location=location.absolute, style=shape.diamond,


size=size.tiny, color=color.green, transp=0, title="Up Zone Start")
plotshape(greenZone ? upZone : na, location=location.absolute, style=shape.labelup,
size=size.tiny, color=color.green, textcolor=color.white, transp=0, title="Up",
text="Up")

neutralZonePlot = plot(ohlc4, style=plot.style_circles, linewidth=0, title="Zone


Style")
fill(neutralZonePlot, downZonePlot, color=downZoneColor, title="Down Zone Color")
fill(neutralZonePlot, upZonePlot, color=upZoneColor, title="Up Zone Color")

emaLowerPeriod = input(9, minval=1, title="EMA Lower Period")

emaLower = ema(input(close), emaLowerPeriod)

plot(emaLower, color=color.fuchsia, linewidth=2, title="EMA Lower Period")

showEMA2 = input(false, title="EMA - Medium Term")

emaMediumPeriod = input(27, minval=1, title="EMA Medium Period")

emaMedium = ema(input(close), emaMediumPeriod)

plot(showEMA2 and emaMedium ? emaMedium : na, color=color.aqua, linewidth=2,


title="EMA Medium Period")

hmaLongPeriod = input(200, minval=1, title="HMA Long Period")

hmaLong = hma(input(close), hmaLongPeriod)

plot(hmaLong, color=color.gray, linewidth=2, title="HMA Long Period")

//Bcolor
isCloseAbove = (close > emaLower and close > hmaLong)
isCloseBelow = (close < emaLower and close < hmaLong)
isCloseBetween = (close > emaLower and close < hmaLong) or (close < emaLower and
close > hmaLong)
//isBullish = (close > upZone)
//isBearish = (close < downZone)

isNeutral = (close > pSAR_DownValue and isCloseBelow) or (close < pSAR_DownValue


and isCloseAbove)

//barcolor((isNeutral or isCloseBetween) ? color.yellow: (isCloseBelow and


isBearish) ? color.red: (isCloseBelow and isBullish) ? color.orange: (isCloseAbove
and isBearish) ? color.lime: (isCloseAbove and isBullish) ? color.green :
color.black )

barcolor((isNeutral or isCloseBetween) ? color.yellow: isCloseBelow ? color.red:


isCloseAbove ? color.green: color.black)

You might also like