Multi-timeframe Momentum
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Snufkin420TC
// Developed with Dumpster Capital and published sans secret sauce

//@version=5
indicator("Momentum", overlay=false)

//User inputs
string MOMs = input.string("Standard", title = "Momentums", options = ["Standard", "Fibonacci"])
source = input.source(defval=ohlc4, title="Source")
EMA_length = input.int(20, title = "EMA length")
visible = input.bool(defval=true, title = "Show only near-timeframe Momentums")
momstyle = input.bool(false, title = "Linear regression", group="Linear regression")
leng = input.int(20, title = "length", group="Linear regression")
ps = input.string("area", title = "Style", options = ["area", "columns"], group="Plot style")   // A plot style "line" is also available but limited by plots > 64 for now
coloring = input.string("changebow", title = "Color", options = ["rainbow", "changebow", "redgreen"], group="Plot style")
tp = input.float(0, title = "Transparency", minval=0, maxval=100, group="Plot style")
tp2 = input.float(50, title = "Transparency (leading)", minval=0, maxval=100, group="Plot style")

// Create non-repainting security function
fix_security(_symbol, _res, _src) =>
    request.security(_symbol, _res, _src[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)

//get Timeframe of current chart and convert to a score for timeframe detection based switches
timeframe = timeframe.period
framescore = 0
framescore := if (timeframe == "M")
    13
else if (timeframe == "W")
    12
else if (timeframe == "D")
    11
else if (timeframe == "240")
    10
else if (timeframe == "180")
    9
else if (timeframe == "120")
    8
else if (timeframe == "60")
    7
else if (timeframe == "45")
    6
else if (timeframe == "30")
    5
else if (timeframe == "15")
    4
else if (timeframe == "5")
    3
else if (timeframe == "3")
    2
else if (timeframe == "1")
    1
else
    0
    
// Momentum style (rate-of-change smoothed with an EMA and optional further smoothing with linear regression)
momentum = ta.ema(nz(source[0] - source[1]), EMA_length)

// Initialize momentums
MOM1 = 0.0
MOM2 = 0.0
MOM3 = 0.0
MOM4 = 0.0
MOM5 = 0.0
MOM6 = 0.0
MOM7 = 0.0
MOM8 = 0.0
MOM9 = 0.0
MOM10 = 0.0
MOM11 = 0.0
MOM12 = 0.0
MOM13 = 0.0

// Momentum calculations
if (MOMs == 'Standard' and visible == false and momstyle == false)
    MOM1 := (framescore <= 1) ? fix_security(syminfo.tickerid, '1', momentum) : na
    MOM2 := (framescore <= 2) ? fix_security(syminfo.tickerid, '3', momentum) : na
    MOM3 := (framescore <= 3) ? fix_security(syminfo.tickerid, '5', momentum) : na
    MOM4 := (framescore <= 4) ? fix_security(syminfo.tickerid, '15', momentum) : na
    MOM5 := (framescore <= 5) ? fix_security(syminfo.tickerid,'30', momentum) : na
    MOM6 := (framescore <= 7) ? fix_security(syminfo.tickerid,'60', momentum) : na
    MOM7 := (framescore <= 8) ? fix_security(syminfo.tickerid, '120', momentum) : na
    MOM8 := (framescore <= 10) ? fix_security(syminfo.tickerid, '240', momentum) : na
    MOM9 := (framescore <= 10) ? fix_security(syminfo.tickerid, '480', momentum) : na
    MOM10 := (framescore <= 11) ? fix_security(syminfo.tickerid, 'D', momentum) : na
    MOM11 := (framescore <= 12) ? fix_security(syminfo.tickerid, 'W', momentum) : na
    MOM12 := (framescore <= 13) ? fix_security(syminfo.tickerid, 'M', momentum) : na
    MOM13 := (framescore <= 14) ? fix_security(syminfo.tickerid, '3M', momentum) : na
else if (MOMs == 'Standard' and visible == true and momstyle == false)
    MOM1 := (framescore <= 1) ? fix_security(syminfo.tickerid, '1', momentum) : na
    MOM2 := (framescore <= 2) ? fix_security(syminfo.tickerid, '3', momentum) : na
    MOM3 := (framescore <= 3) ? fix_security(syminfo.tickerid, '5', momentum) : na
    MOM4 := (framescore <= 4) ? fix_security(syminfo.tickerid, '15', momentum) : na
    MOM5 := (framescore <= 5) ? fix_security(syminfo.tickerid,'45', momentum) : na
    MOM6 := (framescore <= 7) ? fix_security(syminfo.tickerid,'60', momentum) : na
    MOM7 := (framescore <= 8 and framescore > 1) ? fix_security(syminfo.tickerid, '120', momentum) : na
    MOM8 := (framescore <= 10 and framescore > 3) ? fix_security(syminfo.tickerid, '240', momentum) : na
    MOM9 := (framescore <= 10 and framescore > 3) ? fix_security(syminfo.tickerid, '480', momentum) : na
    MOM10 := (framescore <= 11 and framescore > 4) ? fix_security(syminfo.tickerid, 'D', momentum) : na
    MOM11 := (framescore <= 12 and framescore > 5) ? fix_security(syminfo.tickerid, 'W', momentum) : na
    MOM12 := (framescore <= 13 and framescore > 6) ? fix_security(syminfo.tickerid, 'M', momentum) : na
    MOM13 := (framescore <= 14 and framescore > 7) ? fix_security(syminfo.tickerid, '3M', momentum) : na
else if (MOMs == 'Fibonacci' and momstyle == false)
    MOM1 := (framescore <= 1) ? fix_security(syminfo.tickerid, '1', momentum) : na
    MOM2 := (framescore <= 1) ? fix_security(syminfo.tickerid, '2', momentum) : na
    MOM3 := (framescore <= 2) ? fix_security(syminfo.tickerid, '3', momentum) : na
    MOM4 := (framescore <= 3) ? fix_security(syminfo.tickerid, '5', momentum) : na
    MOM5 := (framescore <= 3) ? fix_security(syminfo.tickerid,'8', momentum) : na
    MOM6 := (framescore <= 3) ? fix_security(syminfo.tickerid,'13', momentum) : na
    MOM7 := (framescore <= 4) ? fix_security(syminfo.tickerid, '21', momentum) : na
    MOM8 := (framescore <= 5) ? fix_security(syminfo.tickerid, '34', momentum) : na
    MOM9 := (framescore <= 6) ? fix_security(syminfo.tickerid, '55', momentum) : na
    MOM10 := na
    MOM11 := na
    MOM12 := na
    MOM13 := na
else if (MOMs == 'Standard' and visible == false and momstyle == true)
    MOM1 := (framescore <= 1) ? fix_security(syminfo.tickerid, '1', ta.linreg(momentum, leng ,0)) : na
    MOM2 := (framescore <= 2) ? fix_security(syminfo.tickerid, '3', ta.linreg(momentum, leng ,0)) : na
    MOM3 := (framescore <= 3) ? fix_security(syminfo.tickerid, '5', ta.linreg(momentum, leng ,0)) : na
    MOM4 := (framescore <= 4) ? fix_security(syminfo.tickerid, '15', ta.linreg(momentum, leng ,0)) : na
    MOM5 := (framescore <= 5) ? fix_security(syminfo.tickerid,'30', ta.linreg(momentum, leng ,0)) : na
    MOM6 := (framescore <= 7) ? fix_security(syminfo.tickerid,'60', ta.linreg(momentum, leng ,0)) : na
    MOM7 := (framescore <= 8) ? fix_security(syminfo.tickerid, '120', ta.linreg(momentum, leng ,0)) : na
    MOM8 := (framescore <= 10) ? fix_security(syminfo.tickerid, '240', ta.linreg(momentum, leng ,0)) : na
    MOM9 := (framescore <= 10) ? fix_security(syminfo.tickerid, '480', ta.linreg(momentum, leng ,0)) : na
    MOM10 := (framescore <= 11) ? fix_security(syminfo.tickerid, 'D', ta.linreg(momentum, leng ,0)) : na
    MOM11 := (framescore <= 12) ? fix_security(syminfo.tickerid, 'W', ta.linreg(momentum, leng ,0)) : na
    MOM12 := (framescore <= 13) ? fix_security(syminfo.tickerid, 'M', ta.linreg(momentum, leng ,0)) : na
    MOM13 := (framescore <= 14) ? fix_security(syminfo.tickerid, '3M', ta.linreg(momentum, leng ,0)) : na
else if (MOMs == 'Standard' and visible == true and momstyle == true)
    MOM1 := (framescore <= 1) ? fix_security(syminfo.tickerid, '1', ta.linreg(momentum, leng ,0)) : na
    MOM2 := (framescore <= 2) ? fix_security(syminfo.tickerid, '3', ta.linreg(momentum, leng ,0)) : na
    MOM3 := (framescore <= 3) ? fix_security(syminfo.tickerid, '5', ta.linreg(momentum, leng ,0)) : na
    MOM4 := (framescore <= 4) ? fix_security(syminfo.tickerid, '15', ta.linreg(momentum, leng ,0)) : na
    MOM5 := (framescore <= 5) ? fix_security(syminfo.tickerid,'45', ta.linreg(momentum, leng ,0)) : na
    MOM6 := (framescore <= 7) ? fix_security(syminfo.tickerid,'60', ta.linreg(momentum, leng ,0)) : na
    MOM7 := (framescore <= 8 and framescore > 1) ? fix_security(syminfo.tickerid, '120', ta.linreg(momentum, leng ,0)) : na
    MOM8 := (framescore <= 10 and framescore > 3) ? fix_security(syminfo.tickerid, '240', ta.linreg(momentum, leng ,0)) : na
    MOM9 := (framescore <= 10 and framescore > 3) ? fix_security(syminfo.tickerid, '480', ta.linreg(momentum, leng ,0)) : na
    MOM10 := (framescore <= 11 and framescore > 4) ? fix_security(syminfo.tickerid, 'D', ta.linreg(momentum, leng ,0)) : na
    MOM11 := (framescore <= 12 and framescore > 5) ? fix_security(syminfo.tickerid, 'W', ta.linreg(momentum, leng ,0)) : na
    MOM12 := (framescore <= 13 and framescore > 6) ? fix_security(syminfo.tickerid, 'M', ta.linreg(momentum, leng ,0)) : na
    MOM13 := (framescore <= 14 and framescore > 7) ? fix_security(syminfo.tickerid, '3M', ta.linreg(momentum, leng ,0)) : na
else if (MOMs == 'Fibonacci' and momstyle == true)
    MOM1 := (framescore <= 1) ? fix_security(syminfo.tickerid, '1', ta.linreg(momentum, leng ,0)) : na
    MOM2 := (framescore <= 1) ? fix_security(syminfo.tickerid, '2', ta.linreg(momentum, leng ,0)) : na
    MOM3 := (framescore <= 2) ? fix_security(syminfo.tickerid, '3', ta.linreg(momentum, leng ,0)) : na
    MOM4 := (framescore <= 3) ? fix_security(syminfo.tickerid, '5', ta.linreg(momentum, leng ,0)) : na
    MOM5 := (framescore <= 3) ? fix_security(syminfo.tickerid,'8', ta.linreg(momentum, leng ,0)) : na
    MOM6 := (framescore <= 3) ? fix_security(syminfo.tickerid,'13', ta.linreg(momentum, leng ,0)) : na
    MOM7 := (framescore <= 4) ? fix_security(syminfo.tickerid, '21', ta.linreg(momentum, leng ,0)) : na
    MOM8 := (framescore <= 5) ? fix_security(syminfo.tickerid, '34', ta.linreg(momentum, leng ,0)) : na
    MOM9 := (framescore <= 6) ? fix_security(syminfo.tickerid, '55', ta.linreg(momentum, leng ,0)) : na
    MOM10 := na
    MOM11 := na
    MOM12 := na
    MOM13 := na

// Default rainbow coloring
col1 = color.new(color.silver, tp)
col2 = color.new(color.lime, tp)
col3 = color.new(color.yellow, tp)
col4 = color.new(color.orange, tp)
col5 = color.new(color.red, tp)
col6 = color.new(color.fuchsia, tp)
col7 = color.new(color.purple, tp)
col8 = color.new(color.navy, tp)
col9 = color.new(color.blue, tp)
col10 = color.new(color.teal, tp)
col11 = color.new(color.green, tp)
col12 = color.new(color.olive, tp)
col13 = color.new(color.gray, tp)

// Calculate changing colors
if (coloring == 'changebow')
    col1 := (MOM1 > 0) ? ((MOM1 > MOM1[1]) ? color.new(color.silver, tp2) : ((MOM1 < MOM1[1]) ? color.new(color.silver, tp) : col1[1])) : ((MOM1 < MOM1[1]) ? color.new(color.silver, tp2) : ((MOM1 > MOM1[1]) ? color.new(color.silver, tp) : col1[1]))
    col2 := (MOM2 > 0) ? ((MOM2 > MOM2[1]) ? color.new(color.lime, tp2) : ((MOM2 < MOM2[1]) ? color.new(color.lime, tp) : col2[1])) : ((MOM2 < MOM2[1]) ? color.new(color.lime, tp2) : ((MOM2 > MOM2[1]) ? color.new(color.lime, tp) : col2[1]))
    col3 := (MOM3 > 0) ? ((MOM3 > MOM3[1]) ? color.new(color.yellow, tp2) : ((MOM3 < MOM3[1]) ? color.new(color.yellow, tp) : col3[1])) : ((MOM3 < MOM3[1]) ? color.new(color.yellow, tp2) : ((MOM3 > MOM3[1]) ? color.new(color.yellow, tp) : col3[1]))
    col4 := (MOM4 > 0) ? ((MOM4 > MOM4[1]) ? color.new(color.orange, tp2) : ((MOM4 < MOM4[1]) ? color.new(color.orange, tp) : col4[1])) : ((MOM4 < MOM4[1]) ? color.new(color.orange, tp2) : ((MOM4 > MOM4[1]) ? color.new(color.orange, tp) : col4[1]))
    col5 := (MOM5 > 0) ? ((MOM5 > MOM5[1]) ? color.new(color.red, tp2) : ((MOM5 < MOM5[1]) ? color.new(color.red, tp) : col5[1])) : ((MOM5 < MOM5[1]) ? color.new(color.red, tp2) : ((MOM5 > MOM5[1]) ? color.new(color.red, tp) : col5[1]))
    col6 := (MOM6 > 0) ? ((MOM6 > MOM6[1]) ? color.new(color.fuchsia, tp2) : ((MOM6 < MOM6[1]) ? color.new(color.fuchsia, tp) : col6[1])) : ((MOM6 < MOM6[1]) ? color.new(color.fuchsia, tp2) : ((MOM6 > MOM6[1]) ? color.new(color.fuchsia, tp) : col6[1]))
    col7 := (MOM7 > 0) ? ((MOM7 > MOM7[1]) ? color.new(color.purple, tp2) : ((MOM7 < MOM7[1]) ? color.new(color.purple, tp) : col7[1])) : ((MOM7 < MOM7[1]) ? color.new(color.purple, tp2) : ((MOM7 > MOM7[1]) ? color.new(color.purple, tp) : col7[1]))
    col8 := (MOM8 > 0) ? ((MOM8 > MOM8[1]) ? color.new(color.navy, tp2) : ((MOM8 < MOM8[1]) ? color.new(color.navy, tp) : col8[1])) : ((MOM8 < MOM8[1]) ? color.new(color.navy, tp2) : ((MOM8 > MOM8[1]) ? color.new(color.navy, tp) : col8[1]))
    col9 := (MOM9 > 0) ? ((MOM9 > MOM9[1]) ? color.new(color.blue, tp2) : ((MOM9 < MOM9[1]) ? color.new(color.blue, tp) : col9[1])) : ((MOM9 < MOM9[1]) ? color.new(color.blue, tp2) : ((MOM9 > MOM9[1]) ? color.new(color.blue, tp) : col9[1]))
    col10 := (MOM10 > 0) ? ((MOM10 > MOM10[1]) ? color.new(color.teal, tp2) : ((MOM10 < MOM10[1]) ? color.new(color.teal, tp) : col10[1])) : ((MOM10 < MOM10[1]) ? color.new(color.teal, tp2) : ((MOM10 > MOM10[1]) ? color.new(color.teal, tp) : col10[1]))
    col11 := (MOM11 > 0) ? ((MOM11 > MOM11[1]) ? color.new(color.green, tp2) : ((MOM11 < MOM11[1]) ? color.new(color.green, tp) : col11[1])) : ((MOM11 < MOM11[1]) ? color.new(color.green, tp2) : ((MOM11 > MOM11[1]) ? color.new(color.green, tp) : col11[1]))
    col12 := (MOM12 > 0) ? ((MOM12 > MOM12[1]) ? color.new(color.olive, tp2) : ((MOM12 < MOM12[1]) ? color.new(color.olive, tp) : col12[1])) : ((MOM12 < MOM12[1]) ? color.new(color.olive, tp2) : ((MOM12 > MOM12[1]) ? color.new(color.olive, tp) : col12[1]))
    col13 := (MOM13 > 0) ? ((MOM13 > MOM13[1]) ? color.new(color.gray, tp2) : ((MOM13 < MOM13[1]) ? color.new(color.gray, tp) : col13[1])) : ((MOM13 < MOM13[1]) ? color.new(color.gray, tp2) : ((MOM13 > MOM13[1]) ? color.new(color.gray, tp) : col13[1]))

else if (coloring == 'redgreen')
    col1 := (MOM1 > 0) ? ((MOM1 > MOM1[1]) ? color.new(color.lime, tp) : ((MOM1 < MOM1[1]) ? color.new(color.green, tp) : col1[1])) : ((MOM1 < MOM1[1]) ? color.new(color.red, tp) : ((MOM1 > MOM1[1]) ? color.new(color.maroon, tp) : col1[1]))
    col2 := (MOM2 > 0) ? ((MOM2 > MOM2[1]) ? color.new(color.lime, tp) : ((MOM2 < MOM2[1]) ? color.new(color.green, tp) : col2[1])) : ((MOM2 < MOM2[1]) ? color.new(color.red, tp) : ((MOM2 > MOM2[1]) ? color.new(color.maroon, tp) : col2[1]))
    col3 := (MOM3 > 0) ? ((MOM3 > MOM3[1]) ? color.new(color.lime, tp) : ((MOM3 < MOM3[1]) ? color.new(color.green, tp) : col3[1])) : ((MOM3 < MOM3[1]) ? color.new(color.red, tp) : ((MOM3 > MOM3[1]) ? color.new(color.maroon, tp) : col3[1]))
    col4 := (MOM4 > 0) ? ((MOM4 > MOM4[1]) ? color.new(color.lime, tp) : ((MOM4 < MOM4[1]) ? color.new(color.green, tp) : col4[1])) : ((MOM4 < MOM4[1]) ? color.new(color.red, tp) : ((MOM4 > MOM4[1]) ? color.new(color.maroon, tp) : col4[1]))
    col5 := (MOM5 > 0) ? ((MOM5 > MOM5[1]) ? color.new(color.lime, tp) : ((MOM5 < MOM5[1]) ? color.new(color.green, tp) : col5[1])) : ((MOM5 < MOM5[1]) ? color.new(color.red, tp) : ((MOM5 > MOM5[1]) ? color.new(color.maroon, tp) : col5[1]))
    col6 := (MOM6 > 0) ? ((MOM6 > MOM6[1]) ? color.new(color.lime, tp) : ((MOM6 < MOM6[1]) ? color.new(color.green, tp) : col6[1])) : ((MOM6 < MOM6[1]) ? color.new(color.red, tp) : ((MOM6 > MOM6[1]) ? color.new(color.maroon, tp) : col6[1]))
    col7 := (MOM7 > 0) ? ((MOM7 > MOM7[1]) ? color.new(color.lime, tp) : ((MOM7 < MOM7[1]) ? color.new(color.green, tp) : col7[1])) : ((MOM7 < MOM7[1]) ? color.new(color.red, tp) : ((MOM7 > MOM7[1]) ? color.new(color.maroon, tp) : col7[1]))
    col8 := (MOM8 > 0) ? ((MOM8 > MOM8[1]) ? color.new(color.lime, tp) : ((MOM8 < MOM8[1]) ? color.new(color.green, tp) : col8[1])) : ((MOM8 < MOM8[1]) ? color.new(color.red, tp) : ((MOM8 > MOM8[1]) ? color.new(color.maroon, tp) : col8[1]))
    col9 := (MOM9 > 0) ? ((MOM9 > MOM9[1]) ? color.new(color.lime, tp) : ((MOM9 < MOM9[1]) ? color.new(color.green, tp) : col9[1])) : ((MOM9 < MOM9[1]) ? color.new(color.red, tp) : ((MOM9 > MOM9[1]) ? color.new(color.maroon, tp) : col9[1]))
    col10 := (MOM10 > 0) ? ((MOM10 > MOM10[1]) ? color.new(color.lime, tp) : ((MOM10 < MOM10[1]) ? color.new(color.green, tp) : col10[1])) : ((MOM10 < MOM10[1]) ? color.new(color.red, tp) : ((MOM10 > MOM10[1]) ? color.new(color.maroon, tp) : col10[1]))
    col11 := (MOM11 > 0) ? ((MOM11 > MOM11[1]) ? color.new(color.lime, tp) : ((MOM11 < MOM11[1]) ? color.new(color.green, tp) : col11[1])) : ((MOM11 < MOM11[1]) ? color.new(color.red, tp) : ((MOM11 > MOM11[1]) ? color.new(color.maroon, tp) : col11[1]))
    col12 := (MOM12 > 0) ? ((MOM12 > MOM12[1]) ? color.new(color.lime, tp) : ((MOM12 < MOM12[1]) ? color.new(color.green, tp) : col12[1])) : ((MOM12 < MOM12[1]) ? color.new(color.red, tp) : ((MOM12 > MOM12[1]) ? color.new(color.maroon, tp) : col12[1]))
    col13 := (MOM13 > 0) ? ((MOM13 > MOM13[1]) ? color.new(color.lime, tp) : ((MOM13 < MOM13[1]) ? color.new(color.green, tp) : col13[1])) : ((MOM13 < MOM13[1]) ? color.new(color.red, tp) : ((MOM13 > MOM13[1]) ? color.new(color.maroon, tp) : col13[1]))

//plot momentumss
hline(0, title="zero line", linestyle = hline.style_solid, color = color.new(color.white, 0))

plot(ps == "columns" ? MOM13 : na, title="columns Q", style=plot.style_columns, color=col13)
plot(ps == "columns" ? MOM12 : na, title="columns M", style=plot.style_columns, color=col12)
plot(ps == "columns" ? MOM11 : na, title="columns W", style=plot.style_columns, color=col11)
plot(ps == "columns" ? MOM10 : na, title="columns D", style=plot.style_columns, color=col10)
plot(ps == "columns" ? MOM9 : na, title="columns 240", style=plot.style_columns, color=col9)
plot(ps == "columns" ? MOM8 : na, title="columns 120", style=plot.style_columns, color=col8)
plot(ps == "columns" ? MOM7 : na, title="columns 60", style=plot.style_columns, color=col7)
plot(ps == "columns" ? MOM6 : na, title="columns 45", style=plot.style_columns, color=col6)
plot(ps == "columns" ? MOM5 : na, title="columns 30", style=plot.style_columns, color=col5)
plot(ps == "columns" ? MOM4 : na, title="columns 15", style=plot.style_columns, color=col4)
plot(ps == "columns" ? MOM3 : na, title="columns 5", style=plot.style_columns, color=col3)
plot(ps == "columns" ? MOM2 : na, title="columns 3", style=plot.style_columns, color=col2)
plot(ps == "columns" ? MOM1 : na, title="columns 1", style=plot.style_columns, color=col1)

plot(ps == "area" ? MOM13 : na, title="area Q", style=plot.style_area, color=col13)
plot(ps == "area" ? MOM12 : na, title="area M", style=plot.style_area, color=col12)
plot(ps == "area" ? MOM11 : na, title="area W", style=plot.style_area, color=col11)
plot(ps == "area" ? MOM10 : na, title="area D", style=plot.style_area, color=col10)
plot(ps == "area" ? MOM9 : na, title="area 240", style=plot.style_area, color=col9)
plot(ps == "area" ? MOM8 : na, title="area 120", style=plot.style_area, color=col8)
plot(ps == "area" ? MOM7 : na, title="area 60", style=plot.style_area, color=col7)
plot(ps == "area" ? MOM6 : na, title="area 45", style=plot.style_area, color=col6)
plot(ps == "area" ? MOM5 : na, title="area 30", style=plot.style_area, color=col5)
plot(ps == "area" ? MOM4 : na, title="area 15", style=plot.style_area, color=col4)
plot(ps == "area" ? MOM3 : na, title="area 5", style=plot.style_area, color=col3)
plot(ps == "area" ? MOM2 : na, title="area 3", style=plot.style_area, color=col2)
plot(ps == "area" ? MOM1 : na, title="area 1", style=plot.style_area, color=col1)

// end //