plotshape at bottom 2 times

Viewed 19

With this code, i try to have 2 lines with 2 different plotshape but i can just put one on the top and another one on bottom.

How can I put the2 on the bottom ?

indicator('SSL Hybrid 2X', overlay=true)
show_Baseline = input(title='Show Baseline', defval=true)

maType = input.string(title='SSL1 / Baseline Type', defval='HMA', options=['HMA'])
len = input(title='SSL1 / Baseline Length', defval=60)

SSL3Type = input.string(title='EXIT Type', defval='HMA', options=['HMA'])
len3 = input(title='EXIT Length', defval=15)
src = input(title='Source', defval=close)

ma(type, src, len) =>
    float result = 0
    if type == 'HMA'  // Hull
        result := ta.wma(2 * ta.wma(src, len / 2) - ta.wma(src, len), math.round(math.sqrt(len)))
        result
    
emaHigh = ma(maType, high, len)
emaLow = ma(maType, low, len)

BBMC = ma(maType, close, len)
useTrueRange = input(true)
multy = input.float(0.2, step=0.05, title='Base Channel Multiplier')
Keltma = ma(maType, src, len)
range_1 = useTrueRange ? ta.tr : high - low
rangema = ta.ema(range_1, len)
upperk = Keltma + rangema * multy
lowerk = Keltma - rangema * multy

open_pos = open * 1
close_pos = close * 1
difference = math.abs(close_pos - open_pos)

Hlv = int(na)
Hlv := close > emaHigh ? 1 : close < emaLow ? -1 : Hlv[1]
sslDown = Hlv < 0 ? emaHigh : emaLow

color_bar = close > upperk ? #00c3ff : close < lowerk ? #ff0062 : color.gray
color_ssl1 = close > sslDown ? #00c3ff : close < sslDown ? #ff0062 : na

plotshape(show_Baseline ? BBMC : na, style=shape.square, color=color_bar, title='MA Baseline')


show_Baseline_2 = input(title='Show Baseline 2', defval=true)

maType_2 = input.string(title='SSL1 2 / Baseline Type 2', defval='HMA', options=['HMA'])
len_2 = input(title='SSL1 2 / Baseline Length 2', defval=9)

SSL3Type_2 = input.string(title='EXIT Type 2', defval='HMA', options=['HMA'])
len3_2 = input(title='EXIT Length 2', defval=15)
src_2 = input(title='Source 2', defval=close)

ma_2(type, src_2, len_2) =>
    float result = 0
    if type == 'HMA'  // Hull
        result := ta.wma(2 * ta.wma(src_2, len_2 / 2) - ta.wma(src_2, len_2), math.round(math.sqrt(len_2)))
        result
    
emaHigh_2 = ma(maType_2, high, len_2)
emaLow_2 = ma(maType_2, low, len_2)

BBMC_2 = ma(maType_2, close, len_2)
useTrueRange_2 = input(true)
multy_2 = input.float(0.2, step=0.05, title='Base Channel Multiplier 2')
Keltma_2 = ma(maType_2, src_2, len_2)
range_1_2 = useTrueRange_2 ? ta.tr : high- low
rangema_2 = ta.ema(range_1_2, len_2)
upperk_2 = Keltma_2 + rangema_2 * multy_2
lowerk_2 = Keltma_2 - rangema_2 * multy_2

open_pos_2 = open * 1
close_pos_2 = close * 1
difference_2 = math.abs(close_pos_2 - open_pos_2)

Hlv_2 = int(na)
Hlv_2 := close > emaHigh_2 ? 1 : close < emaLow_2 ? -1 : Hlv_2[1]
sslDown_2 = Hlv_2 < 0 ? emaHigh_2 : emaLow_2

color_bar_2 = close> upperk_2 ? #00c3ff : close < lowerk_2 ? #ff0062 : color.gray
color_ssl1_2 = close > sslDown_2 ? #00c3ff : close < sslDown_2 ? #ff0062 : na

plotshape(show_Baseline_2 ? BBMC : na, style=shape.square, color=color_bar, title='MA Baseline')

If the 2 lines are top or bottom, they are on top of each other so I don't see the difference.

I don't know what to add despite the site asking me to add more information.

Here is the code and explanations.

Thank you for your help

1 Answers

What do you want to achieve exactly? Plot the same plotshapes at different positions?

plotshape(show_Baseline ? BBMC : na, style=shape.square, location = location.abovebar, color=color_bar, title='MA Baseline')
plotshape(show_Baseline_2 ? BBMC : na, style=shape.square, location = location.belowbar, color=color_bar, title='MA Baseline')
Related