Gainz Algo V2 Alpha Free Download
Click here to Download
Or Copy Direct
//@version=5
indicator('GainzAlgo V2 Alpha [Improved Indicator]', overlay=true)
// === INPUTS ===
show_tp_sl = input.bool(true, 'Display TP & SL')
rrr = input.string('1:2', 'Risk to Reward Ratio', options=['1:1','1:2','1:3','1:4'])
tp_sl_mult = input.float(1.0, 'TP/SL Multiplier')
tp_sl_prec = input.int(2, 'TP/SL Precision')
disable_repeating = input.bool(true, 'Disable Repeating Signals')
rsi_threshold = input.int(80, 'RSI Threshold')
candle_delta_len = input.int(10, 'Candle Delta Length')
// === LABEL STYLE ===
label_style = input.string('text bubble', 'Label Style', options=['text bubble','triangle','arrow'])
buy_label_color = input.color(color.green, 'BUY Label Color')
sell_label_color = input.color(color.red, 'SELL Label Color')
label_text_color = input.color(color.white, 'Label Text Color')
// === INDICATORS ===
rsi = ta.rsi(close, 14)
atr = ta.atr(14)
stable_candle = math.abs(close - open) / ta.tr > 0.7
// === CONDITIONS ===
bullish_engulfing = close[1] < open[1] and close > open and close > open[1]
bearish_engulfing = close[1] > open[1] and close < open and close < open[1]
rsi_below = rsi < rsi_threshold
rsi_above = rsi > 100 - rsi_threshold
price_decrease = close < close[candle_delta_len]
price_increase = close > close[candle_delta_len]
var string last_signal = ''
var float tp = na
var float sl = na
buy_condition = bullish_engulfing and stable_candle and rsi_below and price_decrease
sell_condition = bearish_engulfing and stable_candle and rsi_above and price_increase
can_buy = buy_condition and (disable_repeating ? last_signal != 'buy' : true)
can_sell = sell_condition and (disable_repeating ? last_signal != 'sell' : true)
// === ROUND FUNCTION ===
round_up(val, dec) =>
factor = math.pow(10, dec)
math.ceil(val * factor) / factor
// === BUY EXECUTION ===
if can_buy
last_signal := 'buy'
dist = atr * tp_sl_mult
tp_val = rrr == '1:1' ? dist : rrr == '1:2' ? dist * 2 : rrr == '1:3' ? dist * 3 : dist * 4
tp := round_up(close + tp_val, tp_sl_prec)
sl := round_up(close - dist, tp_sl_prec)
// Labels
if label_style == 'text bubble'
label.new(bar_index, low, 'BUY', style=label.style_label_up, color=buy_label_color, textcolor=label_text_color)
else if label_style == 'triangle'
label.new(bar_index, low, 'BUY', yloc=yloc.belowbar, style=label.style_triangleup, color=buy_label_color, textcolor=label_text_color)
else
label.new(bar_index, low, 'BUY', yloc=yloc.belowbar, style=label.style_arrowup, color=buy_label_color, textcolor=label_text_color)
if show_tp_sl
label.new(bar_index, low, 'TP: ' + str.tostring(tp) + '\nSL: ' + str.tostring(sl), textcolor=label_text_color)
// === SELL EXECUTION ===
if can_sell
last_signal := 'sell'
dist = atr * tp_sl_mult
tp_val = rrr == '1:1' ? dist : rrr == '1:2' ? dist * 2 : rrr == '1:3' ? dist * 3 : dist * 4
tp := round_up(close - tp_val, tp_sl_prec)
sl := round_up(close + dist, tp_sl_prec)
// Labels
if label_style == 'text bubble'
label.new(bar_index, high, 'SELL', style=label.style_label_down, color=sell_label_color, textcolor=label_text_color)
else if label_style == 'triangle'
label.new(bar_index, high, 'SELL', yloc=yloc.abovebar, style=label.style_triangledown, color=sell_label_color, textcolor=label_text_color)
else
label.new(bar_index, high, 'SELL', yloc=yloc.abovebar, style=label.style_arrowdown, color=sell_label_color, textcolor=label_text_color)
if show_tp_sl
label.new(bar_index, high, 'TP: ' + str.tostring(tp) + '\nSL: ' + str.tostring(sl), textcolor=label_text_color)
// === PLOTS FOR TP & SL ===
plotshape(can_buy, title='Buy Signal', location=location.belowbar, color=color.green, style=shape.labelup, text='BUY')
plotshape(can_sell, title='Sell Signal', location=location.abovebar, color=color.red, style=shape.labeldown, text='SELL')
plot(tp, 'TP', color=color.green, style=plot.style_circles)
plot(sl, 'SL', color=color.red, style=plot.style_circles)
// === ALERTS ===
alertcondition(can_buy, title='BUY Signal', message='GainzAlgo Indicator: BUY Signal')
alertcondition(can_sell, title='SELL Signal', message='GainzAlgo Indicator: SELL Signal')