✅ 📋 Full Feature List of the Strategy Script
Feature Description
Shows trend direction using ATR and multiplier
settings.
1. Supertrend Indicator
Green = Uptrend, Red = Downtrend.
Avoids buying in overbought or selling in
oversold zones
2. RSI Filter
(default 70/30 levels).
Confirms the trend direction for safer entries.
Only Buy
3. 200 EMA Confirmation
above EMA / Sell below EMA.
Shown directly on the chart using green/red
labels when all
4. Buy/Sell Signals conditions match.
Alert conditions are set for both buy and sell
entries so you
5. Buy/Sell Alerts
can get real-time push/email alerts.
6. Multi-Level Stop Loss (SL1, Choose from 1%, 2%, or 3% stop loss based on your
risk.
SL2, SL3) You can enable one at a time.
7. Multi-Level Take Profit (TP1, Four TP levels like 1%, 2%, 3%, and 4% to secure
profits in
TP2, TP3, TP4) parts or fully.
8. Backtesting Capability Full strategy logic with strategy() functions – you can
backtest
your setup with live PnL results.
Change Supertrend length, RSI levels, SL/TP
percentages,
9. Customizable Inputs etc., from the settings menu.
No leverage assumed, can be used on crypto,
forex, stocks,
10. Spot and Futures Compatible or futures charts.
All indicators, SL, TP lines, and entries are
visualized
11. Clean Chart UI clearly on your chart.
Real-time alerts trigger with your chosen
condition
12. Alerts
(Buy/Sell) – useful for automation.
How to Add the Script to Your Chart in TradingView
🔹 Step 1: Open Pine Editor
• Open TradingView
• Choose any chart (e.g., BTC/USDT or EUR/USD)
• Scroll down and click on the “Pine Editor” tab
🔹 Step 2: Paste the Script
• Paste the full Pine Script code that I gave you
• Click on ✅ Add to Chart
• If there are no errors, the strategy will be applied instantly
🔹 Step 3: Enable Strategy Tester
Click the Strategy Tester tab below your chart
You'll now see:
o Net Profit o
Win
Rate o
Trade
so
Draw
down o
Equit
y Curve
o Trade List
(entry/exit/P
nL)
⚙️ Recommended Settings for This Strategy
Setting Recommended Value Description
Supertrend Length 10 Controls sensitivity
Supertrend Multiplier 3 Higher value = fewer signals
RSI Length 14 Default RSI setting
Overbought/oversold levels 70 / 30 Used to avoid false signals
EMA Period 200 Trend confirmation
TP1–TP4 (%) 1%, 2%, 3%, 4% You can adjust as needed
SL1–SL3 (%) 1%, 2%, 3% Only one should be enabled at a time
Alerts Enabled Receive notifications for
Buy/Sell
🚨 How to Set Up Alerts
1. On the top bar, click "Alerts"
2. Click + Create Alert
3. In the condition dropdown, choose:
o "Strategy Alert" from the script name
4. Set your desired alert type:
o Notify on app o Show pop-up o Email
o Webhook (for bots)
5. Click Create
️Pro Tips for Use
✅ Best Timeframes for Accurate Signals:
️Timeframe Suitability Why
15-Minute (M15) ⭐ Recommended Enough price action + less noise than M1/M5.
Great for scalping & intraday.
30-Minute (M30) ✅ Very Stable Good balance between noise filtering and
signal frequency.
1-Hour (H1) ✅ High Accuracy Ideal for intraday swing trades. Fewer but
stronger signals.
4-Hour (H4) � Pro-Level Stronger confirmations, especially for swing
traders. Good for major pairs.
5-Minute (M5) ⚠� Use with Caution Works, but more noise. Only if you're an
experienced scalper.
📌 Final Recommendation:
For most traders, use on:
15M or 30M = If you want faster signals & more action
1H or 4H = If you want higher accuracy & fewer fakeouts
💡 Tip: Backtest on your favorite pair across 15M, 30M, and 1H to find your best
sweet spot!
• ✅ Use on 1H or 4H timeframes for better accuracy in swing or day trading
• 🔍 Backtest on specific pairs you trade (BTC/USDT, Gold, EUR/USD, etc.)
• �Only risk 1-2% per trade using SL features
• 📊 For scalping, use lower timeframes (5m, 15m) and tighter SL/TP
• 💡 Always test first in Paper Trading or Demo Account
Code
//@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')