Indicator · Pine Script v5 · Own pane

Currency Strength Chart

by itmakesyousick· code credited to boitoki

The script calculates and plots relative currency strengths for major pairs including EUR, USD, JPY, GBP, CHF, AUD, CAD and NZD in a separate pane.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code624
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

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

v28.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/1 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'

////////////////////
//
////////////////////
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)
        'Stochastics' => ta.sma(ta.stoch(_source, high, low, _length), _smooth)
        => _source

////////////////////
// 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', 'Stochastics', 'CCI'], 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)

////////////////////
// Switches
////////////////////
show_EUR = input.bool(title='EUR', defval=true, group=GP2, inline="display")
show_USD = input.bool(title='USD', defval=true, group=GP2, inline="display")
show_JPY = input.bool(title='JPY', defval=true, group=GP2, inline="display")
show_GBP = input.bool(title='GBP', defval=true, group=GP2, inline="display")
show_CHF = input.bool(title='CHF', defval=true, group=GP2, inline="display")
show_AUD = input.bool(title='AUD', defval=true, group=GP2, inline="display")
show_CAD = input.bool(title='CAD', defval=true, group=GP2, inline="display")
show_NZD = input.bool(title='NZD', defval=true, group=GP2, inline="display")
show_XAU = input.bool(title='XAU', defval=false, group=GP2, inline="display")
show_XAG = input.bool(title='XAG', defval=false, group=GP2, inline="display")
show_OIL = input.bool(title='OIL', defval=false, group=GP2, inline="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_inverted = input.string('Ordered', title='', options=['Ordered', 'Inverted'], inline='10', group=GP2) == 'Inverted'
is_histogram_without_lines = is_histogram == 'Without lines'
bool show_fill = is_autoSelect
bool show_histogram = is_autoSelect and is_histogram != 'Lines only'

if is_autoSelect
    show_EUR := false, show_USD := false, show_JPY := false
    show_GBP := false, show_CHF := false, show_AUD := false
    show_CAD := false, show_NZD := false, show_XAU := false
    show_XAG := false, show_OIL := false

string currency_a = na
string currency_b = na

if (str.length(str.replace_all(syminfo.ticker, 'EUR', '')) < 6)
    show_EUR := not is_histogram_without_lines, currency_a := 'EUR'
if (str.length(str.replace_all(syminfo.ticker, 'USD', '')) < 6)
    show_USD := not is_histogram_without_lines, currency_a := 'USD'
if (str.length(str.replace_all(syminfo.ticker, 'JPY', '')) < 6)
    show_JPY := not is_histogram_without_lines, currency_a := 'JPY'
if (str.length(str.replace_all(syminfo.ticker, 'GBP', '')) < 6)
    show_GBP := not is_histogram_without_lines, currency_a := 'GBP'
if (str.length(str.replace_all(syminfo.ticker, 'CHF', '')) < 6)
    show_CHF := not is_histogram_without_lines, currency_a := 'CHF'
if (str.length(str.replace_all(syminfo.ticker, 'AUD', '')) < 6)
    show_AUD := not is_histogram_without_lines, currency_a := 'AUD'
if (str.length(str.replace_all(syminfo.ticker, 'CAD', '')) < 6)
    show_CAD := not is_histogram_without_lines, currency_a := 'CAD'
if (str.length(str.replace_all(syminfo.ticker, 'NZD', '')) < 6)
    show_NZD := not is_histogram_without_lines, currency_a := 'NZD'
if (str.length(str.replace_all(syminfo.ticker, 'XAU', '')) < 6)
    show_XAU := true
if (str.length(str.replace_all(syminfo.ticker, 'XAG', '')) < 6)
    show_XAG := true
if (str.length(str.replace_all(syminfo.ticker, 'OIL', '')) < 6)
    show_OIL := true

if not na(currency_a)
    currency_b := str.replace_all(syminfo.ticker, currency_a, '')

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

// Colors
c_eur = input.color(title='EUR', defval=color.red, group=GP3, inline="color")
c_usd = input.color(title='USD', defval=color.orange, group=GP3, inline="color")
c_jpy = input.color(title='JPY', defval=color.aqua, group=GP3, inline="color")
c_gbp = input.color(title='GBP', defval=color.green, group=GP3, inline="color")
c_chf = input.color(title='CHF', defval=color.maroon, group=GP3, inline="color")
c_aud = input.color(title='AUD', defval=color.blue, group=GP3, inline="color")
c_cad = input.color(title='CAD', defval=color.purple, group=GP3, inline="color")
c_nzd = input.color(title='NZD', defval=color.fuchsia, group=GP3, inline="color")
c_xau = input.color(title='XAU', defval=#D7BE69, group=GP3, inline="color")
c_xag = input.color(title='XAG', defval=color.silver, group=GP3, inline="color")
c_oil = input.color(title='OIL', defval=#745433, group=GP3, inline="color")
color c_green = ac.tradingview('green')
color c_red = ac.tradingview('red')
color c_black = ac.tradingview('black')
i_theme = input.string(title="Color theme", defval="monokai", options=["monokai", "monokai pro", "customize"], group=GP3)
is_monokai = (i_theme == 'monokai' or i_theme == 'monokai pro')

// Color themes
if i_theme == "monokai"
    c_eur := mycolor.monokai('pink')
    c_usd := mycolor.monokai('orange')
    c_gbp := mycolor.monokai('green')
    c_cad := mycolor.monokai('purple')
    c_aud := mycolor.monokai('blue')
    c_chf := mycolor.monokai('yellow')
    c_green := mycolor.monokai('green')
    c_red := mycolor.monokai('pink')
    c_black := mycolor.monokai('black')
else if i_theme == "monokai pro"
    c_eur := mycolor.monokaipro('pink')
    c_usd := mycolor.monokaipro('orange')
    c_gbp := mycolor.monokaipro('green')
    c_cad := mycolor.monokaipro('purple')
    c_aud := mycolor.monokaipro('blue')
    c_chf := mycolor.monokaipro('yellow')
    c_green := mycolor.monokaipro('green')
    c_red := mycolor.monokaipro('pink')
    c_black := mycolor.monokaipro('black')

////////////////////
// Other settings
////////////////////
// Lines
show_lines = true
line_x1 = time
line_width = input.int(title='Line width', defval=2, minval=1, group=GP7)
is_line_extend = input.string(title='Line extend', defval="No", options=["Yes", "No"], group=GP7, inline="line_extend") == "Yes"
line_style = input.string(title='', defval=line.style_dotted, options=[line.style_solid, line.style_dotted, line.style_dashed], group=GP7, inline="line_extend")

// Labels
show_labels = input.bool(title='Name label', defval=true, group=GP8)
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)
label_offset = input.int(title='Label offset', defval=5, minval=0, group=GP8)
label_style = label.style_label_left
label_x = time + timeframe.multiplier * 60 * 1000 * label_offset

line_x2 = is_line_extend ? time + 1000 : label_x

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

// Currency pair strength
show_pair = input.bool(title="Currency pair strength", defval=false, group=GP9)
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
pair_margin = input.int(defval=4, title="Position margin", options=[0,2,4,6,8,10,16,20], group=GP9)
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)
color c_levels = show_levels ? color.gray : na


////////////////////
// Functions
////////////////////
ma_function(type, src, len) => ma.ma_function(type, src, len)

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_b_value - currency_a_value) * (is_histogram_inverted ? -1 : 1)
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=pair_offset)

// Lines
plot(show_OIL ? OIL : na, title='OIL', color=c_oil, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_XAG ? XAG : na, title='XAG', color=c_xag, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_XAU ? XAU : na, title='XAU', color=c_xau, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_NZD ? NZD : na, title='NZD', color=c_nzd, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_CAD ? CAD : na, title='CAD', color=c_cad, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_CHF ? CHF : na, title='CHF', color=c_chf, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_AUD ? AUD : na, title='AUD', color=c_aud, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_GBP ? GBP : na, title='GBP', color=c_gbp, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_JPY ? JPY : na, title='JPY', color=c_jpy, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_EUR ? EUR : na, title='EUR', color=c_eur, linewidth=line_width, editable=false, show_last=pair_offset)
plot(show_USD ? USD : na, title='USD', color=c_usd, linewidth=line_width, editable=false, show_last=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=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=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=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=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=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=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=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=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=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=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=pair_offset)

if show_lines
    line_extend = is_line_extend ? extend.right : extend.none

    if show_OIL
        OIL_LINE = line.new(line_x1, OIL, line_x2, OIL, extend=line_extend, xloc=xloc.bar_time, width=line_width, style=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=line_width, style=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=line_width, style=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=line_width, style=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=line_width, style=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=line_width, style=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=line_width, style=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=line_width, style=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=line_width, style=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=line_width, style=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=line_width, style=line_style, color=c_usd)
        line.delete(USD_LINE[1])


// Labels
if show_labels
    label_text_color = is_monokai ? c_black : color.white

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

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

// Table
table panel = table.new(panel_position, 4, 8, border_color=border_color, border_width=border_width, frame_color=frame_color, frame_width=frame_width)


if barstate.islast
    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=panel_text_size)
            table.cell(panel, 1, i, f, bgcolor=bgcolor, text_color=text_color, text_size=panel_flag_size)
            table.cell(panel, 2, i, n, bgcolor=bgcolor, text_color=text_color, text_size=panel_text_size, text_halign=text.align_left)
            table.cell(panel, 3, i, v, bgcolor=bgcolor, text_color=text_color, text_size=panel_text_size, 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

Strength is derived from RSI, CCI, Stochastics or raw Price source, optionally smoothed and filtered by length. Users select calculation mode, lookback periods, resolution timeframe, broker symbol and which pairs to display. It renders lines or bars showing comparative strength levels for visual reference only. No entry or exit signals are generated.

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
EURbooltrueshow_EUR
USDbooltrueshow_USD
JPYbooltrueshow_JPY
Show all 40 settings
SettingTypeDefaultVariable
GBPbooltrueshow_GBP
CHFbooltrueshow_CHF
AUDbooltrueshow_AUD
CADbooltrueshow_CAD
NZDbooltrueshow_NZD
XAUboolfalseshow_XAU
XAGboolfalseshow_XAG
OILboolfalseshow_OIL
Auto selectedstringNois_autoSelect
is_histogramstringLines onlyis_histogram
is_histogram_invertedstringOrderedis_histogram_inverted
EURcolorcolor.redc_eur
USDcolorcolor.orangec_usd
JPYcolorcolor.aquac_jpy
GBPcolorcolor.greenc_gbp
CHFcolorcolor.maroonc_chf
AUDcolorcolor.bluec_aud
CADcolorcolor.purplec_cad
NZDcolorcolor.fuchsiac_nzd
XAUcolor#D7BE69c_xau
XAGcolorcolor.silverc_xag
OILcolor#745433c_oil
Color themestringmonokaii_theme
Line widthint2line_width
Line extendstringNois_line_extend
line_stylestringline.style_dottedline_style
Name labelbooltrueshow_labels
Label sizestringsize.normallabel_size
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