// TradingView Pine Script
//@version=5
indicator("💹 Multi-Indicator Trading System", shorttitle="Multi-Indicator System", overlay=true)
// Input parameters
ema50_length = input.int(50, title="EMA 50 Length", minval=1)
ema200_length = input.int(200, title="EMA 200 Length", minval=1)
show_signals = input.bool(true, title="Show Buy/Sell Signals")
show_ema_lines = input.bool(true, title="Show EMA Lines")
rr_ratio = input.float(2.0, title="Reward/Risk Ratio", minval=0.5, maxval=10.0, step=0.5)
show_tp_sl = input.bool(true, title="Show TP/SL Lines")
tf_short = input.timeframe("15", title="Short Timeframe (e.g., 15 for 15M)")
tf_higher1 = input.timeframe("60", title="Higher Timeframe 1 (e.g., 60 for 1H)")
tf_higher2 = input.timeframe("240", title="Higher Timeframe 2 (e.g., 240 for 4H)")
lookback_bars = input.int(50, title="Lookback Bars for SL", minval=1)
rsi_period = input.int(14, title="RSI Period", minval=1)
use_tf_higher1 = input.bool(true, title="Use TF1H for Trend Filter")
use_tf_higher2 = input.bool(false, title="Use TF4H for Trend Filter")
use_rsi_conf = input.bool(true, title="Use RSI Confirmation")
use_macd_conf = input.bool(true, title="Use MACD Confirmation")
use_pattern_conf = input.bool(true, title="Use Pattern/Price Action Confirmation")
sideway_threshold = input.float(0.5, title="Sideway Threshold %", minval=0.1, maxval=5.0, step=0.1)
// Calculate EMAs for short timeframe
[ema50_short, ema200_short] = request.security(syminfo.tickerid, tf_short, [ta.ema(close, ema50_length), ta.ema(close, ema200_length)])
// Calculate EMA200 for higher timeframes
ema200_1h = request.security(syminfo.tickerid, tf_higher1, ta.ema(close, ema200_length))
ema200_4h = request.security(syminfo.tickerid, tf_higher2, ta.ema(close, ema200_length))
// MACD on short TF
[macdLine, signalLine, histLine] = request.security(syminfo.tickerid, tf_short, ta.macd(close, 12, 26, 9))
// RSI on short TF
rsi_short = request.security(syminfo.tickerid, tf_short, ta.rsi(close, rsi_period))
// Plot EMA lines for short timeframe
plot(show_ema_lines ? ema50_short : na, color=color.new(color.blue, 20), linewidth=2, title="EMA 50")
plot(show_ema_lines ? ema200_short : na, color=color.new(color.red, 20), linewidth=2, title="EMA 200")
// Define higher TF trend conditions
bullish_trend_1h = close > ema200_1h
bearish_trend_1h = close < ema200_1h
bullish_trend_4h = close > ema200_4h
bearish_trend_4h = close < ema200_4h
// Use higher TF trend filter
use_higher_trend = (use_tf_higher1 and bullish_trend_1h) or (use_tf_higher2 and bullish_trend_4h)
use_lower_trend = (use_tf_higher1 and bearish_trend_1h) or (use_tf_higher2 and bearish_trend_4h)
// Detect sideway market
ema_diff = math.abs(ema50_short - ema200_short) / ema200_short * 100
is_sideway = ema_diff < sideway_threshold
var bool breakout_zone = false
if is_sideway[1] and not is_sideway
breakout_zone := true
else
breakout_zone := false
// Define entry signals on short TF
bullish_cross_base = ta.crossover(ema50_short, ema200_short)
bearish_cross_base = ta.crossunder(ema50_short, ema200_short)
// Pattern/Price Action Confirmation
bullish_engulfing = close > open and close[1] < open[1] and close > open[1] and close[1] < open and volume > ta.sma(volume, 20)
hammer = low == ta.lowest(low, 5) and (close - low) / (high - low) > 0.6 and open > low and close > open
break_high = high > ta.highest(high, 5)
pattern_conf_buy = not use_pattern_conf or (bullish_engulfing or hammer or break_high or breakout_zone)
bearish_engulfing = close < open and close[1] > open[1] and close < open[1] and close[1] > open and volume > ta.sma(volume, 20)
pattern_conf_sell = not use_pattern_conf or (bearish_engulfing or break_high or breakout_zone)
// Momentum confirmation
rsi_conf_buy = not use_rsi_conf or (bullish_cross_base and rsi_short > 50)
rsi_conf_sell = not use_rsi_conf or (bearish_cross_base and rsi_short < 50)
macd_conf_buy = not use_macd_conf or (bullish_cross_base and macdLine > 0)
macd_conf_sell = not use_macd_conf or (bearish_cross_base and macdLine < 0)
// Final entry conditions
bullish_cross_final = bullish_cross_base and use_higher_trend and rsi_conf_buy and macd_conf_buy and pattern_conf_buy
bearish_cross_final = bearish_cross_base and use_lower_trend and rsi_conf_sell and macd_conf_sell and pattern_conf_sell
// Track previous signals to prevent duplicate orders
var bool last_bullish_cross = false
var bool last_bearish_cross = false
// Final entry with duplicate prevention
bullish_cross = bullish_cross_final and not last_bullish_cross
bearish_cross = bearish_cross_final and not last_bearish_cross
// Update last signal status
if bullish_cross
last_bullish_cross := true
last_bearish_cross := false
else if bearish_cross
last_bullish_cross := false
last_bearish_cross := true
else
last_bullish_cross := false
last_bearish_cross := false
// Calculate SMA(1), which is just close
sma1 = request.security(syminfo.tickerid, tf_short, close)
// Calculate wick-based SL
max_sma1 = request.security(syminfo.tickerid, tf_short, ta.highest(sma1, lookback_bars))
min_sma1 = request.security(syminfo.tickerid, tf_short, ta.lowest(sma1, lookback_bars))
// Variables for position management
var float entry_price = na
var float stop_loss = na
var float take_profit = na
var string current_position = "NONE"
var int total_trades = 0
var int winning_trades = 0
var float win_rate = 0.0
// Position management
if current_position == "LONG"
if close >= take_profit
winning_trades := winning_trades + 1
current_position := "NONE"
else if close <= stop_loss
current_position := "NONE"
else if bearish_cross
if close > entry_price
winning_trades := winning_trades + 1
current_position := "NONE"
if current_position == "SHORT"
if close <= take_profit
winning_trades := winning_trades + 1
current_position := "NONE"
else if close >= stop_loss
current_position := "NONE"
else if bullish_cross
if close < entry_price
winning_trades := winning_trades + 1
current_position := "NONE"
// Enter new positions
if current_position == "NONE"
if bullish_cross
entry_price := close
stop_loss := min_sma1
take_profit := entry_price + (entry_price - stop_loss) * rr_ratio
current_position := "LONG"
total_trades := total_trades + 1
else if bearish_cross
entry_price := close
stop_loss := max_sma1
take_profit := entry_price - (stop_loss - entry_price) * rr_ratio
current_position := "SHORT"
total_trades := total_trades + 1
// Calculate win rate
win_rate := total_trades > 0 ? (winning_trades / total_trades) * 100 : 0
// Plot signals
plotshape(show_signals and bullish_cross, title="Buy Signal", location=location.belowbar, style=shape.triangleup, size=size.normal, color=color.new(color.lime, 0), text="🔼 BUY")
plotshape(show_signals and bearish_cross, title="Sell Signal", location=location.abovebar, style=shape.triangledown, size=size.normal, color=color.new(color.red, 0), text="🔽 SELL")
// Plot TP/SL lines
plot(show_tp_sl and not na(entry_price) and current_position != "NONE" ? entry_price : na, title="Entry Price", color=color.new(color.yellow, 0), linewidth=1, style=plot.style_circles)
plot(show_tp_sl and not na(stop_loss) and current_position != "NONE" ? stop_loss : na, title="Stop Loss", color=color.new(color.red, 30), linewidth=1, style=plot.style_circles)
plot(show_tp_sl and not na(take_profit) and current_position != "NONE" ? take_profit : na, title="Take Profit", color=color.new(color.lime, 30), linewidth=1, style=plot.style_circles)
// Alerts
alertcondition(bullish_cross, title="Bullish Signal", message="🚀 Bullish Signal Detected!")
alertcondition(bearish_cross, title="Bearish Signal", message="📉 Bearish Signal Detected!")
// Plot pattern confirmation
plotshape(bullish_engulfing, title="Bullish Engulfing", location=location.belowbar, style=shape.circle, size=size.tiny, color=color.new(color.lime, 0))
plotshape(hammer, title="Hammer", location=location.belowbar, style=shape.triangleup, size=size.tiny, color=color.new(color.lime, 0))
plotshape(break_high, title="Break High", location=location.abovebar, style=shape.triangleup, size=size.tiny, color=color.new(color.lime, 0))
plotshape(breakout_zone, title="Breakout Zone", location=location.abovebar, style=shape.diamond, size=size.tiny, color=color.new(color.yellow, 0))
// Table for dashboard
if barstate.islast
var table info_table = table.new(position.top_right, 2, 16, bgcolor=color.new(color.black, 10), border_width=2, border_color=color.new(color.gray, 50), frame_width=1, frame_color=color.new(color.white, 0))
table.cell(info_table, 0, 0, "📊 TRADING DASHBOARD", text_color=color.new(color.white, 0), bgcolor=color.new(color.blue, 20), text_size=size.normal)
table.cell(info_table, 1, 0, "", bgcolor=color.new(color.blue, 20))
table.cell(info_table, 0, 1, "Current Trend:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 1, ema50_short > ema200_short ? "🟢 BULLISH" : "🔴 BEARISH", text_color=color.new(color.white, 0), bgcolor=ema50_short > ema200_short ? color.new(color.lime, 20) : color.new(color.red, 20), text_size=size.small)
table.cell(info_table, 0, 2, tf_higher1 + " Trend:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 2, bullish_trend_1h ? "🟢 BULLISH" : "🔴 BEARISH", text_color=color.new(color.white, 0), bgcolor=bullish_trend_1h ? color.new(color.lime, 20) : color.new(color.red, 20), text_size=size.small)
table.cell(info_table, 0, 3, tf_higher2 + " Trend:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 3, bullish_trend_4h ? "🟢 BULLISH" : "🔴 BEARISH", text_color=color.new(color.white, 0), bgcolor=bullish_trend_4h ? color.new(color.lime, 20) : color.new(color.red, 20), text_size=size.small)
table.cell(info_table, 0, 4, "EMA 50:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 4, str.tostring(ema50_short, "#.##"), text_color=color.new(color.blue, 0), bgcolor=color.new(color.white, 0), text_size=size.small)
table.cell(info_table, 0, 5, "EMA 200:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 5, str.tostring(ema200_short, "#.##"), text_color=color.new(color.red, 0), bgcolor=color.new(color.white, 0), text_size=size.small)
table.cell(info_table, 0, 6, "RR Ratio:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 6, str.tostring(rr_ratio, "#.##"), text_color=color.new(color.yellow, 0), bgcolor=color.new(color.white, 0), text_size=size.small)
table.cell(info_table, 0, 7, "Lookback Bars:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 7, str.tostring(lookback_bars), text_color=color.new(color.yellow, 0), bgcolor=color.new(color.white, 0), text_size=size.small)
table.cell(info_table, 0, 8, "Win Rate:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 8, str.tostring(win_rate, "#.##") + "% (" + str.tostring(winning_trades) + "/" + str.tostring(total_trades) + ")", text_color=color.new(color.white, 0), bgcolor=win_rate >= 60 ? color.new(color.lime, 20) : win_rate >= 40 ? color.new(color.orange, 20) : color.new(color.red, 20), text_size=size.small)
table.cell(info_table, 0, 9, "Position:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 9, current_position == "NONE" ? "💤 No Position" : current_position == "LONG" ? "📈 LONG" : "📉 SHORT", text_color=color.new(color.white, 0), bgcolor=current_position == "LONG" ? color.new(color.lime, 20) : current_position == "SHORT" ? color.new(color.red, 20) : color.new(color.gray, 50), text_size=size.small)
table.cell(info_table, 0, 10, "Entry Price:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 10, current_position != "NONE" and not na(entry_price) ? str.tostring(entry_price, "#.##") : "---", text_color=color.new(color.yellow, 0), bgcolor=color.new(color.white, 0), text_size=size.small)
table.cell(info_table, 0, 11, "RSI Period:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 11, str.tostring(rsi_period), text_color=color.new(color.yellow, 0), bgcolor=color.new(color.white, 0), text_size=size.small)
table.cell(info_table, 0, 12, "RSI Conf:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 12, use_rsi_conf ? "Enabled" : "Disabled", text_color=color.new(color.white, 0), bgcolor=color.new(color.black, 0), text_size=size.small)
table.cell(info_table, 0, 13, "MACD Conf:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 13, use_macd_conf ? "Enabled" : "Disabled", text_color=color.new(color.white, 0), bgcolor=color.new(color.black, 0), text_size=size.small)
table.cell(info_table, 0, 14, "Pattern Conf:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 14, use_pattern_conf ? "Enabled" : "Disabled", text_color=color.new(color.white, 0), bgcolor=color.new(color.black, 0), text_size=size.small)
table.cell(info_table, 0, 15, "TF1H Used:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
table.cell(info_table, 1, 15, use_tf_higher1 ? "Yes" : "No", text_color=color.new(color.white, 0), bgcolor=color.new(color.black, 0), text_size=size.small)
Overview
Signals trigger when a short-timeframe EMA crossover aligns with higher timeframe trend filters from 1-hour or 4-hour charts. It includes optional confirmation modules for RSI, MACD, and price action patterns such as engulfing candles or breakouts. Settings adjust timeframes, confirmation toggles, sideways thresholds, and risk-reward projections. Multi-timeframe security requests without offsets may repaint on the live bar.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
EMA 50 Length
int
50
ema50_length
EMA 200 Length
int
200
ema200_length
Show Buy/Sell Signals
bool
true
show_signals
Show EMA Lines
bool
true
show_ema_lines
Reward/Risk Ratio
float
2.0
rr_ratio
Show TP/SL Lines
bool
true
show_tp_sl
Short Timeframe (e.g., 15 for 15M)
timeframe
15
tf_short
Higher Timeframe 1 (e.g., 60 for 1H)
timeframe
60
tf_higher1
Higher Timeframe 2 (e.g., 240 for 4H)
timeframe
240
tf_higher2
Lookback Bars for SL
int
50
lookback_bars
RSI Period
int
14
rsi_period
Use TF1H for Trend Filter
bool
true
use_tf_higher1
Show all 17 settings
Setting
Type
Default
Variable
Use TF4H for Trend Filter
bool
false
use_tf_higher2
Use RSI Confirmation
bool
true
use_rsi_conf
Use MACD Confirmation
bool
true
use_macd_conf
Use Pattern/Price Action Confirmation
bool
true
use_pattern_conf
Sideway Threshold %
float
0.5
sideway_threshold
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This indicator identifies candlestick patterns on the price chart by combining price action with momentum factors and trend filters. It calculates one of four selectable oscillators: Karobein Oscillator, Money Flow Index, RSI, or Stochastic, alongside trend ru
This indicator overlays on the price chart and provides trend and momentum analysis. It calculates and plots three exponential moving averages with fixed periods of 20, 50, and 200 using yellow, orange, and blue colors respectively. The script also computes th
Advanced Scalping EMA & RSI Strategy is an overlay indicator that combines fast and smooth moving averages with RSI levels and candlestick patterns to generate scalping signals. Users can select calculation methods for moving averages, such as SMA, EMA, WMA, o
The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma
Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a
TradersPost Trading Checklist is an overlay indicator that evaluates a suite of popular technical conditions for long and short trade setups. It checks session-anchored VWAP, fast and slow EMA alignments and crosses, 200 SMA, RSI overbought or oversold conditi