100% found this document useful (1 vote)
22K views1 page

Gainz Algo v2 Alpha Script

The document outlines the Custom Gainz Algo v2 Alpha, a trading indicator implemented in Pine Script. It utilizes Exponential Moving Averages (EMAs) and Average True Range (ATR) to determine market trends and generate buy and sell signals. The script also includes functionality for trailing stop placements based on market conditions.

Uploaded by

rolandagali2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
22K views1 page

Gainz Algo v2 Alpha Script

The document outlines the Custom Gainz Algo v2 Alpha, a trading indicator implemented in Pine Script. It utilizes Exponential Moving Averages (EMAs) and Average True Range (ATR) to determine market trends and generate buy and sell signals. The script also includes functionality for trailing stop placements based on market conditions.

Uploaded by

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

Custom Gainz Algo v2 Alpha - Pine Script

//@version=5
indicator("Custom Gainz Algo v2 Alpha", overlay=true)

// - INPUTS -
fastLength = input.int(14, title="Fast EMA Length")
slowLength = input.int(50, title="Slow EMA Length")
atrLength = input.int(14, title="ATR Length")
mult = input.float(1.5, title="ATR Multiplier", step=0.1)

// - INDICATORS -
emaFast = ta.ema(close, fastLength)
emaSlow = ta.ema(close, slowLength)
atr = ta.atr(atrLength)

// - TREND LOGIC -
bullTrend = emaFast > emaSlow
bearTrend = emaFast < emaSlow

// - ENTRY SIGNALS -
buySignal = ta.crossover(emaFast, emaSlow)
sellSignal = ta.crossunder(emaFast, emaSlow)

// - TRAILING STOP -
longStop = close - atr * mult
shortStop = close + atr * mult

// - PLOT EMAS -
plot(emaFast, color=color.teal, title="Fast EMA")
plot(emaSlow, color=color.orange, title="Slow EMA")

// - PLOT SIGNALS -
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green,
style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red,
style=shape.labeldown, text="SELL")

// - PLOT STOPS -
plot(bullTrend ? longStop : na, title="Long Stop", color=color.green,
style=plot.style_linebr)
plot(bearTrend ? shortStop : na, title="Short Stop", color=color.red,
style=plot.style_linebr)

You might also like