0% found this document useful (0 votes)
13 views1 page

Code 3 Pin

//@version=5 indicator("Buy on Every Candle", overlay=true) // Generate a buy signal on every candle buySignal = true // Plot a label or marker on the chart to indicate the buy signal plotshape(series=buySignal, style=shape.labelup, location=location.belowbar, color=color.green, size=size.small, text="Buy") // Alerts for buy signals alertcondition(buySignal, title="Buy Alert", message="Buy Signal Triggered")

Uploaded by

yusrabatool041
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)
13 views1 page

Code 3 Pin

//@version=5 indicator("Buy on Every Candle", overlay=true) // Generate a buy signal on every candle buySignal = true // Plot a label or marker on the chart to indicate the buy signal plotshape(series=buySignal, style=shape.labelup, location=location.belowbar, color=color.green, size=size.small, text="Buy") // Alerts for buy signals alertcondition(buySignal, title="Buy Alert", message="Buy Signal Triggered")

Uploaded by

yusrabatool041
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/ 1

//@version=4

strategy(title="nhs", overlay = true)


//CREDITS to HPotter for the orginal code. The guy trying to sell this as his own
is a scammer lol.

// Inputs
a = input(1, title = "Key Vaule. 'This changes the sensitivity'")
c = input(10, title = "ATR Period")
h = input(false, title = "Signals from Heikin Ashi Candles")

xATR = atr(c)
nLoss = a * xATR

src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead


= false) : close

xATRTrailingStop = 0.0
xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] >
nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss),
iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0),
min(nz(xATRTrailingStop[1]), src + nLoss),
iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss)))

pos = 0
pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src >
nz(xATRTrailingStop[1], 0), 1,
iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -
1, nz(pos[1], 0)))

xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue

ema = ema(src,1)
above = crossover(ema, xATRTrailingStop)
below = crossover(xATRTrailingStop, ema)

buy = src > xATRTrailingStop and above


sell = src < xATRTrailingStop and below

barbuy = src > xATRTrailingStop


barsell = src < xATRTrailingStop

//plotshape(buy, title = "Buy", text = 'Buy', style = shape.labelup, location


= location.belowbar, color= color.green, textcolor = color.white, transp = 0, size
= size.tiny)
//plotshape(sell, title = "Sell", text = 'Sell', style = shape.labeldown, location
= location.abovebar, color= color.red, textcolor = color.white, transp = 0, size
= size.tiny)

barcolor(barbuy ? color.green : na)


barcolor(barsell ? color.red : na)

strategy.entry("long", true, when = buy)


strategy.entry("short", false, when = sell)

You might also like