Musashi_Katana
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Musashi-Alchemist

//@version=5
indicator(title='Musashi_Katana', format=format.price, overlay=true, max_bars_back=5000, max_lines_count=500, max_labels_count=500)

//==============================================================================
// === STRATEGY INPUTS ===
//==============================================================================

//------------------------------------------------------------------------------
ama_0_bool = input.bool(false, title="AMA - Short Term  ", group='ADAPTATIVE MOVING AVERAGE - TREND STRATEGIES', inline='ama')
ama_mid_bool = input.bool(true, title="AMA - Mid Term  ", group='ADAPTATIVE MOVING AVERAGE - TREND STRATEGIES', inline='ama')
ama_3_bool = input.bool(false, title="AMA - Long Term  ", group='ADAPTATIVE MOVING AVERAGE - TREND STRATEGIES', inline='ama')
//------------------------------------------------------------------------------
vwap_1w_bool = input.bool(false, title="VWAP - 1W      ", group='MULTI TIMEFRAME - TREND STRATEGIES', inline='vwap')
vwap_1m_bool = input.bool(false, title="VWAP - 1M      ", group='MULTI TIMEFRAME - TREND STRATEGIES', inline='vwap')
vwap_1y_bool = input.bool(false, title="VWAP - 1Y", group='MULTI TIMEFRAME - TREND STRATEGIES', inline='vwap')
//------------------------------------------------------------------------------
ema_4h_bool = input.bool(false, title="EMA - 4H        ", group='MULTI TIMEFRAME - TREND STRATEGIES', inline='mtema')
ema_daily_bool = input.bool(false, title="EMA - Daily     ", group='MULTI TIMEFRAME - TREND STRATEGIES', inline='mtema')
ema_weekly_bool = input.bool(false, title="EMA - Weekly", group='MULTI TIMEFRAME - TREND STRATEGIES', inline='mtema')
//------------------------------------------------------------------------------
ema_1_bool = input.bool(false, title="EMA 1   ", group='EMA - TREND STRATEGIES', inline='ema')
ema_2_bool = input.bool(false, title="EMA 2   ", group='EMA - TREND STRATEGIES', inline='ema')
ema_3_bool = input.bool(true, title="EMA 3   ", group='EMA - TREND STRATEGIES', inline='ema')
ema_4_bool = input.bool(false, title="EMA 4   ", group='EMA - TREND STRATEGIES', inline='ema')
ema_5_bool = input.bool(false, title="EMA 5   ", group='EMA - TREND STRATEGIES', inline='ema')
//------------------------------------------------------------------------------
ssl_1_bool = input.bool(false, title="SSL 1 - Current TF  ", group='SSL - TREND STRATEGIES', inline='ssl_1')
ssl_1_period = input.int(21, title="", group='SSL - TREND STRATEGIES', inline='ssl_1')
ssl_2_bool = input.bool(false, title="SSL 2 - Multi TF    ", group='SSL - TREND STRATEGIES', inline='ssl_2')
ssl_2_period = input.int(21, title="", group='SSL - TREND STRATEGIES', inline='ssl_2')
ssl_2_tf = input.string('1D', title="TF", group='SSL - TREND STRATEGIES', inline='ssl_2')
//------------------------------------------------------------------------------
ki_bool = input.bool(false, title="Kijun-Sen    ", group='BASELINE - KIJUN-SEN', inline='kijunsen_a')
ki_Length = input.int(21, 'Length', minval=1, group='BASELINE - KIJUN-SEN', inline='kijunsen_a')
ki_atr_bands_bool = input.bool(false, title="ATR Bands   ", group='BASELINE - KIJUN-SEN', inline='kijunsen_b')
ki_atr_len = input.int(34, 'Length', minval=1, group='BASELINE - KIJUN-SEN', inline='kijunsen_b')
ki_atr_multip = input.float(1, 'Multip', minval=1, group='BASELINE - KIJUN-SEN', inline='kijunsen_b')
//------------------------------------------------------------------------------
ama_base_bool = input.bool(false, title="AMA", group='BASELINE - AMA', inline='ama_base_a')
ama_base_length = input.int(title='', defval=55, group='BASELINE - AMA', inline='ama_base_a')
ama_base_fastLength = input.int(title='Fast', defval=3, group='BASELINE - AMA', inline='ama_base_a')
ama_base_slowLength = input.int(title='Slow', defval=13, group='BASELINE - AMA', inline='ama_base_a')
ama_base_highlightMovements = true
ama_base_src = close
ama_base_atr_bands_bool = input.bool(false, title="ATR Bands    ", group='BASELINE - AMA', inline='ama_base_b')
ama_base_atr_len = input.int(13, 'ATR Length', minval=1, group='BASELINE - AMA', inline='ama_base_b')
ama_base_atr_multip = input.float(1, 'ATR Multip', group='BASELINE - AMA', inline='ama_base_b')
//------------------------------------------------------------------------------
ama_0_length = input.int(title='AMA 0', defval=21, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_0')
ama_0_fastLength = input.int(title='Fast', defval=2, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_0')
ama_0_slowLength = input.int(title='Slow', defval=13, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_0')
ama_0_highlightMovements = input.bool(title='', defval=true, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_0')
ama_0_src = close
//------------------------------------------------------------------------------
ama_1_length = input.int(title='AMA 1', defval=55, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_1')
ama_1_fastLength = input.int(title='Fast', defval=5, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_1')
ama_1_slowLength = input.int(title='Slow', defval=55, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_1')
ama_1_highlightMovements = input.bool(title='', defval=true, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_1')
ama_1_src = close
//------------------------------------------------------------------------------
ama_2_length = input.int(title='AMA 2', defval=55, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_2')
ama_2_fastLength = input.int(title='Fast', defval=7, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_2')
ama_2_slowLength = input.int(title='Slow', defval=13, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_2')
ama_2_highlightMovements = input.bool(title='', defval=true, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_2')
ama_2_src = close
//------------------------------------------------------------------------------
ama_3_length = input.int(title='AMA 3', defval=55, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_3')
ama_3_fastLength = input.int(title='Fast', defval=13, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_3')
ama_3_slowLength = input.int(title='Slow', defval=13, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_3')
ama_3_highlightMovements = input.bool(title='', defval=true, group='AMA - ADAPTATIVE MOVING AVERAGE', inline='ama_3')
ama_3_src = close
//------------------------------------------------------------------------------
tf_4h_ema = input.timeframe('240', title = "EMA - Short Term", group='MULTIME EMA - Exponential Moving Average', inline='emas_all_1')
length_4h_ema_fast = input.int(21, title="Fast", group='MULTIME EMA - Exponential Moving Average', inline='emas_all_1')
length_4h_ema_slow = input.int(55, title="Slow", group='MULTIME EMA - Exponential Moving Average', inline='emas_all_1')
//------------------------------------------------------------------------------
tf_daily_ema = input.timeframe('D', title = "EMA - Mid Term ", group='MULTIME EMA - Exponential Moving Average', inline='emas_all_2')
length_daily_ema_fast = input.int(21, title="Fast", group='MULTIME EMA - Exponential Moving Average', inline='emas_all_2')
length_daily_ema_slow = input.int(55, title="Slow", group='MULTIME EMA - Exponential Moving Average', inline='emas_all_2')
//------------------------------------------------------------------------------
tf_weekly_ema = input.timeframe('W', title = "EMA - Long Term", group='MULTIME EMA - Exponential Moving Average', inline='emas_all_3')
length_weekly_ema_fast = input.int(21, title="Fast", group='MULTIME EMA - Exponential Moving Average', inline='emas_all_3')
length_weekly_ema_slow = input.int(55, title="Slow", group='MULTIME EMA - Exponential Moving Average', inline='emas_all_3')
//------------------------------------------------------------------------------

//==============================================================================
// === EMA SETUP ===
//==============================================================================

//------------------------------------------------------------------------------
ema_4h_1 = ema_4h_bool ? request.security(syminfo.ticker, tf_4h_ema, ta.ema(close, length_4h_ema_fast)) : 0
ema_4h_2 = ema_4h_bool ? request.security(syminfo.ticker, tf_4h_ema, ta.ema(close, length_4h_ema_slow)) : 0
ema_daily_1 = ema_daily_bool ? request.security(syminfo.ticker, tf_daily_ema, ta.ema(close, length_daily_ema_fast)) : 0
ema_daily_2 = ema_daily_bool ? request.security(syminfo.ticker, tf_daily_ema, ta.ema(close, length_daily_ema_slow)) : 0
ema_weekly_1 = ema_weekly_bool ? request.security(syminfo.ticker, tf_weekly_ema, ta.ema(close, length_weekly_ema_fast)) : 0
ema_weekly_2 = ema_weekly_bool ? request.security(syminfo.ticker, tf_weekly_ema, ta.ema(close, length_weekly_ema_slow)) : 0
//------------------------------------------------------------------------------
plot(ema_4h_bool ? ema_4h_1 : na,"4H EMA Fast",color.new(#d1d4dc, 64),linewidth=1)
plot(ema_4h_bool ? ema_4h_2 : na,"4H EMA Slow",color.new(#5b9cf6, 45),linewidth=1)
plot(ema_daily_bool ? ema_daily_1 : na,"Daily EMA Fast",color.new(#a10b0b, 24),linewidth=2)
plot(ema_daily_bool ? ema_daily_2 : na,"Daily EMA Slow",color.new(color.gray, 42),linewidth=2)
plot(ema_weekly_bool ? ema_weekly_1 : na,"Weekly EMA Fast",color.new(#a10b0b, 65),linewidth=4)
plot(ema_weekly_bool ? ema_weekly_2 : na,"Weekly EMA Slow",color.new(color.gray, 28),linewidth=4)
//------------------------------------------------------------------------------
ema1_period = input.int(9, minval=1, title="EMA 1", group='EMA - Exponential Moving Average', inline='emas_all_1')
ema2_period = input.int(21, minval=1, title="EMA 2", group='EMA - Exponential Moving Average', inline='emas_all_1')
ema3_period = input.int(55, minval=1, title="EMA 3", group='EMA - Exponential Moving Average', inline='emas_all_1')
ema4_period = input.int(144, minval=1, title="EMA 4", group='EMA - Exponential Moving Average', inline='emas_all_2')
ema5_period = input.int(233, minval=1, title="EMA 5", group='EMA - Exponential Moving Average', inline='emas_all_2')
//------------------------------------------------------------------------------
ema1 = ta.ema(close, ema1_period)
ema2 = ta.ema(close, ema2_period)
ema3 = ta.ema(close, ema3_period)
ema4 = ta.ema(close, ema4_period)
ema5 = ta.ema(close, ema5_period)
//------------------------------------------------------------------------------
plot(ema_1_bool ? ema1 : na,"EMA 1",linewidth=2, color=color.new(#d1d4dc, 50))
plot(ema_2_bool ? ema2 : na,"EMA 2",linewidth=2, color=color.new(#a10b0b, 25))
plot(ema_3_bool ? ema3 : na,"EMA 3",linewidth=2, color=color.new(#e92727, 20))
plot(ema_4_bool ? ema4 : na,"EMA 4",linewidth=3, color=color.new(#9598a1, 30))
plot(ema_5_bool ? ema5 : na,"EMA 5",linewidth=3, color=color.new(#434651, 20))
//------------------------------------------------------------------------------

//==============================================================================
// === AMA SETUP ===
//==============================================================================

//------------------------------------------------------------------------------
// AMA 0
//------------------------------------------------------------------------------
ama_0 = 0.0
ama_0_Color = color.white
//------------------------------------------------------------------------------
ama_0_fastAlpha = 2 / (ama_0_fastLength + 1)
ama_0_slowAlpha = 2 / (ama_0_slowLength + 1)
ama_0_hh = ta.highest(ama_0_length + 1)
ama_0_ll = ta.lowest(ama_0_length + 1)
ama_0_mltp = ama_0_hh - ama_0_ll != 0 ? math.abs(2 * ama_0_src - ama_0_ll - ama_0_hh) / (ama_0_hh - ama_0_ll) : 0
ama_0_ssc = ama_0_mltp * (ama_0_fastAlpha - ama_0_slowAlpha) + ama_0_slowAlpha
ama_0 := nz(ama_0[1]) + math.pow(ama_0_ssc, 2) * (ama_0_src - nz(ama_0[1]))
ama_0_Color := ama_0_highlightMovements ? ama_0 > ama_0[1] ? color.new(color.gray,20) : color.new(#f70007,20) : color.new(color.gray,20)
plot((ama_0_bool) ? ama_0 : na, title='AMA 0', linewidth=2, color=ama_0_Color)
//------------------------------------------------------------------------------
// AMA 1
//------------------------------------------------------------------------------
ama_1 = 0.0
ama_1_Color = color.white
//------------------------------------------------------------------------------
ama_1_fastAlpha = 2 / (ama_1_fastLength + 1)
ama_1_slowAlpha = 2 / (ama_1_slowLength + 1)
ama_1_hh = ta.highest(ama_1_length + 1)
ama_1_ll = ta.lowest(ama_1_length + 1)
ama_1_mltp = ama_1_hh - ama_1_ll != 0 ? math.abs(2 * ama_1_src - ama_1_ll - ama_1_hh) / (ama_1_hh - ama_1_ll) : 0
ama_1_ssc = ama_1_mltp * (ama_1_fastAlpha - ama_1_slowAlpha) + ama_1_slowAlpha
ama_1 := nz(ama_1[1]) + math.pow(ama_1_ssc, 2) * (ama_1_src - nz(ama_1[1]))
ama_1_Color := ama_1_highlightMovements ? ama_1 > ama_1[1] ? color.new(color.gray,42) : color.new(#f70007,42) : color.new(color.gray,42)
plot((ama_0_bool or ama_mid_bool) ? ama_1 : na, title='AMA 1', linewidth=2, color=ama_1_Color) // or ama_3_bool
//------------------------------------------------------------------------------
// AMA 2
//------------------------------------------------------------------------------
ama_2 = 0.0
ama_2_Color = color.white
//------------------------------------------------------------------------------
ama_2_fastAlpha = 2 / (ama_2_fastLength + 1)
ama_2_slowAlpha = 2 / (ama_2_slowLength + 1)
ama_2_hh = ta.highest(ama_2_length + 1)
ama_2_ll = ta.lowest(ama_2_length + 1)
ama_2_mltp = ama_2_hh - ama_2_ll != 0 ? math.abs(2 * ama_2_src - ama_2_ll - ama_2_hh) / (ama_2_hh - ama_2_ll) : 0
ama_2_ssc = ama_2_mltp * (ama_2_fastAlpha - ama_2_slowAlpha) + ama_2_slowAlpha
ama_2 := nz(ama_2[1]) + math.pow(ama_2_ssc, 2) * (ama_2_src - nz(ama_2[1]))
ama_2_Color := ama_2_highlightMovements ? ama_2 > ama_2[1] ? color.new(color.gray,50) : color.new(#f70007,50) : color.new(color.gray,50)
plot((ama_3_bool or ama_mid_bool or ama_3_bool) ? ama_2 : na, title='AMA 2', linewidth=2, color=ama_2_Color)
//------------------------------------------------------------------------------
// AMA 3
//------------------------------------------------------------------------------
ama_3_fastAlpha = 2 / (ama_3_fastLength + 1)
ama_3_slowAlpha = 2 / (ama_3_slowLength + 1)
ama_3_hh = ta.highest(ama_3_length + 1)
ama_3_ll = ta.lowest(ama_3_length + 1)
ama_3_mltp = ama_3_hh - ama_3_ll != 0 ? math.abs(2 * ama_3_src - ama_3_ll - ama_3_hh) / (ama_3_hh - ama_3_ll) : 0
ama_3_ssc = ama_3_mltp * (ama_3_fastAlpha - ama_3_slowAlpha) + ama_3_slowAlpha
ama_3 = 0.0
ama_3 := nz(ama_3[1]) + math.pow(ama_3_ssc, 2) * (ama_3_src - nz(ama_3[1]))
ama_3_Color = ama_3_highlightMovements ? ama_3 > ama_3[1] ? color.new(color.gray,50) : color.new(#f70007,50) : color.new(color.gray,50)
plot(ama_3_bool? ama_3 : na, title='AMA 3', linewidth=2, color=ama_3_Color)// : color.new(color.gray,100))
//------------------------------------------------------------------------------

//==============================================================================
//=== VWAP SETUP ===
//==============================================================================

//------------------------------------------------------------------------------
startW = vwap_1w_bool ? request.security(syminfo.tickerid, 'W', time, lookahead=barmerge.lookahead_on) : 0
startM = vwap_1m_bool ? request.security(syminfo.tickerid, 'M', time, lookahead=barmerge.lookahead_on) : 0
startY = vwap_1y_bool ? request.security(syminfo.tickerid, '12M', time, lookahead=barmerge.lookahead_on) : 0
//------------------------------------------------------------------------------
change_1 = vwap_1w_bool ? ta.change(startW) : 0
newSessionW = change_1 ? 1 : 0
change_2 = vwap_1m_bool ? ta.change(startM) : 0
newSessionM = change_2 ? 1 : 0
change_3 = vwap_1y_bool ? ta.change(startY) : 0
newSessionY = change_3 ? 1 : 0
//------------------------------------------------------------------------------
getVWAP(newSession) =>
    p = hlc3 * volume
    p := newSession ? hlc3 * volume : p[1] + hlc3 * volume
    vol = 0.0
    vol := newSession ? volume : vol[1] + volume
    v = p / vol
    Sn = 0.0
    Sn := newSession ? 0 : Sn[1] + volume * (hlc3 - v[1]) * (hlc3 - v)
    std = math.sqrt(Sn / vol)
    [v, std]
//------------------------------------------------------------------------------
[vW, stdevW] = getVWAP(newSessionW)
[vM, stdevM] = getVWAP(newSessionM)
[vY, stdevY] = getVWAP(newSessionY)
//------------------------------------------------------------------------------
vMplotW = plot(vwap_1w_bool? vW : na, title = "Weekly VWAP", color = color.new(#d1d4dc,12), linewidth = 1)
vMplotM = plot(vwap_1m_bool? vM : na, title = "Monthly VWAP", color = color.new(#d1d4dc,12), linewidth = 1)
vMplotY = plot(vwap_1y_bool? vY : na, title = "Yearly VWAP", color = color.new(#d1d4dc,12), linewidth = 2)
//------------------------------------------------------------------------------

//==============================================================================
//=== SSL CHANNEL SETUP ===
//==============================================================================

//------------------------------------------------------------------------------
//SSL 2 CHANNEL SETUP
//------------------------------------------------------------------------------
ssl_1_down = 0.0
ssl_1_up = 0.0
//------------------------------------------------------------------------------
ssl_1_smaHigh = ta.sma(high, ssl_1_period)
ssl_1_smaLow = ta.sma(low, ssl_1_period)
//------------------------------------------------------------------------------
Hlv_1 = 0
Hlv_1 := close > ssl_1_smaHigh ? 1 : close < ssl_1_smaLow ? -1 : Hlv_1[1]
//------------------------------------------------------------------------------
ssl_1_down := Hlv_1 < 0 ? ssl_1_smaHigh : ssl_1_smaLow
ssl_1_up := Hlv_1 < 0 ? ssl_1_smaLow : ssl_1_smaHigh
//------------------------------------------------------------------------------
plot(ssl_1_bool ? ssl_1_down : na, title = "SSL DOWN", linewidth=2, color=color.new(#f57c00,10))
plot(ssl_1_bool ? ssl_1_up : na, title = "SSL UP", linewidth=2, color=color.new(#ffffff,10))
//------------------------------------------------------------------------------
//SSL 2 CHANNEL SETUP
//------------------------------------------------------------------------------
ssl_2_down = 0.0
ssl_2_up = 0.0
//------------------------------------------------------------------------------
ssl_2_smaHigh = ssl_2_bool ? request.security(syminfo.ticker, ssl_2_tf, ta.sma(high, ssl_2_period)) : 0
ssl_2_smaLow = ssl_2_bool ? request.security(syminfo.ticker, ssl_2_tf, ta.sma(low, ssl_2_period)) : 0
//------------------------------------------------------------------------------
if ssl_2_bool
    //--------------------------------------------------------------------------
    Hlv_2 = 0
    Hlv_2 := close > ssl_2_smaHigh ? 1 : close < ssl_2_smaLow ? -1 : Hlv_2[1]
    //--------------------------------------------------------------------------
    ssl_2_down := Hlv_2 < 0 ? ssl_2_smaHigh : ssl_2_smaLow
    ssl_2_up := Hlv_2 < 0 ? ssl_2_smaLow : ssl_2_smaHigh
//------------------------------------------------------------------------------
plot(ssl_2_bool ? ssl_2_down : na, linewidth=3, title = "SSL DOWN", color=color.new(#f57c00,10))
plot(ssl_2_bool ? ssl_2_up : na, linewidth=3, title = "SSL UP", color=color.new(#ffffff,10))
//------------------------------------------------------------------------------

//==============================================================================
// === KIJUN-SEN SETUP ===
//==============================================================================

//------------------------------------------------------------------------------
ki_baseLine = 0.0
ki_up = 0.0
ki_down = 0.0
kjuncol = color.white
//------------------------------------------------------------------------------
donchian(len) =>
    math.avg(ta.lowest(len), ta.highest(len))
//------------------------------------------------------------------------------
ki_atr = ta.atr(ki_atr_len)
ki_baseLine := donchian(ki_Length)
//------------------------------------------------------------------------------
ki_up := ki_baseLine + ki_atr_multip*ki_atr
ki_down := ki_baseLine - ki_atr_multip*ki_atr
//------------------------------------------------------------------------------
kjuncol := close > ki_baseLine ? color.new(color.gray,36) : close < ki_baseLine ? color.new(color.gray,36) : color.new(color.gray,36)
//------------------------------------------------------------------------------
plot(ki_bool ? ki_baseLine : na, color=kjuncol, linewidth=2, title='Kijun-sen')
plot(ki_bool and ki_atr_bands_bool ? ki_up : na, color=color.new(#e65100, 30), linewidth=1, title='Upper ATR')
plot(ki_bool and ki_atr_bands_bool ? ki_down : na, color=color.new(#e65100, 30), linewidth=1, title='Lower ATR')
//------------------------------------------------------------------------------

//==============================================================================
// AMA BASE
//==============================================================================

//------------------------------------------------------------------------------
ama_base = 0.0
ama_base_up = 0.0
ama_base_down = 0.0
ama_base_Color = color.white
//------------------------------------------------------------------------------
if ama_base_bool
    //--------------------------------------------------------------------------
    ama_base_atr = ta.atr(ama_base_atr_len)
    ama_base_fastAlpha = 2 / (ama_base_fastLength + 1)
    ama_base_slowAlpha = 2 / (ama_base_slowLength + 1)
    ama_base_hh = ta.highest(ama_base_length + 1)
    ama_base_ll = ta.lowest(ama_base_length + 1)
    ama_base_mltp = ama_base_hh - ama_base_ll != 0 ? math.abs(2 * ama_base_src - ama_base_ll - ama_base_hh) / (ama_base_hh - ama_base_ll) : 0
    ama_base_ssc = ama_base_mltp * (ama_base_fastAlpha - ama_base_slowAlpha) + ama_base_slowAlpha
    ama_base := nz(ama_base[1]) + math.pow(ama_base_ssc, 2) * (ama_base_src - nz(ama_base[1]))
    //--------------------------------------------------------------------------
    ama_base_up := ama_base + ama_base_atr_multip*ama_base_atr
    ama_base_down := ama_base - ama_base_atr_multip*ama_base_atr
    //--------------------------------------------------------------------------
    ama_base_Color := ama_base_highlightMovements ? ama_base > ama_base[1] ? color.new(color.gray,36) : color.new(color.gray,36) : color.new(color.gray,36)
//------------------------------------------------------------------------------
plot((ama_base_bool) ? ama_base : na, title='AMA BASE', linewidth=2, color=ama_base_Color)
plot((ama_base_bool and ama_base_atr_bands_bool) ? ama_base_up : na, title='Upper ATR', linewidth=1, color=color.new(#e65100, 30)) //color.new(#f70007,50) : color.new(color.gray,50)
plot((ama_base_bool and ama_base_atr_bands_bool) ? ama_base_down : na, title='Lower ATR', linewidth=1, color=color.new(#e65100, 30))
//------------------------------------------------------------------------------