Indicator · Pine Script v5 · Own pane

Currency Strength Chart

by itmakesyousick· code credited to boitoki

Currency Strength Chart plots the relative strength of major currencies including EUR, USD, JPY, GBP, CHF, AUD and CAD on a separate pane.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code664
Settings40inputs
LicenceNone statedfile: MPL-2.0
Last update4 years ago5 Aug 2022

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

664 lines of Pine Script v5 from v31.0.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

v31.0.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © boitoki

//@version=5
//@see https://currency-strength.com/
//@see https://currency-strength.com/about.html
indicator('Currency Strength Chart', overlay=false, precision=2, max_labels_count=20)

import boitoki/TableColorTheme/1 as mycolor
import boitoki/AwesomeColor/2 as ac
import boitoki/ma_function/3 as ma

////////////////////
// Defines
////////////////////
noneColor = color.new(color.black, 100)
GP1 = 'General:'
GP2 = 'Display:'
GP3 = 'Colors:'
GP4 = 'Panel:'
GP5 = 'Source:'
GP6 = 'Options:'
GP7 = 'Line style:'
GP8 = 'Label style:'
GP9 = 'Currency pair strength:'
EUR_FLAG = '🇪🇺'
USD_FLAG = '🇺🇸'
JPY_FLAG = '🇯🇵'
CHF_FLAG = '🇨🇭'
GBP_FLAG = '🇬🇧'
AUD_FLAG = '🇦🇺'
CAD_FLAG = '🇨🇦'
NZD_FLAG = '🇳🇿'
t_reso_customize = 'Resolution'
t_reso_lookback = 'Lookback periods'
t_reso_auto = 'Auto'
r_ticker = '^' + syminfo.ticker + '$'

////////////////////
//
////////////////////
get_reso (_mode, _auto, _input) => 
    switch _mode
        t_reso_auto => _auto
        t_reso_lookback => timeframe.period
        t_reso_customize => _input
        => _input

calc_source (_type, _source, _length, _smooth) =>
    switch _type
        'RSI' => ta.rsi(_source, _length)
        'CCI' => ta.cci(_source, _length) + 1000
        'Stochastics' => ta.sma(ta.stoch(_source, high, low, _length), _smooth)
        => _source

get_is_match (_name) => str.length(str.match(syminfo.ticker, _name)) > 0

get_is_currency_a (_name) => str.length(str.match(r_ticker, '\\^' + _name)) > 0

////////////////////
// Inputs
////////////////////
string reso_autovalue = not timeframe.isintraday ? '12M' : timeframe.multiplier >= 60 ? 'W' : timeframe.multiplier >= 240 ? 'M' : 'D'
string i_reso_mode = input.string(defval=t_reso_auto, title='Mode', options=[t_reso_auto, t_reso_customize, t_reso_lookback], group=GP1)
string i_reso_value = input.timeframe(defval='D', title='Resolution', group=GP1, tooltip='When you choose the "Resolution" on the mode.')
string reso = get_reso(i_reso_mode, reso_autovalue, i_reso_value)
i_reso_lookback = i_reso_mode == t_reso_lookback ? input.int(defval=100, title='Lookback periods', minval=1, group=GP1, tooltip='When you choose the "Lookback periods" on the mode.') : 1
i_broker = input.string(title='Brokers', options=['OANDA', 'FOREXCOM', 'SAXO', 'FX_IDC', 'FX'], defval='OANDA', group=GP1)

////////////////////
// Source
////////////////////
i_source = input.source(defval=close, title='Source', group=GP5)
i_calc = input.string(defval='Price', title='Calculate by', options=['Price', 'RSI', 'CCI', 'Stochastics'], inline='calc', group=GP5)
i_length = input.int(defval=7, title='', inline='calc', group=GP5, tooltip='A value that is valid for non `Price`.')
i_smoothtype = input.string(defval='SMA', title='Smoothing', options=['SMA', 'EMA', 'RMA', 'WMA', 'VWMA', 'HMA', 'LSMA', 'ALMA', 'SWMA', 'TMA', 'DEMA', 'TEMA', 'MAV', 'KAMA', 'ZLEMA', 'AMA'], inline='smooth', group=GP5)
i_smooth = input.int(defval=1, title='', minval=1, inline='smooth', group=GP5)
source = calc_source(i_calc, i_source, i_length, 3)

////////////////////
// Display
////////////////////
is_autoSelect = input.string(defval='No', title='Auto selected', options=['Yes', 'No'], inline='10', group=GP2) == 'Yes'
is_histogram = input.string('Lines only', title='', options=['Lines only', 'Histogram', 'Without lines'], inline='10', group=GP2)
is_histogram_without_lines = is_histogram == 'Without lines'

show_lines = not is_histogram_without_lines
show_fill = show_lines and is_autoSelect
show_histogram = is_autoSelect and (is_histogram != 'Lines only')

show_EUR = input.bool(title='EUR', defval=true,  group=GP2, inline='eur')
c_eur = input.color(title='', defval=color.red, group=GP2, inline='eur')
i_eur_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='eur')
show_USD = input.bool(title='USD', defval=true,  group=GP2, inline='usd')
c_usd = input.color(title='', defval=color.orange, group=GP2, inline='usd')
i_usd_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='usd')
show_JPY = input.bool(title='JPY', defval=true,  group=GP2, inline='jpy')
c_jpy = input.color(title='', defval=color.aqua, group=GP2, inline='jpy')
i_jpy_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='jpy')
show_GBP = input.bool(title='GBP', defval=true,  group=GP2, inline='gbp')
c_gbp = input.color(title='', defval=color.green, group=GP2, inline='gbp')
i_gbp_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='gbp')
show_CHF = input.bool(title='CHF', defval=true,  group=GP2, inline='chf')
c_chf = input.color(title='', defval=color.maroon, group=GP2, inline='chf')
i_chf_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='chf')
show_AUD = input.bool(title='AUD', defval=true,  group=GP2, inline='aud')
c_aud = input.color(title='', defval=color.blue, group=GP2, inline='aud')
i_aud_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='aud')
show_CAD = input.bool(title='CAD', defval=true,  group=GP2, inline='cad')
c_cad = input.color(title='', defval=color.purple, group=GP2, inline='cad')
i_cad_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='cad')
show_NZD = input.bool(title='NZD', defval=true,  group=GP2, inline='nzd')
c_nzd = input.color(title='', defval=color.fuchsia, group=GP2, inline='nzd')
i_nzd_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='nzd')
show_XAU = input.bool(title='XAU', defval=false, group=GP2, inline='xau')
c_xau = input.color(title='', defval=#D7BE69, group=GP2, inline='xau')
i_xau_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='xau')
show_XAG = input.bool(title='XAG', defval=false, group=GP2, inline='xag')
c_xag = input.color(title='', defval=color.silver, group=GP2, inline='xag')
i_xag_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='xag')
show_OIL = input.bool(title='OIL', defval=false, group=GP2, inline='oil')
c_oil = input.color(title='', defval=#745433, group=GP2, inline='oil')
i_oil_width = input.int(title='', defval=2, options=[1,2,3,4,5,6,7,8,9,10], group=GP2, inline='oil')

i_theme = input.string(title="Color theme", defval="monokai", options=["monokai", "monokai pro", "panda", "customize"], group=GP2)
shouldBeTextBlack = (i_theme == 'monokai' or i_theme == 'monokai pro' or i_theme == 'panda')


string currency_a = na
string currency_b = na

if is_autoSelect
    if get_is_currency_a('EUR')
        currency_a := 'EUR'
    else if get_is_currency_a('USD')
        currency_a := 'USD'
    else if get_is_currency_a('JPY')
        currency_a := 'JPY'
    else if get_is_currency_a('GBP')
        currency_a := 'GBP'
    else if get_is_currency_a('CHF')
        currency_a := 'CHF'
    else if get_is_currency_a('AUD')
        currency_a := 'AUD'
    else if get_is_currency_a('CAD')
        currency_a := 'CAD'
    else if get_is_currency_a('NZD')
        currency_a := 'NZD'
    
    if not na(currency_a)
        currency_b := str.replace_all(syminfo.ticker, currency_a, '')

    show_EUR := get_is_match('EUR'), show_USD := get_is_match('USD'), show_JPY := get_is_match('JPY')
    show_GBP := get_is_match('GBP'), show_CHF := get_is_match('CHF'), show_AUD := get_is_match('AUD')
    show_CAD := get_is_match('CAD'), show_NZD := get_is_match('NZD')
    show_XAU := false, show_XAG := false, show_OIL := false

float v1_EURUSD = request.security(i_broker + ':EURUSD', timeframe.period, source)
float v1_USDJPY = request.security(i_broker + ':USDJPY', timeframe.period, source)
float v1_USDCHF = request.security(i_broker + ':USDCHF', timeframe.period, source)
float v1_GBPUSD = request.security(i_broker + ':GBPUSD', timeframe.period, source)
float v1_AUDUSD = request.security(i_broker + ':AUDUSD', timeframe.period, source)
float v1_USDCAD = request.security(i_broker + ':USDCAD', timeframe.period, source)
float v1_NZDUSD = request.security(i_broker + ':NZDUSD', timeframe.period, source)
float v1_XAUUSD = show_XAU ? request.security(i_broker + ':XAUUSD', timeframe.period, source) : 0
float v1_XAGUSD = show_XAG ? request.security(i_broker + ':XAGUSD', timeframe.period, source) : 0
float v1_OILUSD = show_OIL ? request.security('USOIL', timeframe.period, source) : 0

float v2_EURUSD = request.security(i_broker + ':EURUSD', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on)
float v2_USDJPY = request.security(i_broker + ':USDJPY', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on)
float v2_USDCHF = request.security(i_broker + ':USDCHF', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on)
float v2_GBPUSD = request.security(i_broker + ':GBPUSD', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on)
float v2_AUDUSD = request.security(i_broker + ':AUDUSD', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on)
float v2_USDCAD = request.security(i_broker + ':USDCAD', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on)
float v2_NZDUSD = request.security(i_broker + ':NZDUSD', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on)
float v2_XAUUSD = show_XAU ? request.security(i_broker + ':XAUUSD', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on) : 0
float v2_XAGUSD = show_XAU ? request.security(i_broker + ':XAGUSD', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on) : 0
float v2_OILUSD = show_OIL ? request.security('USOIL', reso, source[i_reso_lookback], barmerge.gaps_off, barmerge.lookahead_on) : 0

////////////////////
// Other settings
////////////////////

// Labels
show_labels = input.bool(title='Name label', defval=true, group=GP8)
i_label_size = input.string(title='Label size', options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], defval=size.normal, group=GP8)
i_label_offset = input.int(title='Label offset', defval=5, minval=0, group=GP8, inline='connected line')
i_label_style = label.style_label_left
i_line_style = input.string(title='', defval=line.style_dotted, options=[line.style_solid, line.style_dotted, line.style_dashed], group=GP8, inline="connected line")

label_x = time + timeframe.multiplier * 60 * 1000 * i_label_offset
line_x1 = time
line_x2 = label_x

// Panel
show_panel = input.bool(title='Panel', defval=true, group=GP4)
i_tableYpos = input.string('top', title='Position', options = ['top', 'middle', 'bottom'], inline='11', group=GP4)
i_tableXpos = input.string('right', title='', options=['left', 'center', 'right'], inline='11', group=GP4)
i_panel_position = i_tableYpos + '_' + i_tableXpos
i_panel_flagsize = input.string(title='Flag size', defval=size.large, options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group=GP4)
i_panel_textsize = input.string(title='Text size', defval=size.normal, options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group=GP4)
i_panel_theme = input.string(title='Color', defval='multi', options=['multi', 'green', 'blue', 'orange', 'red', 'black', 'white', 'night', 'carbon'], group=GP4)
is_multi = i_panel_theme == 'multi'

// Currency pair strength
show_pair = input.bool(title="Currency pair strength", defval=false, group=GP9)
i_pair_offset = show_pair ? input.int(defval=100, title="Position offset", options=[0,20,40,60,80,100,120,140,160,180,200], group=GP9) : 0
i_pair_margin = input.int(defval=4, title="Position margin", options=[0,2,4,6,8,10,16,20], group=GP9)
i_pair_labelcolor = input.color(defval=color.gray, title="Label color", group=GP9)

// Options
show_levels = input.bool(title='Level lines', defval=false, group=GP6)
i_levels = input.int(title='Level (±)', minval=1, defval=10, group=GP6)
c_levels = show_levels ? color.gray : na


// Color themes
c_green = ac.tradingview('green')
c_red = ac.tradingview('red')
c_black = ac.tradingview('black')

if i_theme == 'monokai'
    c_eur := ac.monokai('pink')
    c_usd := ac.monokai('orange')
    c_gbp := ac.monokai('green')
    c_cad := ac.monokai('purple')
    c_aud := ac.monokai('blue')
    c_chf := ac.monokai('yellow')
    c_green := ac.monokai('green')
    c_red := ac.monokai('pink')
    c_black := ac.monokai('black')
else if i_theme == 'monokai pro'
    c_eur := ac.monokaipro('pink')
    c_usd := ac.monokaipro('orange')
    c_gbp := ac.monokaipro('green')
    c_cad := ac.monokaipro('purple')
    c_aud := ac.monokaipro('blue')
    c_chf := ac.monokaipro('yellow')
    c_green := ac.monokaipro('green')
    c_red := ac.monokaipro('pink')
    c_black := ac.monokaipro('black')
else if i_theme == 'panda'
    c_eur := ac.panda('red')
    c_usd := ac.panda('orange')
    c_gbp := ac.panda('green')
    c_cad := ac.panda('purple')
    c_aud := ac.panda('blue')
    c_chf := ac.panda('pink')
    c_green := ac.panda('green')
    c_red := ac.panda('red')
    c_black := ac.panda('very-dark-gray')

////////////////////
// Functions
////////////////////
get_value_by_name (v, _EUR, _USD, _JPY, _CHF, _GBP, _AUD, _CAD, _NZD) =>
    v == 'EUR' ? _EUR : v == 'USD' ? _USD : v == 'JPY' ? _JPY : v == 'CHF' ? _CHF : v == 'GBP' ? _GBP : v == 'AUD' ? _AUD : v == 'CAD' ? _CAD : v == 'NZD' ? _NZD : na

get_name_by_value(v, _EUR, _USD, _JPY, _CHF, _GBP, _AUD, _CAD, _NZD) =>
    v == _EUR ? 'EUR' : v == _USD ? 'USD' : v == _JPY ? 'JPY' : v == _CHF ? 'CHF' : v == _GBP ? 'GBP' : v == _AUD ? 'AUD' : v == _CAD ? 'CAD' : v == _NZD ? 'NZD' : na

get_color_by_value(v, _EUR, _USD, _JPY, _CHF, _GBP, _AUD, _CAD, _NZD) =>
    v == _EUR ? c_eur : v == _USD ? c_usd : v == _JPY ? c_jpy : v == _CHF ? c_chf : v == _GBP ? c_gbp : v == _AUD ? c_aud : v == _CAD ? c_cad : v == _NZD ? c_nzd : na

get_flag_by_value(v, _EUR, _USD, _JPY, _CHF, _GBP, _AUD, _CAD, _NZD) =>
    v == _EUR ? EUR_FLAG : v == _USD ? USD_FLAG : v == _JPY ? JPY_FLAG : v == _CHF ? CHF_FLAG : v == _GBP ? GBP_FLAG : v == _AUD ? AUD_FLAG : v == _CAD ? CAD_FLAG : v == _NZD ? NZD_FLAG : na

get_pair_by_value (_v, _EURUSD, _USDJPY, _USDCHF, _GBPUSD, _AUDUSD , _USDCAD, _NZDUSD, _GBPJPY) =>
    _v == _EURUSD ? 'EUR\nUSD' : _v == _USDJPY ? 'USD\nJPY' : _v == _USDCHF ? 'USD\nCHF' : _v == _GBPUSD ? 'GBP\nUSD' : _v == _AUDUSD ? 'AUD\nUSD' : _v == _USDCAD ? 'USD\nCAD' : _v == _NZDUSD ? 'NZD\nUSD' : _v == _GBPJPY ? 'GBP\nJPY' : na

get_val(_v1, _v2) =>
    float res = 0

    if _v2 == 0
        res := 0
        res
    else
        res := math.log(_v1 / _v2) * 10000
        res

    res

get_val_m(_v1, _v2, _v3, _v4) =>
    float res = 0
    float v1 = _v1 * _v3
    float v2 = _v2 * _v4

    if _v2 == 0
        res := 0
        res
    else
        res := math.log(v1 / v2) * 10000
        res

    res

get_val_d(_v1, _v2, _v3, _v4) =>
    float res = 0

    if _v3 == 0 or _v4 == 0
        res := 0
        res
    else
        float v1 = _v1 / _v3
        float v2 = _v2 / _v4

        if v2 == 0
            res := 0
            res
        else
            res := math.log(v1 / v2) * 10000
            res

    res


////////////////////
// Calculating
////////////////////
float EURUSD = get_val(v1_EURUSD, v2_EURUSD)
float USDJPY = get_val(v1_USDJPY, v2_USDJPY)
float USDCHF = get_val(v1_USDCHF, v2_USDCHF)
float GBPUSD = get_val(v1_GBPUSD, v2_GBPUSD)
float AUDUSD = get_val(v1_AUDUSD, v2_AUDUSD)
float USDCAD = get_val(v1_USDCAD, v2_USDCAD)
float NZDUSD = get_val(v1_NZDUSD, v2_NZDUSD)
float XAUUSD = get_val(v1_XAUUSD, v2_XAUUSD)
float XAGUSD = get_val(v1_XAGUSD, v2_XAGUSD)
float OILUSD = get_val(v1_OILUSD, v2_OILUSD)
float EURJPY = get_val_m(v1_EURUSD, v2_EURUSD, v1_USDJPY, v2_USDJPY)
float EURCHF = get_val_m(v1_EURUSD, v2_EURUSD, v1_USDCHF, v2_USDCHF)
float EURGBP = get_val_d(v1_EURUSD, v2_EURUSD, v1_GBPUSD, v2_GBPUSD)
float EURCAD = get_val_m(v1_EURUSD, v2_EURUSD, v1_USDCAD, v2_USDCAD)
float EURAUD = get_val_d(v1_EURUSD, v2_EURUSD, v1_AUDUSD, v2_AUDUSD)
float EURNZD = get_val_d(v1_EURUSD, v2_EURUSD, v1_NZDUSD, v2_NZDUSD)
float EURXAU = get_val_d(v1_EURUSD, v2_EURUSD, v1_XAUUSD, v2_XAUUSD)
float EURXAG = get_val_d(v1_EURUSD, v2_EURUSD, v1_XAGUSD, v2_XAGUSD)
float EUROIL = get_val_d(v1_EURUSD, v2_EURUSD, v1_OILUSD, v2_OILUSD)
float GBPCHF = get_val_m(v1_GBPUSD, v2_GBPUSD, v1_USDCHF, v2_USDCHF)
float GBPJPY = get_val_m(v1_GBPUSD, v2_GBPUSD, v1_USDJPY, v2_USDJPY)
float GBPCAD = get_val_m(v1_GBPUSD, v2_GBPUSD, v1_USDCAD, v2_USDCAD)
float GBPAUD = get_val_d(v1_GBPUSD, v2_GBPUSD, v1_AUDUSD, v2_AUDUSD)
float GBPNZD = get_val_d(v1_GBPUSD, v2_GBPUSD, v1_NZDUSD, v2_NZDUSD)
float AUDCHF = get_val_m(v1_AUDUSD, v2_AUDUSD, v1_USDCHF, v2_USDCHF)
float AUDJPY = get_val_m(v1_AUDUSD, v2_AUDUSD, v1_USDJPY, v2_USDJPY)
float AUDCAD = get_val_m(v1_AUDUSD, v2_AUDUSD, v1_USDCAD, v2_USDCAD)
float AUDNZD = get_val_d(v1_AUDUSD, v2_AUDUSD, v1_NZDUSD, v2_NZDUSD)
float NZDCAD = get_val_m(v1_NZDUSD, v2_NZDUSD, v1_USDCAD, v2_USDCAD)
float NZDCHF = get_val_m(v1_NZDUSD, v2_NZDUSD, v1_USDCHF, v2_USDCHF)
float NZDJPY = get_val_m(v1_NZDUSD, v2_NZDUSD, v1_USDJPY, v2_USDJPY)
float CADJPY = get_val_d(v1_USDJPY, v2_USDJPY, v1_USDCAD, v2_USDCAD)
float CADCHF = get_val_d(v1_USDCHF, v2_USDCHF, v1_USDCAD, v2_USDCAD)
float CHFJPY = get_val_d(v1_USDJPY, v2_USDJPY, v1_USDCHF, v2_USDCHF)
float XAUJPY = get_val_m(v1_XAUUSD, v2_XAUUSD, v1_USDJPY, v2_USDJPY)
float XAUCHF = get_val_m(v1_XAUUSD, v2_XAUUSD, v1_USDCHF, v2_USDCHF)
float XAUGBP = get_val_d(v1_XAUUSD, v2_XAUUSD, v1_GBPUSD, v2_GBPUSD)
float XAUCAD = get_val_m(v1_XAUUSD, v2_XAUUSD, v1_USDCAD, v2_USDCAD)
float XAUAUD = get_val_d(v1_XAUUSD, v2_XAUUSD, v1_AUDUSD, v2_AUDUSD)
float XAUNZD = get_val_d(v1_XAUUSD, v2_XAUUSD, v1_NZDUSD, v2_NZDUSD)
float XAGJPY = get_val_m(v1_XAGUSD, v2_XAGUSD, v1_USDJPY, v2_USDJPY)
float XAGCHF = get_val_m(v1_XAGUSD, v2_XAGUSD, v1_USDCHF, v2_USDCHF)
float XAGGBP = get_val_d(v1_XAGUSD, v2_XAGUSD, v1_GBPUSD, v2_GBPUSD)
float XAGCAD = get_val_m(v1_XAGUSD, v2_XAGUSD, v1_USDCAD, v2_USDCAD)
float XAGAUD = get_val_d(v1_XAGUSD, v2_XAGUSD, v1_AUDUSD, v2_AUDUSD)
float XAGNZD = get_val_d(v1_XAGUSD, v2_XAGUSD, v1_NZDUSD, v2_NZDUSD)
float OILJPY = get_val_m(v1_OILUSD, v2_OILUSD, v1_USDJPY, v2_USDJPY)
float OILCHF = get_val_m(v1_OILUSD, v2_OILUSD, v1_USDCHF, v2_USDCHF)
float OILGBP = get_val_d(v1_OILUSD, v2_OILUSD, v1_GBPUSD, v2_GBPUSD)
float OILCAD = get_val_m(v1_OILUSD, v2_OILUSD, v1_USDCAD, v2_USDCAD)
float OILAUD = get_val_d(v1_OILUSD, v2_OILUSD, v1_AUDUSD, v2_AUDUSD)
float OILNZD = get_val_d(v1_OILUSD, v2_OILUSD, v1_NZDUSD, v2_NZDUSD)
float OILXAU = get_val_d(v1_OILUSD, v2_OILUSD, v1_XAUUSD, v2_XAUUSD)

float EUR = ma.calc(i_smoothtype, ( EURUSD + EURJPY + EURCHF + EURGBP + EURAUD + EURCAD + EURNZD) / 7, i_smooth)
float USD = ma.calc(i_smoothtype, (-EURUSD + USDJPY + USDCHF - GBPUSD - AUDUSD + USDCAD - NZDUSD) / 7, i_smooth)
float JPY = ma.calc(i_smoothtype, (-EURJPY - USDJPY - CHFJPY - GBPJPY - AUDJPY - CADJPY - NZDJPY) / 7, i_smooth)
float CHF = ma.calc(i_smoothtype, (-EURCHF - USDCHF + CHFJPY - GBPCHF - AUDCHF - CADCHF - NZDCHF) / 7, i_smooth)
float GBP = ma.calc(i_smoothtype, (-EURGBP + GBPUSD + GBPCHF + GBPJPY + GBPAUD + GBPCAD + GBPNZD) / 7, i_smooth)
float AUD = ma.calc(i_smoothtype, (-EURAUD + AUDUSD + AUDJPY + AUDCHF - GBPAUD + AUDCAD + AUDNZD) / 7, i_smooth)
float CAD = ma.calc(i_smoothtype, (-EURCAD - USDCAD + CADJPY + CADCHF - GBPCAD - AUDCAD - NZDCAD) / 7, i_smooth)
float NZD = ma.calc(i_smoothtype, (-EURNZD + NZDUSD + NZDJPY + NZDCHF - GBPNZD + NZDCAD - AUDNZD) / 7, i_smooth)
float XAU = ma.calc(i_smoothtype, (-EURXAU + XAUUSD + XAUJPY + XAUCHF + XAUGBP + XAUAUD + XAUCAD + XAUNZD) / 8, i_smooth)
float XAG = ma.calc(i_smoothtype, (-EURXAG + XAGUSD + XAGJPY + XAGCHF + XAGGBP + XAGAUD + XAGCAD + XAGNZD) / 8, i_smooth)
float OIL = ma.calc(i_smoothtype, (-EUROIL + OILUSD + OILJPY + OILCHF + OILGBP + OILAUD + OILCAD + OILNZD) / 8, i_smooth)

////////////////////
// Plotting
////////////////////

// Backgrounds
hline(0, title='Base', linestyle=hline.style_solid)
hline( i_levels, color=c_levels, title='Level +', linestyle=hline.style_dotted)
hline(-i_levels, color=c_levels, title='Level -', linestyle=hline.style_dotted)

// Histogram
currency_a_value = get_value_by_name(currency_a, EUR, USD, JPY, CHF, GBP, AUD, CAD, NZD)
currency_b_value = get_value_by_name(currency_b, EUR, USD, JPY, CHF, GBP, AUD, CAD, NZD)
c_currency_a = get_value_by_name(currency_a, c_eur, c_usd, c_jpy, c_chf, c_gbp, c_aud, c_cad, c_nzd)
c_currency_b = get_value_by_name(currency_b, c_eur, c_usd, c_jpy, c_chf, c_gbp, c_aud, c_cad, c_nzd)
currency_delta = currency_a_value - currency_b_value
c_delta = currency_delta > 0 ? c_currency_b : c_currency_a

plot(show_histogram ? currency_delta : na, color=color.new(c_delta, 50), style=plot.style_columns, editable=false, show_last=i_pair_offset)

// Lines
plot(show_OIL and show_lines? OIL : na, title='OIL', color=c_oil, linewidth=i_oil_width, editable=false, show_last=i_pair_offset)
plot(show_XAG and show_lines? XAG : na, title='XAG', color=c_xag, linewidth=i_xag_width, editable=false, show_last=i_pair_offset)
plot(show_XAU and show_lines? XAU : na, title='XAU', color=c_xau, linewidth=i_xau_width, editable=false, show_last=i_pair_offset)
plot(show_NZD and show_lines? NZD : na, title='NZD', color=c_nzd, linewidth=i_nzd_width, editable=false, show_last=i_pair_offset)
plot(show_CAD and show_lines? CAD : na, title='CAD', color=c_cad, linewidth=i_cad_width, editable=false, show_last=i_pair_offset)
plot(show_CHF and show_lines? CHF : na, title='CHF', color=c_chf, linewidth=i_chf_width, editable=false, show_last=i_pair_offset)
plot(show_AUD and show_lines? AUD : na, title='AUD', color=c_aud, linewidth=i_aud_width, editable=false, show_last=i_pair_offset)
plot(show_GBP and show_lines? GBP : na, title='GBP', color=c_gbp, linewidth=i_gbp_width, editable=false, show_last=i_pair_offset)
plot(show_JPY and show_lines? JPY : na, title='JPY', color=c_jpy, linewidth=i_jpy_width, editable=false, show_last=i_pair_offset)
plot(show_EUR and show_lines? EUR : na, title='EUR', color=c_eur, linewidth=i_eur_width, editable=false, show_last=i_pair_offset)
plot(show_USD and show_lines? USD : na, title='USD', color=c_usd, linewidth=i_usd_width, editable=false, show_last=i_pair_offset)

plot(show_OIL and show_fill ? OIL : na, title='OIL', color=color.new(c_oil, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_XAG and show_fill ? XAG : na, title='XAG', color=color.new(c_xag, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_XAU and show_fill ? XAU : na, title='XAU', color=color.new(c_xau, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_NZD and show_fill ? NZD : na, title='NZD', color=color.new(c_nzd, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_CAD and show_fill ? CAD : na, title='CAD', color=color.new(c_cad, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_CHF and show_fill ? CHF : na, title='CHF', color=color.new(c_chf, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_AUD and show_fill ? AUD : na, title='AUD', color=color.new(c_aud, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_GBP and show_fill ? GBP : na, title='GBP', color=color.new(c_gbp, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_JPY and show_fill ? JPY : na, title='JPY', color=color.new(c_jpy, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_EUR and show_fill ? EUR : na, title='EUR', color=color.new(c_eur, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)
plot(show_USD and show_fill ? USD : na, title='USD', color=color.new(c_usd, 92), linewidth=0, style=plot.style_area, editable=false, show_last=i_pair_offset)

line OIL_LINE = na
line XAG_LINE = na
line XAU_LINE = na
line NZD_LINE = na
line CAD_LINE = na
line CHF_LINE = na
line AUD_LINE = na
line GBP_LINE = na
line JPY_LINE = na
line EUR_LINE = na
line USD_LINE = na


if barstate.islast and show_labels and show_lines
    line_extend = extend.none

    if show_OIL
        OIL_LINE := line.new(line_x1, OIL, line_x2, OIL, extend=line_extend, xloc=xloc.bar_time, width=i_oil_width, style=i_line_style, color=c_oil)
        line.delete(OIL_LINE[1])
    if show_XAG
        XAG_LINE := line.new(line_x1, XAG, line_x2, XAG, extend=line_extend, xloc=xloc.bar_time, width=i_xag_width, style=i_line_style, color=c_xag)
        line.delete(XAG_LINE[1])
    if show_XAU
        XAU_LINE := line.new(line_x1, XAU, line_x2, XAU, extend=line_extend, xloc=xloc.bar_time, width=i_xau_width, style=i_line_style, color=c_xau)
        line.delete(XAU_LINE[1])
    if show_NZD
        NZD_LINE := line.new(line_x1, NZD, line_x2, NZD, extend=line_extend, xloc=xloc.bar_time, width=i_nzd_width, style=i_line_style, color=c_nzd)
        line.delete(NZD_LINE[1])
    if show_CAD
        CAD_LINE := line.new(line_x1, CAD, line_x2, CAD, extend=line_extend, xloc=xloc.bar_time, width=i_cad_width, style=i_line_style, color=c_cad)
        line.delete(CAD_LINE[1])
    if show_CHF
        CHF_LINE := line.new(line_x1, CHF, line_x2, CHF, extend=line_extend, xloc=xloc.bar_time, width=i_chf_width, style=i_line_style, color=c_chf)
        line.delete(CHF_LINE[1])
    if show_AUD
        AUD_LINE := line.new(line_x1, AUD, line_x2, AUD, extend=line_extend, xloc=xloc.bar_time, width=i_aud_width, style=i_line_style, color=c_aud)
        line.delete(AUD_LINE[1])
    if show_GBP
        GBP_LINE := line.new(line_x1, GBP, line_x2, GBP, extend=line_extend, xloc=xloc.bar_time, width=i_gbp_width, style=i_line_style, color=c_gbp)
        line.delete(GBP_LINE[1])
    if show_JPY
        JPY_LINE := line.new(line_x1, JPY, line_x2, JPY, extend=line_extend, xloc=xloc.bar_time, width=i_jpy_width, style=i_line_style, color=c_jpy)
        line.delete(JPY_LINE[1])
    if show_EUR
        EUR_LINE := line.new(line_x1, EUR, line_x2, EUR, extend=line_extend, xloc=xloc.bar_time, width=i_eur_width, style=i_line_style, color=c_eur)
        line.delete(EUR_LINE[1])
    if show_USD
        USD_LINE := line.new(line_x1, USD, line_x2, USD, extend=line_extend, xloc=xloc.bar_time, width=i_usd_width, style=i_line_style, color=c_usd)
        line.delete(USD_LINE[1])


// Labels
label OIL_LABEL = na
label USD_LABEL = na
label XAG_LABEL = na
label XAU_LABEL = na
label NZD_LABEL = na
label CAD_LABEL = na
label CHF_LABEL = na
label AUD_LABEL = na
label GBP_LABEL = na
label JPY_LABEL = na
label EUR_LABEL = na

if barstate.islast and show_labels and show_lines
    label_text_color = shouldBeTextBlack ? c_black : color.white

    if show_OIL
        OIL_LABEL := label.new(label_x, OIL, 'OIL', color=c_oil, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(OIL_LABEL[1])
    if show_XAG
        XAG_LABEL := label.new(label_x, XAG, 'XAG', color=c_xag, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(XAG_LABEL[1])
    if show_XAU
        XAU_LABEL := label.new(label_x, XAU, 'XAU', color=c_xau, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(XAU_LABEL[1])
    if show_NZD
        NZD_LABEL := label.new(label_x, NZD, 'NZD', color=c_nzd, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(NZD_LABEL[1])
    if show_CAD
        CAD_LABEL := label.new(label_x, CAD, 'CAD', color=c_cad, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(CAD_LABEL[1])
    if show_CHF
        CHF_LABEL := label.new(label_x, CHF, 'CHF', color=c_chf, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(CHF_LABEL[1])
    if show_AUD
        AUD_LABEL := label.new(label_x, AUD, 'AUD', color=c_aud, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(AUD_LABEL[1])
    if show_GBP
        GBP_LABEL := label.new(label_x, GBP, 'GBP', color=c_gbp, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(GBP_LABEL[1])
    if show_JPY
        JPY_LABEL := label.new(label_x, JPY, 'JPY', color=c_jpy, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(JPY_LABEL[1])
    if show_EUR
        EUR_LABEL := label.new(label_x, EUR, 'EUR', color=c_eur, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(EUR_LABEL[1])
    if show_USD
        USD_LABEL := label.new(label_x, USD, 'USD', color=c_usd, xloc=xloc.bar_time, textcolor=label_text_color, style=i_label_style, size=i_label_size)
        label.delete(USD_LABEL[1])

////////////////////
// Delta
////////////////////
DELTA_EURUSD = math.abs(EUR-USD)
DELTA_USDJPY = math.abs(USD-JPY)
DELTA_USDCHF = math.abs(USD-CHF)
DELTA_GBPUSD = math.abs(GBP-USD)
DELTA_AUDUSD = math.abs(AUD-USD)
DELTA_USDCAD = math.abs(USD-CAD)
DELTA_NZDUSD = math.abs(NZD-USD)
DELTA_GBPJPY = math.abs(GBP-JPY)

delta_pairs = array.new_float(8)
array.set(delta_pairs, 0, DELTA_EURUSD)
array.set(delta_pairs, 1, DELTA_USDJPY)
array.set(delta_pairs, 2, DELTA_USDCHF)
array.set(delta_pairs, 3, DELTA_GBPUSD)
array.set(delta_pairs, 4, DELTA_AUDUSD)
array.set(delta_pairs, 5, DELTA_USDCAD)
array.set(delta_pairs, 6, DELTA_NZDUSD)
array.set(delta_pairs, 7, DELTA_GBPJPY)
array.sort(delta_pairs, order.descending)

label delta_1 = na
label delta_2 = na
label delta_3 = na
label delta_4 = na
label delta_5 = na
label delta_6 = na
label delta_7 = na
label delta_8 = na

if barstate.islast and show_pair
    delta_positions = array.new_int(8)
    delta_labels = array.new_string(8)
    
    for i = 0 to 7
        array.set(delta_positions, i, i * -7)
        array.set(delta_labels, i, get_pair_by_value(array.get(delta_pairs, i), DELTA_EURUSD, DELTA_USDJPY, DELTA_USDCHF, DELTA_GBPUSD, DELTA_AUDUSD, DELTA_USDCAD, DELTA_NZDUSD, DELTA_GBPJPY))

    x1 = bar_index - (i_pair_offset + i_pair_margin)
    delta_1 := label.new(x1 + array.get(delta_positions, 0), 0, array.get(delta_labels, 0), style=label.style_label_up, size=size.small, color=noneColor, textcolor=i_pair_labelcolor)
    delta_2 := label.new(x1 + array.get(delta_positions, 1), 0, array.get(delta_labels, 1), style=label.style_label_up, size=size.small, color=noneColor, textcolor=i_pair_labelcolor)
    delta_3 := label.new(x1 + array.get(delta_positions, 2), 0, array.get(delta_labels, 2), style=label.style_label_up, size=size.small, color=noneColor, textcolor=i_pair_labelcolor)
    delta_4 := label.new(x1 + array.get(delta_positions, 3), 0, array.get(delta_labels, 3), style=label.style_label_up, size=size.small, color=noneColor, textcolor=i_pair_labelcolor)
    delta_5 := label.new(x1 + array.get(delta_positions, 4), 0, array.get(delta_labels, 4), style=label.style_label_up, size=size.small, color=noneColor, textcolor=i_pair_labelcolor)
    delta_6 := label.new(x1 + array.get(delta_positions, 5), 0, array.get(delta_labels, 5), style=label.style_label_up, size=size.small, color=noneColor, textcolor=i_pair_labelcolor)
    delta_7 := label.new(x1 + array.get(delta_positions, 6), 0, array.get(delta_labels, 6), style=label.style_label_up, size=size.small, color=noneColor, textcolor=i_pair_labelcolor)
    delta_8 := label.new(x1 + array.get(delta_positions, 7), 0, array.get(delta_labels, 7), style=label.style_label_up, size=size.small, color=noneColor, textcolor=i_pair_labelcolor)
    label.delete(delta_1[1])
    label.delete(delta_2[1])
    label.delete(delta_3[1])
    label.delete(delta_4[1])
    label.delete(delta_5[1])
    label.delete(delta_6[1])
    label.delete(delta_7[1])
    label.delete(delta_8[1])

plot(show_pair ? (array.get(delta_pairs, 0)) : na, style=plot.style_histogram, linewidth=12, show_last=1, editable=false, offset=-i_pair_offset-i_pair_margin-7*0, color=ac.gogh_cafeterrace('yellow'))
plot(show_pair ? (array.get(delta_pairs, 1)) : na, style=plot.style_histogram, linewidth=12, show_last=1, editable=false, offset=-i_pair_offset-i_pair_margin-7*1, color=ac.gogh_cafeterrace('yellow'))
plot(show_pair ? (array.get(delta_pairs, 2)) : na, style=plot.style_histogram, linewidth=12, show_last=1, editable=false, offset=-i_pair_offset-i_pair_margin-7*2, color=ac.gogh_cafeterrace('orange'))
plot(show_pair ? (array.get(delta_pairs, 3)) : na, style=plot.style_histogram, linewidth=12, show_last=1, editable=false, offset=-i_pair_offset-i_pair_margin-7*3, color=ac.gogh_cafeterrace('orange'))
plot(show_pair ? (array.get(delta_pairs, 4)) : na, style=plot.style_histogram, linewidth=12, show_last=1, editable=false, offset=-i_pair_offset-i_pair_margin-7*4, color=ac.gogh_cafeterrace('light-blue'))
plot(show_pair ? (array.get(delta_pairs, 5)) : na, style=plot.style_histogram, linewidth=12, show_last=1, editable=false, offset=-i_pair_offset-i_pair_margin-7*5, color=ac.gogh_cafeterrace('light-blue'))
plot(show_pair ? (array.get(delta_pairs, 6)) : na, style=plot.style_histogram, linewidth=12, show_last=1, editable=false, offset=-i_pair_offset-i_pair_margin-7*6, color=ac.gogh_cafeterrace('blue'))
plot(show_pair ? (array.get(delta_pairs, 7)) : na, style=plot.style_histogram, linewidth=12, show_last=1, editable=false, offset=-i_pair_offset-i_pair_margin-7*7, color=ac.gogh_cafeterrace('blue'))

////////////////////
// Analysis
////////////////////
sorted_by_ranking_names = array.new_string(8)
values = array.new_float(8)

if barstate.islast
    array.set(values, 0, EUR)
    array.set(values, 1, USD)
    array.set(values, 2, JPY)
    array.set(values, 3, CHF)
    array.set(values, 4, GBP)
    array.set(values, 5, AUD)
    array.set(values, 6, CAD)
    array.set(values, 7, NZD)
    array.sort(values, order.descending)
    

////////////////////
// Panel
////////////////////
[border_color, border_width, frame_color, frame_width, text_color, text_size, bgcolor, head_text_color, head_text_size, head_bgcolor] = mycolor.theme(i_panel_theme)

if is_multi and shouldBeTextBlack
    text_color := c_black
    head_text_color := c_black

// Table
if barstate.islast
    table panel = table.new(i_panel_position, 4, 8, border_color=border_color, border_width=border_width, frame_color=frame_color, frame_width=frame_width)

    for i = 0 to array.size(values) - 1 by 1
        value = array.get(values, i)
        n = get_name_by_value(value, EUR, USD, JPY, CHF, GBP, AUD, CAD, NZD)
        f = get_flag_by_value(value, EUR, USD, JPY, CHF, GBP, AUD, CAD, NZD)
        c = get_color_by_value(value, EUR, USD, JPY, CHF, GBP, AUD, CAD, NZD)
        v = str.format('{0, number, #.#}', value)
        r = str.tostring(i + 1)
    
        if not na(n)
            array.set(sorted_by_ranking_names, i, n)
    
        if show_panel
            head_bgcolor := is_multi ? c : head_bgcolor
            bgcolor      := is_multi ? c : bgcolor
            table.cell(panel, 0, i, r, bgcolor=head_bgcolor, text_color=head_text_color, text_size=i_panel_textsize)
            table.cell(panel, 1, i, f, bgcolor=bgcolor, text_color=text_color, text_size=i_panel_flagsize)
            table.cell(panel, 2, i, n, bgcolor=bgcolor, text_color=text_color, text_size=i_panel_textsize, text_halign=text.align_left)
            table.cell(panel, 3, i, v, bgcolor=bgcolor, text_color=text_color, text_size=i_panel_textsize, text_halign=text.align_right)

////////////////////
// Alerts
////////////////////
string the_strongest_name = na
string the_weakest_name = na

if barstate.islast and barstate.isrealtime
    float max_value = array.max(values)
    float min_value = array.min(values)
    the_strongest_name := get_name_by_value(max_value, EUR, USD, JPY, CHF, GBP, AUD, CAD, NZD)
    the_weakest_name := get_name_by_value(min_value, EUR, USD, JPY, CHF, GBP, AUD, CAD, NZD)
    bool strongest_value_changed = the_strongest_name != the_strongest_name[1]
    bool weakest_value_changed = the_weakest_name != the_weakest_name[1]
    string alert_message = array.join(sorted_by_ranking_names, ' > ')
    
    if strongest_value_changed or weakest_value_changed
        alert('NEW UPDATE: ' + alert_message, alert.freq_once_per_bar_close)

Overview

Currency Strength Chart calculates values from price or oscillator sources such as RSI, CCI or Stochastics then smooths the result. Users choose auto or manual currency selection, resolution mode, lookback periods, smoothing type and broker for ticker mapping. The indicator draws selectable lines or histogram bars for the chosen currencies and supports multiple timeframes via resolution settings.

Details

Published by

itmakesyousick on GitHub

Code credit

boitoki, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum

Markets

Forex

Timeframes

Any timeframe

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.

Topics

pinescript

Settings

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

SettingTypeDefaultVariable
Modestringt_reso_autoi_reso_mode
ResolutiontimeframeDi_reso_value
Lookback periodsint100Lookback periods
BrokersstringOANDAi_broker
Sourcesourceclosei_source
Calculate bystringPricei_calc
i_lengthint7i_length
SmoothingstringSMAi_smoothtype
i_smoothint1i_smooth
Auto selectedstringNois_autoSelect
is_histogramstringLines onlyis_histogram
EURbooltrueshow_EUR
Show all 40 settings
SettingTypeDefaultVariable
c_eurcolorcolor.redc_eur
i_eur_widthint2i_eur_width
USDbooltrueshow_USD
c_usdcolorcolor.orangec_usd
i_usd_widthint2i_usd_width
JPYbooltrueshow_JPY
c_jpycolorcolor.aquac_jpy
i_jpy_widthint2i_jpy_width
GBPbooltrueshow_GBP
c_gbpcolorcolor.greenc_gbp
i_gbp_widthint2i_gbp_width
CHFbooltrueshow_CHF
c_chfcolorcolor.maroonc_chf
i_chf_widthint2i_chf_width
AUDbooltrueshow_AUD
c_audcolorcolor.bluec_aud
i_aud_widthint2i_aud_width
CADbooltrueshow_CAD
c_cadcolorcolor.purplec_cad
i_cad_widthint2i_cad_width
NZDbooltrueshow_NZD
c_nzdcolorcolor.fuchsiac_nzd
i_nzd_widthint2i_nzd_width
XAUboolfalseshow_XAU
c_xaucolor#D7BE69c_xau
i_xau_widthint2i_xau_width
XAGboolfalseshow_XAG
c_xagcolorcolor.silverc_xag
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

Asymmetrical RSI

by everget
948 stars

Asymmetrical RSI is an indicator that computes a custom relative strength index from the rate of change of a user-selected source. It plots the resulting ARSI line in a separate pane with color coding that turns green above the overbought level and red below t

Indicator v4 Oscillators & momentum
Updated 10 days ago · GPL-3.0 GitHub repository of Asymmetrical RSI

This indicator calculates momentum setups based on the Relative Strength Index (RSI) and plots in a separate pane. It offers multiple scanning modes such as Continuous Break, Continuous Retracement, Flip Break, Flip Retracement, and both regular and hidden div

Indicator v6 Oscillators & momentumDivergence Repaints
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - RSI Directional Momentum Indicator

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop
261 stars

This indicator demonstrates an experimental graph-style scatter visualization within a separate pane using Pine Script arrays. It tracks two features across recent bars: the single-bar price change and a scaled 14-period Relative Strength Index. Values are loa

Indicator v4 Oscillators & momentum
Updated 4 years ago · None stated GitHub repository of Example: Graph Style - 4th Dimension RSI

KD指標

by TaichiS
219 stars

This script calculates and plots a Stochastic Oscillator (KD indicator) in a separate chart pane. It determines the fast stochastic value over a 9-period lookback, then applies a 3-period Simple Moving Average (SMA) to create the %K line, and a second 3-period

Indicator v4 Oscillators & momentum
Updated 5 years ago · None stated GitHub repository of KD指標

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