Indicator · Pine Script v5 · On the chart

MTF EFI

by g-moe· code credited to goodgains

This indicator calculates Elder's Force Index (EFI) across multiple configurable timeframes and displays resulting signals directly on the price chart.

View on GitHub

Repaints

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code514
Settings40inputs
LicenceNone statedfile: MPL-2.0
Last update5 months ago27 May 2026

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

514 lines of Pine Script v5 from Tradingview/mtf-efi.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

mtf-efi.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains


//@version=5
indicator("MTF EFI", overlay=true)

// @keywords: mtf-efi, elder-force-index, multi-timeframe, volume-force, efi-oscillator, mtf-signals, ma-filter, buy-sell-thresholds, ema-smoothing, strategy-entries, ten-timeframes, efi-length, force-index, crossover-signals, continuous-mode, inverse-signals, profit-target, stop-loss, session-filter, overlay-indicator

// efi most have volume
var cumVol = 0.
cumVol += nz(volume)
if barstate.islast and cumVol == 0
    runtime.error("No volume is provided by the data vendor.")


// efi settings
efi_length = input.int(13, title = 'EFI Length',
 group = 'EFI Settings')

efi_type = input.string("EMA", title = 'EFI Smoothing',
 options = ['EMA', 'SMA', 'VWMA', 'RMA', 'HMA'],
 group = 'EFI Settings')


// signal settings
use_tf1 = input.bool(false, title = '', group='Signal Settings', inline = '1')
tf1 = input.timeframe("1", title = "", group='Signal Settings', inline = '1',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy1 = input.int(0, title = '', group='Signal Settings', inline = '1')
_efisell1 = input.int(0, title = '', group='Signal Settings', inline = '1')

use_tf2 = input.bool(false, title = '', group='Signal Settings', inline = '2')
tf2 = input.timeframe("3", title = "", group='Signal Settings', inline = '2',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy2 = input.int(0, title = '', group='Signal Settings', inline = '2')
_efisell2 = input.int(0, title = '', group='Signal Settings', inline = '2')

use_tf3 = input.bool(false, title = '', group='Signal Settings', inline = '3')
tf3 = input.timeframe("5", title = "", group='Signal Settings', inline = '3',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy3 = input.int(0, title = '', group='Signal Settings', inline = '3')
_efisell3 = input.int(0, title = '', group='Signal Settings', inline = '3')

use_tf4 = input.bool(true, title = '', group='Signal Settings', inline = '4')
tf4 = input.timeframe("15", title = "", group='Signal Settings', inline = '4',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy4 = input.int(0, title = '', group='Signal Settings', inline = '4')
_efisell4 = input.int(0, title = '', group='Signal Settings', inline = '4')

use_tf5 = input.bool(true, title = '', group='Signal Settings', inline = '5')
tf5 = input.timeframe("30", title = "", group='Signal Settings', inline = '5',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy5 = input.int(0, title = '', group='Signal Settings', inline = '5')
_efisell5 = input.int(0, title = '', group='Signal Settings', inline = '5')

use_tf6 = input.bool(true, title = '', group='Signal Settings', inline = '6')
tf6 = input.timeframe("60", title = "", group='Signal Settings', inline = '6',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy6 = input.int(0, title = '', group='Signal Settings', inline = '6')
_efisell6 = input.int(0, title = '', group='Signal Settings', inline = '6')

use_tf7 = input.bool(true, title = '', group='Signal Settings', inline = '7')
tf7 = input.timeframe("120", title = "", group='Signal Settings', inline = '7',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy7 = input.int(0, title = '', group='Signal Settings', inline = '7')
_efisell7 = input.int(0, title = '', group='Signal Settings', inline = '7')

use_tf8 = input.bool(false, title = '', group='Signal Settings', inline = '8')
tf8 = input.timeframe("180", title = "", group='Signal Settings', inline = '8',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy8 = input.int(0, title = '', group='Signal Settings', inline = '8')
_efisell8 = input.int(0, title = '', group='Signal Settings', inline = '8')

use_tf9 = input.bool(false, title = '', group='Signal Settings', inline = '9')
tf9 = input.timeframe("240", title = "", group='Signal Settings', inline = '9',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy9 = input.int(0, title = '', group='Signal Settings', inline = '9')
_efisell9 = input.int(0, title = '', group='Signal Settings', inline = '9')

use_tf10 = input.bool(false, title = '', group='Signal Settings', inline = '10')
tf10 = input.timeframe("D", title = "", group='Signal Settings', inline = '10',
 tooltip = 'If the selected timeframe is less than the chart timeframe then it will cause a runtime error.')
_efibuy10 = input.int(0, title = '', group='Signal Settings', inline = '10')
_efisell10 = input.int(0, title = '', group='Signal Settings', inline = '10')


use_ma_filter1 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '1')
use_ma_filter2 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '2')
use_ma_filter3 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '3')
use_ma_filter4 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '4')
use_ma_filter5 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '5')
use_ma_filter6 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '6')
use_ma_filter7 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '7')
use_ma_filter8 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '8')
use_ma_filter9 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '9')
use_ma_filter10 = input.bool(false, title = "MA Filt", group = "Signal Settings", inline = '10')

ma_type = input.string(title = "MA Type/Filter", defval = "SMA", options=['EMA', 'SMA', 'VWMA', 'RMA', 'HMA'], group="Signal Settings", inline = '11')
ma_filter_length = input.int(50, minval = 1, title = "", group = "Signal Settings", inline = '11')


// trading settings
useStrategyStart = input.bool(false, title = " ", group = "Trade Settings", inline = '1')
strategy_start = input.time(timestamp("01 January 2021 00:00:00 UTC-5"), "Strategy Start Date",
 group = "Trade Settings", inline = '1')

useStrategyEnd = input.bool(false, title = " ", group = "Trade Settings", inline = '2')
strategy_end = input.time(timestamp("01 January 2022 00:00:00 UTC-5"), "Strategy End Date  ",
 group = "Trade Settings", inline = '2')

useTradingHours = input.bool(false, title = " ", group = "Trade Settings", inline = '3')
trading_time = input.session("0930-1600", title = "Trading Time",
 tooltip = "This uses Eastern Time Zone or U.S. NY Market Hours.", group = "Trade Settings", inline = '3')
trading_hours_cond = not useTradingHours or time("",trading_time, "America/New_York")

long_trades = input.bool(true, title = "Long Trades" , group = "Trade Settings", inline = '5')
short_trades = input.bool(true, title = "Short Trades", group = "Trade Settings", inline = '5')
// trade_to_trade = input.bool(false, title = 'Trade to Trade', group = "Trade Settings", inline = '6')
inverse_signals = input.bool(false, title = "Inverse Signals", group = "Trade Settings", inline = '6')
continous_mode = input.bool(false, title = 'Continuous Mode', group = "Trade Settings", inline = '6')

use_tp = input.bool(false, title = 'Target          ', group = 'Trade Settings', inline = '7')
tp_amount = input.float(0.50, title = '', group = 'Trade Settings', inline = '7')
tp_type = input.string('Percent', title = '', options = ['Percent', 'Price'], group = 'Trade Settings', inline = '7')

use_sl = input.bool(false, title = 'Stop Loss      ', group = 'Trade Settings', inline = '8')
sl_amount = input.float(0.50, title = '', group = 'Trade Settings', inline = '8')
sl_type = input.string('Percent', title = '', options = ['Percent', 'Price'], group = 'Trade Settings', inline = '8')


// error checking
if barstate.isfirst and timeframe.in_seconds() > 
 math.min(timeframe.in_seconds(use_tf1 ? tf1 : "Y"), 
  timeframe.in_seconds(use_tf2 ? tf2 : "Y"),
  timeframe.in_seconds(use_tf3 ? tf3 : "Y"),
  timeframe.in_seconds(use_tf4 ? tf4 : "Y"),
  timeframe.in_seconds(use_tf5 ? tf5 : "Y"),
  timeframe.in_seconds(use_tf6 ? tf6 : "Y"),
  timeframe.in_seconds(use_tf7 ? tf7 : "Y"),
  timeframe.in_seconds(use_tf8 ? tf8 : "Y"),
  timeframe.in_seconds(use_tf9 ? tf9 : "Y"),
  timeframe.in_seconds(use_tf10 ? tf10 : "Y"))
    runtime.error("One of your selected timeframes is less than the main chart. This is not allowed.")


// efi function
f_efi(calc_bool) =>
    var float efi_value = na
    var float high_efi_value = na
    var float low_efi_value = na
    if calc_bool
        efi_value := switch efi_type
            "EMA" => math.round(ta.ema(ta.change(close[1]) * volume[1], efi_length),0)
            "SMA" => math.round(ta.sma(ta.change(close[1]) * volume[1], efi_length),0)
            "VWMA" => math.round(ta.vwma(ta.change(close[1]) * volume[1], efi_length),0)
            "RMA" => math.round(ta.rma(ta.change(close[1]) * volume[1], efi_length),0)
            "HMA" => math.round(ta.hma(ta.change(close[1]) * volume[1], efi_length),0)

        high_efi_value := ta.highest(volume[1],2000)
        low_efi_value := ta.lowest(volume[1],2000)

    [efi_value, high_efi_value, low_efi_value]


// ma function
f_ma(calc_bool) =>
    var float ma_value = na
    var int return_bool = 0
    if calc_bool
        ma_value := switch ma_type
            "EMA" => ta.ema(close[1], ma_filter_length)
            "SMA" => ta.sma(close[1], ma_filter_length)
            "VWMA" => ta.vwma(close[1], ma_filter_length)
            "RMA" => ta.rma(close[1], ma_filter_length)
            "HMA" => ta.hma(close[1], ma_filter_length)

        return_bool := close[1] > ma_value ? 1 : close[1] < ma_value ? -1 : 0
    [return_bool, ma_value]


// call efi function
[efi_tf1, high_efi_tf1, low_efi_tf1] = request.security(syminfo.ticker, tf1, f_efi(use_tf1), lookahead = barmerge.lookahead_on)
[efi_tf2, high_efi_tf2, low_efi_tf2]  = request.security(syminfo.ticker, tf2, f_efi(use_tf2), lookahead = barmerge.lookahead_on)
[efi_tf3, high_efi_tf3, low_efi_tf3]  = request.security(syminfo.ticker, tf3, f_efi(use_tf3), lookahead = barmerge.lookahead_on)
[efi_tf4, high_efi_tf4, low_efi_tf4]  = request.security(syminfo.ticker, tf4, f_efi(use_tf4), lookahead = barmerge.lookahead_on)
[efi_tf5, high_efi_tf5, low_efi_tf5]  = request.security(syminfo.ticker, tf5, f_efi(use_tf5), lookahead = barmerge.lookahead_on)
[efi_tf6, high_efi_tf6, low_efi_tf6]  = request.security(syminfo.ticker, tf6, f_efi(use_tf6), lookahead = barmerge.lookahead_on)
[efi_tf7, high_efi_tf7, low_efi_tf7]  = request.security(syminfo.ticker, tf7, f_efi(use_tf7), lookahead = barmerge.lookahead_on)
[efi_tf8, high_efi_tf8, low_efi_tf8]  = request.security(syminfo.ticker, tf8, f_efi(use_tf8), lookahead = barmerge.lookahead_on)
[efi_tf9, high_efi_tf9, low_efi_tf9]  = request.security(syminfo.ticker, tf9, f_efi(use_tf9), lookahead = barmerge.lookahead_on)
[efi_tf10, high_efi_tf10, low_efi_tf10]  = request.security(syminfo.ticker, tf10, f_efi(use_tf10), lookahead = barmerge.lookahead_on)


// call ma function
[ma_tf1, ma_value1] = request.security(syminfo.ticker, tf1, f_ma(use_tf1 and use_ma_filter1), lookahead = barmerge.lookahead_on)
[ma_tf2, ma_value2] = request.security(syminfo.ticker, tf2, f_ma(use_tf2 and use_ma_filter2), lookahead = barmerge.lookahead_on)
[ma_tf3, ma_value3] = request.security(syminfo.ticker, tf3, f_ma(use_tf3 and use_ma_filter3), lookahead = barmerge.lookahead_on)
[ma_tf4, ma_value4] = request.security(syminfo.ticker, tf4, f_ma(use_tf4 and use_ma_filter4), lookahead = barmerge.lookahead_on)
[ma_tf5, ma_value5] = request.security(syminfo.ticker, tf5, f_ma(use_tf5 and use_ma_filter5), lookahead = barmerge.lookahead_on)
[ma_tf6, ma_value6] = request.security(syminfo.ticker, tf6, f_ma(use_tf6 and use_ma_filter6), lookahead = barmerge.lookahead_on)
[ma_tf7, ma_value7] = request.security(syminfo.ticker, tf7, f_ma(use_tf7 and use_ma_filter7), lookahead = barmerge.lookahead_on)
[ma_tf8, ma_value8] = request.security(syminfo.ticker, tf8, f_ma(use_tf8 and use_ma_filter8), lookahead = barmerge.lookahead_on)
[ma_tf9, ma_value9] = request.security(syminfo.ticker, tf9, f_ma(use_tf9 and use_ma_filter9), lookahead = barmerge.lookahead_on)
[ma_tf10, ma_value10] = request.security(syminfo.ticker, tf10, f_ma(use_tf10 and use_ma_filter10), lookahead = barmerge.lookahead_on)



// calculate efi tf side 
var int efi_side1 = 0
var int efi_side2 = 0
var int efi_side3 = 0
var int efi_side4 = 0
var int efi_side5 = 0
var int efi_side6 = 0
var int efi_side7 = 0
var int efi_side8 = 0
var int efi_side9 = 0
var int efi_side10 = 0

efi_side1 := not use_tf1 ? 99 : (efi_tf1 > _efibuy1 and ma_tf1 >= 0) ? 1 : (efi_tf1 < _efisell1 and ma_tf1 <= 0) ? -1 : 0
efi_side2 := not use_tf2 ? 99 : (efi_tf2 > _efibuy2 and ma_tf2 >= 0) ? 1 : (efi_tf2 < _efisell2 and ma_tf2 <= 0) ? -1 : 0
efi_side3 := not use_tf3 ? 99 : (efi_tf3 > _efibuy3 and ma_tf3 >= 0) ? 1 : (efi_tf3 < _efisell3 and ma_tf3 <= 0) ? -1 : 0
efi_side4 := not use_tf4 ? 99 : (efi_tf4 > _efibuy4 and ma_tf4 >= 0) ? 1 : (efi_tf4 < _efisell4 and ma_tf4 <= 0) ? -1 : 0
efi_side5 := not use_tf5 ? 99 : (efi_tf5 > _efibuy5 and ma_tf5 >= 0) ? 1 : (efi_tf5 < _efisell5 and ma_tf5 <= 0) ? -1 : 0
efi_side6 := not use_tf6 ? 99 : (efi_tf6 > _efibuy6 and ma_tf6 >= 0) ? 1 : (efi_tf6 < _efisell6 and ma_tf6 <= 0) ? -1 : 0
efi_side7 := not use_tf7 ? 99 : (efi_tf7 > _efibuy7 and ma_tf7 >= 0) ? 1 : (efi_tf7 < _efisell7 and ma_tf7 <= 0) ? -1 : 0
efi_side8 := not use_tf8 ? 99 : (efi_tf8 > _efibuy8 and ma_tf8 >= 0) ? 1 : (efi_tf8 < _efisell8 and ma_tf8 <= 0) ? -1 : 0
efi_side9 := not use_tf9 ? 99 : (efi_tf9 > _efibuy9 and ma_tf9 >= 0) ? 1 : (efi_tf9 < _efisell9 and ma_tf9 <= 0) ? -1 : 0
efi_side10 := not use_tf10 ? 99 : (efi_tf10 > _efibuy10 and ma_tf10 >= 0) ? 1 : (efi_tf10 < _efisell10 and ma_tf10 <= 0) ? -1 : 0

var bool efi_buy = false
var bool efi_sell = false

efi_buy := (efi_side1 == 99 or efi_side1 == 1)
 and (efi_side2 == 99 or efi_side2 == 1)
 and (efi_side3 == 99 or efi_side3 == 1)
 and (efi_side4 == 99 or efi_side4 == 1)
 and (efi_side5 == 99 or efi_side5 == 1)
 and (efi_side6 == 99 or efi_side6 == 1)
 and (efi_side7 == 99 or efi_side7 == 1)
 and (efi_side8 == 99 or efi_side8 == 1)
 and (efi_side9 == 99 or efi_side9 == 1)
 and (efi_side10 == 99 or efi_side10 == 1)

efi_sell := (efi_side1 == 99 or efi_side1 == -1)
 and (efi_side2 == 99 or efi_side2 == -1)
 and (efi_side3 == 99 or efi_side3 == -1)
 and (efi_side4 == 99 or efi_side4 == -1)
 and (efi_side5 == 99 or efi_side5 == -1)
 and (efi_side6 == 99 or efi_side6 == -1)
 and (efi_side7 == 99 or efi_side7 == -1)
 and (efi_side8 == 99 or efi_side8 == -1)
 and (efi_side9 == 99 or efi_side9 == -1)
 and (efi_side10 == 99 or efi_side10 == -1)

var int last_efi = 0
last_efi := efi_buy ? 1 : efi_sell ? -1 : last_efi[1]
// barcolor(efi_buy ? color.lime : efi_sell ? color.red : na)

// calculate tradingsignals
var bool in_trade = false
var int trade_side = 0
var int last_trade = na

var float target = 99999999.99
var float stop = 0.000000
var float entry_price = 0.00

var bool long_entry = false
var bool short_entry = false

var bool tgt_hit = false
var bool stop_hit = false

var bool long_exit = false
var bool short_exit = false


// entry signals
is_trade_sess = time(timeframe.period, str.format('{0}:1234567', trading_time), 'America/New_York') 
 or not useTradingHours

long_trade_side = not continous_mode ? (last_trade == -1 or na(last_trade)) : trade_side != 1 
short_trade_side = not continous_mode ? (last_trade == 1 or na(last_trade)) : trade_side != -1

long_conditions = is_trade_sess and (efi_buy and not efi_buy[1])
short_conditions = is_trade_sess and (efi_sell and not efi_sell[1])

long_entry := long_trades and (inverse_signals ? short_conditions : long_conditions) and long_trade_side and not long_entry[1]
short_entry := short_trades and (inverse_signals ? long_conditions : short_conditions) and short_trade_side and not short_entry[1]


// define position
entry_price := long_entry[1] or short_entry[1] ? open :  in_trade == true ? entry_price[1] : na
trade_side := long_entry[1] ? 1 : short_entry[1] ? -1 : in_trade == false ? 0 : trade_side[1]
last_trade := (trade_side != 0 and trade_side != trade_side[1]) ? trade_side : last_trade[1]


// define targets
if use_tp
    target := trade_side == 1 ? 
     (tp_type == 'Percent' ? (entry_price + (entry_price * (tp_amount/100))) : entry_price + tp_amount ) 
     : trade_side == -1 ? 
     (tp_type == 'Percent' ? (entry_price - (entry_price * (tp_amount/100))) : entry_price - tp_amount ) : na
else
    target := na


// define stops
if use_sl    
    stop := trade_side == 1 ?  
     ( sl_type == 'Percent' ? (entry_price - (entry_price * (sl_amount/100))) : entry_price - sl_amount ) 
     : trade_side == -1 ? 
     ( sl_type == 'Percent' ? (entry_price + (entry_price * (sl_amount/100))) : entry_price + sl_amount ) : na
else    
    stop := na


// update position
tgt_hit := trade_side == 1 and high >= target or trade_side == -1 and low <= target
stop_hit := trade_side == 1 and low <= stop or trade_side == -1 and high >= stop

long_exit := ( (tgt_hit or stop_hit or not is_trade_sess or (not short_trades and short_conditions)) ) 
 and in_trade[1] == true and trade_side[1] == 1

short_exit := ( (tgt_hit or stop_hit or not is_trade_sess or (not long_trades and long_conditions)))
 and in_trade[1] == true and trade_side[1] == -1   

in_trade := long_entry or short_entry ? true : long_exit or short_exit ?  false : in_trade[1]

// barcolor(long_entry ? color.green
//  : short_entry ? color.red
//  : long_exit ? color.blue
//  : short_exit ? color.fuchsia
//  : na)


// send orders
// time_to_backtest = ((useStrategyStart and time >= strategy_start) or not useStrategyStart)
//  and ((useStrategyEnd and time < strategy_end) or not useStrategyEnd)
//  ? true : false
// if time_to_backtest and is_trade_sess

//     // entry orders
//     if long_entry
//         strategy.entry(id="LE", comment = 'LE', direction = strategy.long)
//     if short_entry
//         strategy.entry(id="SS_E", comment = 'SS_E', direction = strategy.short)

//     // exits | targets and stops
//     if (strategy.position_size > 0)
//         strategy.exit(id="LE", limit=target, stop=stop , comment = "TP/SL")
//     if (strategy.position_size < 0)
//         strategy.exit(id="SS_E", limit=target, stop=stop , comment = "TP/SL")

//     // exit | no targets / stops
//     if (not short_trades and short_conditions)
//         strategy.close(id="LE", comment = 'LX')
//     if (not long_trades and long_conditions)
//         strategy.close(id="SS_E", comment = 'SS_X')
    
// else
//     strategy.close_all(comment = 'T_X', immediately = true)


// visual stuff
show_signals = input.bool(true, title = 'Show Signals', inline='1', group='Visual Settings')
show_lines = input.bool(true, title = 'Show Lines', inline='1', group='Visual Settings')
color_bg = input.bool(true, title = 'Color BG', inline='1', group='Visual Settings')

entry_color = input.color(color.blue, title = 'Entry Color', group = 'Visual Settings', inline = '4')
tgt_color = input.color(#27a69b, title = 'Tgt Color', group = 'Visual Settings', inline = '4')
stop_color = input.color(#b63632, title = 'Stop Color', group = 'Visual Settings', inline = '4')

panelbull_color = input.color(#27a69b, title='Bull Color', inline='5', group='Visual Settings')
panelbear_color = input.color(#b63632, title='Bear Color', inline='5', group='Visual Settings')
panelneutral_color = input.color(color.gray, title='Neutral Color', inline='5', group='Visual Settings')

dashboard_color = input.color(color.new(#131722, 0), title='BG Color', inline='6', group='Visual Settings')
dashboard_text = input.color(#ffffff, title='Text Color', inline='6', group='Visual Settings')
dashboard_bull = color.new(panelbull_color,40)
dashboard_bear = color.new(panelbear_color,40)

LabelSize = input.string(defval='Small', options=['Small', 'Medium', 'Large'],
 title='Dashboard Size', inline= '3', group='Dashboard Settings')
label_size = LabelSize == 'Small' ? size.small : LabelSize == 'Medium' ? size.normal 
 : LabelSize == 'Large' ? size.large : size.small
positioning = position.top_right 


plotshape(show_signals and long_entry[1] , style = shape.triangleup, location = location.belowbar,
 color=color.new(panelbull_color, 30), size=size.small, title = 'Long Entry')
plotshape(show_signals and short_entry[1] , style = shape.triangledown, location = location.abovebar,
 color=color.new(panelbear_color, 30), size=size.small, title = 'SS Entry')

plotshape(show_signals and short_exit, style = shape.triangleup, location = location.belowbar,
 color=color.new(dashboard_text, 30), size=size.small, title = 'SS Exit')
plotshape(show_signals and long_exit, style = shape.triangledown, location = location.abovebar,
 color=color.new(dashboard_text, 30), size=size.small, title = 'Long Exit')

plot(show_lines ? entry_price : na, title = 'Entry Line', color = entry_color, style = plot.style_circles, editable = false)
plot(show_lines ? target : na, title = 'Target Line', color = tgt_color, style = plot.style_circles, editable = false)
plot(show_lines ? stop : na, title = 'Stop Line', color = stop_color, style = plot.style_circles, editable = false)

bgcolor(not color_bg ? na : trade_side == 1 and in_trade[1] ? color.new(panelbull_color,80) 
 : trade_side == -1 and in_trade[1] ? color.new(panelbear_color,80) : na)


target_label = use_tp and trade_side != 0 ? str.tostring(math.round_to_mintick(target)) : ""
stop_label = use_sl and trade_side != 0 ? str.tostring(math.round_to_mintick(stop)) : ""


var color color_sym1_tf1 = na
var color color_sym1_tf2 = na
var color color_sym1_tf3 = na
var color color_sym1_tf4 = na
var color color_sym1_tf5 = na
var color color_sym1_tf6 = na
var color color_sym1_tf7 = na
var color color_sym1_tf8 = na
var color color_sym1_tf9 = na
var color color_sym1_tf10 = na

var string text_sym1_tf1 = na
var string text_sym1_tf2 = na
var string text_sym1_tf3 = na
var string text_sym1_tf4 = na
var string text_sym1_tf5 = na
var string text_sym1_tf6 = na
var string text_sym1_tf7 = na
var string text_sym1_tf8 = na
var string text_sym1_tf9 = na
var string text_sym1_tf10 = na

var table t = table.new(positioning, 1, 13, frame_color=color.new(color.black, 0),
 frame_width=1, border_color=color.new(dashboard_color, 100), border_width=1)
if barstate.islast or barstate.islastconfirmedhistory

    color_sym1_tf1 := efi_side1 == 1 ? panelbull_color : efi_side1 == -1 ? panelbear_color : dashboard_color
    color_sym1_tf2 := efi_side2 == 1 ? panelbull_color : efi_side2 == -1 ? panelbear_color : dashboard_color
    color_sym1_tf3 := efi_side3 == 1 ? panelbull_color : efi_side3 == -1 ? panelbear_color : dashboard_color
    color_sym1_tf4 := efi_side4 == 1 ? panelbull_color : efi_side4 == -1 ? panelbear_color : dashboard_color
    color_sym1_tf5 := efi_side5 == 1 ? panelbull_color : efi_side5 == -1 ? panelbear_color : dashboard_color
    color_sym1_tf6 := efi_side6 == 1 ? panelbull_color : efi_side6 == -1 ? panelbear_color : dashboard_color
    color_sym1_tf7 := efi_side7 == 1 ? panelbull_color : efi_side7 == -1 ? panelbear_color : dashboard_color
    color_sym1_tf8 := efi_side8 == 1 ? panelbull_color : efi_side8 == -1 ? panelbear_color : dashboard_color
    color_sym1_tf9 := efi_side9 == 1 ? panelbull_color : efi_side9 == -1 ? panelbear_color : dashboard_color
    color_sym1_tf10 := efi_side10 == 1 ? panelbull_color : efi_side10 == -1 ? panelbear_color : dashboard_color

    text_sym1_tf1 := tf1 == "" ? timeframe.period : tf1
    text_sym1_tf2 := tf2 == "" ? timeframe.period : tf2
    text_sym1_tf3 := tf3 == "" ? timeframe.period : tf3
    text_sym1_tf4 := tf4 == "" ? timeframe.period : tf4
    text_sym1_tf5 := tf5 == "" ? timeframe.period : tf5
    text_sym1_tf6 := tf6 == "" ? timeframe.period : tf6
    text_sym1_tf7 := tf7 == "" ? timeframe.period : tf7
    text_sym1_tf8 := tf8 == "" ? timeframe.period : tf8
    text_sym1_tf9 := tf9 == "" ? timeframe.period : tf9
    text_sym1_tf10 := tf10 == "" ? timeframe.period : tf10

    table.cell(t, 0, 0, text="MTF EFI", 
     width=0, bgcolor=dashboard_color, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)   

    if use_tf1
        table.cell(t, 0, 1, text= text_sym1_tf1, width=0, bgcolor=color_sym1_tf1, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    if use_tf2
        table.cell(t, 0, 2, text= text_sym1_tf2, width=0, bgcolor=color_sym1_tf2, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    if use_tf3
        table.cell(t, 0, 3, text= text_sym1_tf3, width=0, bgcolor=color_sym1_tf3, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    if use_tf4
        table.cell(t, 0, 4, text= text_sym1_tf4, width=0, bgcolor=color_sym1_tf4, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    if use_tf5
        table.cell(t, 0, 5, text= text_sym1_tf5, width=0, bgcolor=color_sym1_tf5, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    if use_tf6
        table.cell(t, 0, 6, text= text_sym1_tf6, width=0, bgcolor=color_sym1_tf6, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    if use_tf7
        table.cell(t, 0, 7, text= text_sym1_tf7, width=0, bgcolor=color_sym1_tf7, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    if use_tf8
        table.cell(t, 0, 8, text= text_sym1_tf8, width=0, bgcolor=color_sym1_tf8, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    if use_tf9
        table.cell(t, 0, 9, text= text_sym1_tf9, width=0, bgcolor=color_sym1_tf9, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    if use_tf10
        table.cell(t, 0, 10, text= text_sym1_tf10, width=0, bgcolor=color_sym1_tf10, text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)


    table.cell(t, 0, 11, text= "TP: " + target_label, width=0, bgcolor=dashboard_color, 
     text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
    table.cell(t, 0, 12, text= "SL: " + stop_label, width=0, bgcolor=dashboard_color, 
     text_color=dashboard_text, text_size=label_size, text_halign=text.align_center)
 

// alerts
alertcondition(long_entry, title = 'Long Entry', message = 'Long Entry')
alertcondition(short_entry, title = 'Short Entry', message = 'Short Entry')
alertcondition(long_exit, title = 'Long Exit', message = 'Long Exit')
alertcondition(short_exit, title = 'Short Exit', message = 'Short Exit')



// testing visuals
[efi_chart, high_efi_chart, low_efi_chart] = f_efi(true)

// visual_colors = color.from_gradient(efi_chart, low_efi_chart, high_efi_chart, panelbear_color, panelbull_color)
visual_bull = color.from_gradient(efi_chart, 0, high_efi_chart, color.yellow, panelbull_color)
visual_bear = color.from_gradient(efi_chart, 0, math.abs(low_efi_chart), panelbear_color, color.yellow)

efi_chart_side = efi_chart > 0 ? visual_bull : efi_chart < 0 ? visual_bear : color.yellow

[chart_maside, chart_ma] = f_ma(true)
plot(chart_ma, title = 'TEST MA LINE', color = efi_chart_side, linewidth = 2)
plotchar(true, title = 'TEST DOTS', color = efi_chart_side, char = '●', location = location.belowbar)
plotchar(true, title = 'TEST BOTTOM LINE', color = efi_chart_side, char = '●', location = location.bottom)
barcolor(efi_chart_side)

Overview

Users can select the smoothing length, choose the moving average type (EMA, SMA, VWMA, RMA, or HMA), and toggle individual timeframes with custom buy and sell thresholds. It requires volume data from the feed to function. Because it references higher-timeframe data with potential lookahead, signals on historical bars may reflect future closed periods.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Volume, Oscillators & momentum, Moving averages

Markets

Stocks, Crypto, Indices, Oil & commodities

Timeframes

M1-M5, M15-H1, H4 and above

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Settings

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

SettingTypeDefaultVariable
EFI Lengthint13efi_length
EFI SmoothingstringEMAefi_type
use_tf1boolfalseuse_tf1
tf1timeframe1tf1
_efibuy1int0_efibuy1
_efisell1int0_efisell1
use_tf2boolfalseuse_tf2
tf2timeframe3tf2
_efibuy2int0_efibuy2
_efisell2int0_efisell2
use_tf3boolfalseuse_tf3
tf3timeframe5tf3
Show all 40 settings
SettingTypeDefaultVariable
_efibuy3int0_efibuy3
_efisell3int0_efisell3
use_tf4booltrueuse_tf4
tf4timeframe15tf4
_efibuy4int0_efibuy4
_efisell4int0_efisell4
use_tf5booltrueuse_tf5
tf5timeframe30tf5
_efibuy5int0_efibuy5
_efisell5int0_efisell5
use_tf6booltrueuse_tf6
tf6timeframe60tf6
_efibuy6int0_efibuy6
_efisell6int0_efisell6
use_tf7booltrueuse_tf7
tf7timeframe120tf7
_efibuy7int0_efibuy7
_efisell7int0_efisell7
use_tf8boolfalseuse_tf8
tf8timeframe180tf8
_efibuy8int0_efibuy8
_efisell8int0_efisell8
use_tf9boolfalseuse_tf9
tf9timeframe240tf9
_efibuy9int0_efibuy9
_efisell9int0_efisell9
use_tf10boolfalseuse_tf10
tf10timeframeDtf10
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

LiqSpikeBounceLong Feb2026

by agutinbaigo28
147 stars

LiqSpikeBounceLong Feb2026 is an indicator designed to identify long bounce entries following high-volume liquidation cascades in bearish market contexts. It checks if price is below an exponential moving average, then detects large single-bar drops exceeding

Indicator v5 Volatility & bandsVolume
Updated 6 weeks ago · MIT GitHub repository of LiqSpikeBounceLong Feb2026

Signal Strategy 15m

by tripolskypetr
72 stars

This indicator generates trend-following trade signals on the price chart by combining moving average crossovers with multi-factor filters. It triggers entry alerts when fast and slow EMAs cross in the direction of a baseline trend EMA, confirmed by non-extrem

Indicator v5 TrendMoving averages
Updated 3 days ago · MIT GitHub repository of Signal Strategy 15m
46 stars

This overlay indicator plots a SuperTrend using a 10-period ATR with a multiplier of 3, drawing up and down stop lines and a faint trend fill on the price chart. It compares a 9-period EMA with an 18-period EMA and a 12/26/9 MACD against its signal, and it req

Indicator v5 TrendOscillators & momentum
Updated 3 years ago · None stated GitHub repository of SuperTrend + MACD + EMA

Bte Acc

by f-cksociety
11 stars

Bte Acc is a chart indicator form of the PineCoders Backtesting and Trading Engine. It seeks an entry trigger from a main or alternate entry method, then checks trade direction, filters, date range, ATR readiness, and remaining capital before filling on the ne

Indicator v5 TrendOscillators & momentum Repaints
Updated 4 years ago · MPL-2.0 GitHub repository of Bte Acc

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers