Indicator · Pine Script v5 · On the chart

Multi-Indicator Trading System

by rmtsu9

Multi-Indicator Trading System is a price chart overlay indicator that combines exponential moving averages, MACD, RSI, and multi-timeframe Ichimoku cloud analysis.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code192
Settings12inputs
LicenceMIT
Last update1 year ago3 Jul 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

192 lines of Pine Script v5 from EMARSIMACD.DemoV1.txt, published under MIT. Keep the author's credit and licence lines when you reuse it.

EMARSIMACD.DemoV1.txt
// 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_1h = input.timeframe("30", title="Higher Timeframe 1 (e.g., 30 for 30M)")
tf_4h = input.timeframe("240", title="Higher Timeframe 2 (e.g., 240 for 4H)")
lookback_bars = input.int(50, title="Lookback Bars for SL", minval=1)

// New inputs for indicator combinations
entry_signal_type = input.string("MACD+RSI", title="Entry Signal Type", options=["MACD+RSI", "Ichimoku+MACD"])
use_macd_hist = input.bool(true, title="Use MACD Histogram Confirmation")
use_rsi = input.bool(true, title="Use RSI Confirmation")

// Calculate EMAs for current timeframe
ema50 = ta.ema(close, ema50_length)
ema200 = ta.ema(close, ema200_length)

// Manual Ichimoku calculation for current TF
tenkan_period = 9
kijun_period = 26
senkou_period = 52
tenkan = (ta.highest(high, tenkan_period) + ta.lowest(low, tenkan_period)) / 2
kijun = (ta.highest(high, kijun_period) + ta.lowest(low, kijun_period)) / 2
senkouA = (tenkan + kijun) / 2
senkouB = (ta.highest(high, senkou_period) + ta.lowest(low, senkou_period)) / 2
chikou = close[26]

// MACD on current TF
[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)

// RSI on current TF
rsi = ta.rsi(close, 14)

// Request Ichimoku components from higher timeframes
[tenkan_1h, kijun_1h, senkouA_1h, senkouB_1h] = request.security(syminfo.tickerid, tf_1h, [(ta.highest(high, tenkan_period) + ta.lowest(low, tenkan_period)) / 2, (ta.highest(high, kijun_period) + ta.lowest(low, kijun_period)) / 2, ((ta.highest(high, tenkan_period) + ta.lowest(low, tenkan_period)) / 2 + (ta.highest(high, kijun_period) + ta.lowest(low, kijun_period)) / 2) / 2, (ta.highest(high, senkou_period) + ta.lowest(low, senkou_period)) / 2])
[tenkan_4h, kijun_4h, senkouA_4h, senkouB_4h] = request.security(syminfo.tickerid, tf_4h, [(ta.highest(high, tenkan_period) + ta.lowest(low, tenkan_period)) / 2, (ta.highest(high, kijun_period) + ta.lowest(low, kijun_period)) / 2, ((ta.highest(high, tenkan_period) + ta.lowest(low, tenkan_period)) / 2 + (ta.highest(high, kijun_period) + ta.lowest(low, kijun_period)) / 2) / 2, (ta.highest(high, senkou_period) + ta.lowest(low, senkou_period)) / 2])

// Plot EMA lines for current timeframe
plot(show_ema_lines ? ema50 : na, color=color.new(color.blue, 20), linewidth=2, title="EMA 50")
plot(show_ema_lines ? ema200 : na, color=color.new(color.red, 20), linewidth=2, title="EMA 200")

// Define higher TF trend conditions (Ichimoku)
bullish_trend_1h = close > math.max(senkouA_1h, senkouB_1h)
bearish_trend_1h = close < math.min(senkouA_1h, senkouB_1h)
bullish_trend_4h = close > math.max(senkouA_4h, senkouB_4h)
bearish_trend_4h = close < math.min(senkouA_4h, senkouB_4h)

// Define entry signals
macd_buy = ta.crossover(macdLine, signalLine)
macd_sell = ta.crossunder(macdLine, signalLine)
tenkan_kijun_buy = ta.crossover(tenkan, kijun)
tenkan_kijun_sell = ta.crossunder(tenkan, kijun)

// Track previous signals to prevent duplicate orders
var bool last_bullish_cross = false
var bool last_bearish_cross = false

// Final entry conditions
bullish_cross = (entry_signal_type == "MACD+RSI" and macd_buy and (not use_rsi or (rsi > 50 or ta.crossover(rsi, 30))) and bullish_trend_1h and bullish_trend_4h and (not use_macd_hist or histLine > 0) and not last_bullish_cross) or (entry_signal_type == "Ichimoku+MACD" and tenkan_kijun_buy and bullish_trend_1h and bullish_trend_4h and (not use_macd_hist or histLine > 0) and not last_bullish_cross)

bearish_cross = (entry_signal_type == "MACD+RSI" and macd_sell and (not use_rsi or (rsi < 50 or ta.crossunder(rsi, 70))) and bearish_trend_1h and bearish_trend_4h and (not use_macd_hist or histLine < 0) and not last_bearish_cross) or (entry_signal_type == "Ichimoku+MACD" and tenkan_kijun_sell and bearish_trend_1h and bearish_trend_4h and (not use_macd_hist or histLine < 0) 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 = close

// Calculate wick-based SL
max_sma1 = ta.highest(sma1, lookback_bars)
min_sma1 = 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!")

// Table for dashboard
if barstate.islast
    var table info_table = table.new(position.top_right, 2, 13, 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 > ema200 ? "🟢 BULLISH" : "🔴 BEARISH", text_color=color.new(color.white, 0), bgcolor=ema50 > ema200 ? color.new(color.lime, 20) : color.new(color.red, 20), text_size=size.small)
    
    table.cell(info_table, 0, 2, tf_1h + " 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_4h + " 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, "#.##"), 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, "#.##"), 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, "Entry Signal:", text_color=color.new(color.white, 0), bgcolor=color.new(color.gray, 70), text_size=size.small)
    table.cell(info_table, 1, 11, entry_signal_type, text_color=color.new(color.white, 0), bgcolor=color.new(color.black, 0), text_size=size.small)
    
    table.cell(info_table, 0, 12, "MACD Hist 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_macd_hist ? "Enabled" : "Disabled", text_color=color.new(color.white, 0), bgcolor=color.new(color.black, 0), text_size=size.small)

Overview

Multi-Indicator Trading System evaluates local timeframe indicators alongside higher timeframe trend filters to generate buy and sell signal labels. Users can choose between signal mode combinations like MACD with RSI or Ichimoku with MACD, modify higher timeframes, and plot target risk-to-reward stop-loss and take-profit levels directly on the chart.

Details

Published by

rmtsu9 on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

M15-H1, H4 and above

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
EMA 50 Lengthint50ema50_length
EMA 200 Lengthint200ema200_length
Show Buy/Sell Signalsbooltrueshow_signals
Show EMA Linesbooltrueshow_ema_lines
Reward/Risk Ratiofloat2.0rr_ratio
Show TP/SL Linesbooltrueshow_tp_sl
Higher Timeframe 1 (e.g., 30 for 30M)timeframe30tf_1h
Higher Timeframe 2 (e.g., 240 for 4H)timeframe240tf_4h
Lookback Bars for SLint50lookback_bars
Entry Signal TypestringMACD+RSIentry_signal_type
Use MACD Histogram Confirmationbooltrueuse_macd_hist
Use RSI Confirmationbooltrueuse_rsi
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.

Similar Pine Scripts

BTE Acc AO SMIO

by f-cksociety
11 stars

This script provides an indicator-based backtesting engine framework that simulates trade entries, exits, and filtering directly on the price chart. It evaluates selected entry rules and multi-layered filters, including moving average trends, volume increases,

Indicator v5 TrendOscillators & momentum
Updated 4 years ago · MPL-2.0 GitHub repository of BTE Acc AO SMIO
5 stars

This indicator combines pivot-based support and resistance levels with multi-timeframe MACD crossovers and a higher-timeframe exponential moving average trend filter. It identifies support and resistance touches using pivot highs and lows within a user-defined

Indicator v4 Oscillators & momentumSupport & resistance Repaints
Updated 3 years ago · Apache-2.0 GitHub repository of MACD + Support / Resistance

This overlay indicator plots Central Pivot Range levels and bands across yearly, quarterly, monthly, weekly, daily, and six-hour periods. Each timeframe can be shown or hidden, and pivot and band colors are set separately. It also marks MACD momentum and EMA t

Indicator v5 Support & resistanceOscillators & momentum
Updated 3 years ago · None stated GitHub repository of Pivot Boss Multi Timeframe CPR with MACD and EMA

GemHunter v4

by Finland93
4 stars

GemHunter v4 classifies market conditions into bullish, bearish, or neutral regimes using a multi-indicator voting system. It combines exponential moving average alignment, MACD momentum, and RSI strength, optionally gated by ADX trend strength and higher-time

Indicator v6 TrendOscillators & momentum
Updated 4 months ago · MPL-2.0 GitHub repository of GemHunter v4

Xiaotang System V5.0

by TUSKIJAY
4 stars

Xiaotang System V5.0 is a price-chart overlay indicator that identifies momentum breakouts across moving averages and session VWAP. It computes Heikin-Ashi price data, 50-period and 200-period SMAs, and intraday VWAP while monitoring 5-minute higher-timeframe

Indicator v5 TrendOscillators & momentum Repaints
Updated 3 days ago · None stated GitHub repository of Xiaotang System V5.0

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers