Price Action Concepts HunterAlgos

Copy Code and Past On TradingView Pine Editor

__________________________________________________



// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/

// © HunterAlgos


//@version=5

indicator("Price Action Concepts [HunterAlgos]", shorttitle = "Price Action Concepts [1.0.0]", overlay = true, max_lines_count = 500, max_labels_count = 500, max_bars_back = 500, max_boxes_count = 500)



//-----------------------------------------------------------------------------{

    //Boolean set

//-----------------------------------------------------------------------------{

s_bos        = 0

s_choch      = 1

i_bos        = 2

i_choch      = 3

i_pp_choch   = 4

green_candle = 5

red_candle   = 6


boolean =

 array.from(

   false // s_bos

 , false // s_choch

 , false // i_bos

 , false // i_choch

 , false // i_pp_choch

 , false // up

 , false // dn

 )



//-----------------------------------------------------------------------------{

    // User inputs

//-----------------------------------------------------------------------------{

show_swing_ms    = input.string("All", "Swing   ", ["All", "CHoCH", "BOS", "None"]                                  , group = "MARKET STRUCTURE", inline = "1")

show_internal_ms = input.string("All", "Internal", ["All", "CHoCH", "BOS", "CHoCH+", "None"]                        , group = "MARKET STRUCTURE", inline = "2")


internal_r_lookback = input.int(5 , "", group = "MARKET STRUCTURE", inline = "2", minval = 2)

swing_r_lookback    = input.int(50, "", group = "MARKET STRUCTURE", inline = "1", minval = 2)


internal_l_lookback = math.round(internal_r_lookback / 2)

swing_l_lookback    = swing_r_lookback    / 2


i_ms_up_bos   = input.color(#089981, group = "MARKET STRUCTURE", inline = "2", title = "")

i_ms_up_choch = input.color(#00332a, group = "MARKET STRUCTURE", inline = "2", title = "")

i_ms_dn_bos   = input.color(#f23645, group = "MARKET STRUCTURE", inline = "2", title = "")

i_ms_dn_choch = input.color(#801922, group = "MARKET STRUCTURE", inline = "2", title = "")

s_ms_up_bos   = input.color(#089981, group = "MARKET STRUCTURE", inline = "1", title = "")

s_ms_up_choch = input.color(#00332a, group = "MARKET STRUCTURE", inline = "1", title = "")

s_ms_dn_bos   = input.color(#f23645, group = "MARKET STRUCTURE", inline = "1", title = "")

s_ms_dn_choch = input.color(#801922, group = "MARKET STRUCTURE", inline = "1", title = "")


invcol = color.new(color.white, 100)


lvl_daily   = input.bool(false, "Day   "  , inline = "1", group = "HIGHS & LOWS MTF")

lvl_weekly  = input.bool(false, "Week " , inline = "2", group = "HIGHS & LOWS MTF")

lvl_monthly = input.bool(false, "Month", inline = "3", group = "HIGHS & LOWS MTF")

lvl_yearly  = input.bool(false, "Year  " , inline = "4", group = "HIGHS & LOWS MTF")


css_d = input.color(color.blue, "", group = "HIGHS & LOWS MTF", inline = "1")

css_w = input.color(color.blue, "", group = "HIGHS & LOWS MTF", inline = "2")

css_m = input.color(color.blue, "", group = "HIGHS & LOWS MTF", inline = "3")

css_y = input.color(color.blue, "", group = "HIGHS & LOWS MTF", inline = "4")



s_d = input.string('⎯⎯⎯', '', options = ['⎯⎯⎯', '----', '····'], inline = '1', group = 'HIGHS & LOWS MTF')

s_w = input.string('⎯⎯⎯', '', options = ['⎯⎯⎯', '----', '····'], inline = '2', group = 'HIGHS & LOWS MTF')

s_m = input.string('⎯⎯⎯', '', options = ['⎯⎯⎯', '----', '····'], inline = '3', group = 'HIGHS & LOWS MTF')

s_y = input.string('⎯⎯⎯', '', options = ['⎯⎯⎯', '----', '····'], inline = '4', group = 'HIGHS & LOWS MTF')



ob_show = input.bool(true, "Order blocks",                                 inline = "1", group = "VOLUME ORDER BLOCKS")

ob_num  = input.int(2    , ""            , tooltip = "Orderblocks number", inline = "1", group = "VOLUME ORDER BLOCKS", minval = 1, maxval = 10)


mult         = input.int(5       , "Mult                  ", tooltip = "Add more bar to the right for a clear view", inline = "2", group = "VOLUME ORDER BLOCKS", minval = 1)

ob_timeframe = input.timeframe("", "Timeframe         "                                                            , inline = "3", group = "VOLUME ORDER BLOCKS")


ob_bull_css = input.color(#08998186, "", inline = "1", group = "VOLUME ORDER BLOCKS")

ob_bear_css = input.color(#f2364683, "", inline = "1", group = "VOLUME ORDER BLOCKS")


ob_opacity  = input.int(80, "", inline = "1", tooltip = "Opacity main orderblocks", group = "VOLUME ORDER BLOCKS")



show_liq   = input.bool(false, "Liquidity Wicks", inline = "1", group = "LIQUIDITY WICKS")


liq_up_css = input.color(color.yellow, "", inline = "1", group = "LIQUIDITY WICKS")

liq_dn_css = input.color(color.orange, "", inline = "1", group = "LIQUIDITY WICKS")


volMA      = input.int  (200, "MA Volume threshold", group = "LIQUIDITY WICKS", tooltip = "MA on volume to be above", minval = 2)

liq_thresh = input.float(10  , "Threshold"          , group = "LIQUIDITY WICKS", tooltip = "Wick bigger than body"   , minval = 2, step = 0.1)



show_lbl         = input.bool(true, "Show swing point", inline = "1", group = "GENERAL SETTINGS")


lbl_size         = input.string("Small", "", options = ["Tiny", "Small", "Normal", "Large", "Huge"], group = "GENERAL SETTINGS", inline = "1")


show_bar_css     = input.bool(false, "Show bar coloring", group = "GENERAL SETTINGS")



//-----------------------------------------------------------------------------{

    // Switch market strcture visuals

//-----------------------------------------------------------------------------{

switch show_swing_ms

    "All"    => boolean.set(s_bos, true) , boolean.set(s_choch, true)  

    "CHoCH"  => boolean.set(s_bos, false), boolean.set(s_choch, true)  

    "BOS"    => boolean.set(s_bos, true) , boolean.set(s_choch, false) 

    "None"   => boolean.set(s_bos, false), boolean.set(s_choch, false) 

    => na


switch show_internal_ms

    "All"    => boolean.set(i_bos, true) , boolean.set(i_choch, true) , boolean.set(i_pp_choch, true)  

    "CHoCH"  => boolean.set(i_bos, false), boolean.set(i_choch, true) , boolean.set(i_pp_choch, false) 

    "BOS"    => boolean.set(i_bos, true) , boolean.set(i_choch, false), boolean.set(i_pp_choch, false) 

    "CHoCH+" => boolean.set(i_bos, false), boolean.set(i_choch, false), boolean.set(i_pp_choch, true) 

    "None"   => boolean.set(i_bos, false), boolean.set(i_choch, false), boolean.set(i_pp_choch, false) 

    => na



//-----------------------------------------------------------------------------{

    // Custom Type

//-----------------------------------------------------------------------------{

type bar

    float   o = open

    float   c = close

    float   h = high

    float   l = low

    float   v = volume

    int     n = bar_index

    int     t = time

    string xt = xloc.bar_time

    string xn = xloc.bar_index


type bin

    float [] i_hpoint

    float [] i_lpoint

    int   [] i_nBull

    int   [] i_nBear

    float [] s_hpoint

    float [] s_lpoint

    int   [] s_nBull

    int   [] s_nBear

    float [] up_ms_logs

    float [] dn_ms_logs

    string[] i_bulltxt

    string[] i_beartxt


type ob

    float[] bear_h

    float[] bear_l

    int  [] bear_n

    float[] bull_h

    float[] bull_l

    int  [] bull_n

    float[] h

    float[] l

    float[] m

    int  [] left

    box  [] ob_bx

    line [] ob_line

    int  [] t_bull

    int  [] t_bear

    float[] v_bull

    float[] v_bear

    int  [] vn



//-----------------------------------------------------------------------------{

    // Type set

//-----------------------------------------------------------------------------{

bar b  = bar.new()


var pp = bin.new(

   array.new< float >(1, na)

 , array.new< float >(1, na)

 , array.new< int   >(1, na)

 , array.new< int   >(1, na)

 , array.new< float >(1, na)

 , array.new< float >(1, na)

 , array.new< int   >(1, na)

 , array.new< int   >(1, na)

 , array.new< float >(1, na)

 , array.new< float >(1, na)

 , array.new< string>(1, na)

 , array.new< string>(1, na)

 )


var obv = ob.new(

   array.new< float >(1, na)

 , array.new< float >(1, na)

 , array.new< int   >(1, na)

 , array.new< float >(1, na)

 , array.new< float >(1, na)

 , array.new< int   >(1, na)

 , array.new< float >(0, na)

 , array.new< float >(0, na)

 , array.new< float >(0, na)

 , array.new< int   >(0, na)

 , array.new< box   >(0, na)

 , array.new< line  >(0, na)

 , array.new< int   >(1 ,na)

 , array.new< int   >(1 ,na)

 , array.new< float >(1 ,na)

 , array.new< float >(1 ,na)

 , array.new< int   >(1 ,na)

 )



//-----------------------------------------------------------------------------{

    // order blocks candle cordinate

//-----------------------------------------------------------------------------{

switch

    b.c > b.o => boolean.set(green_candle, true)

    b.c < b.o => boolean.set(red_candle  , true)


switch

    boolean.get(green_candle) => obv.bull_h.push(b.h), obv.bull_l.push(b.l), obv.bull_n.push(b.n), obv.t_bull.push(b.t)

    boolean.get(red_candle)   => obv.bear_h.push(b.h), obv.bear_l.push(b.l), obv.bear_n.push(b.n), obv.t_bear.push(b.t)

    => na



//-----------------------------------------------------------------------------{

    // lower timeframe volume

//-----------------------------------------------------------------------------{

method normalize(float _src, int _min, int _max) =>

    var _historicMin =  10e10

    var _historicMax = -10e10

    _historicMin := math.min(nz(_src, _historicMin), _historicMin)

    _historicMax := math.max(nz(_src, _historicMax), _historicMax)

    _min + (_max - _min) * (_src - _historicMin) / math.max(_historicMax - _historicMin, 10e-10)


vol() =>

    float posVol = 0.0

    float negVol = 0.0

    switch

        close > open => posVol += volume

        close < open => negVol -= volume


    tf           = (timeframe.in_seconds("") / 60) / 6

    [_one, _two] = request.security_lower_tf("", ob_timeframe , [posVol, negVol])


    [_one.sum().normalize(0, 100), _two.sum().normalize(-100, 0)]



//-----------------------------------------------------------------------------{

    // set orderblocks

//-----------------------------------------------------------------------------{

method orderblock(bool condition, float top, float btm, int left, int right, float mitigation, bool bull, int num, color css, string _extend, string _xloc, float target_bull, float target_bear, int transp_bg, int transp_border, string strVol) =>

    var ob_top   = array.new< float >(0)

    var ob_btm   = array.new< float >(0)

    var ob_left  = array.new< int   >(0)

    var ob_right = array.new< int   >(0)

    var bx       = array.new< box   >(0)

    var l        = array.new< line  >(0)

    var bull_tar = array.new< float >(0)

    var bear_tar = array.new< float >(0)


    if condition

        avg =    math.avg(top, btm  )

        ob_top  .unshift(top        )

        ob_btm  .unshift(btm        )

        ob_left .unshift(left       )

        ob_right.unshift(right      )

        bull_tar.unshift(target_bull)

        bear_tar.unshift(target_bear)


    if barstate.isconfirmed

        target = bull ? bull_tar : bear_tar

        for stuff in target

            index = target.indexof(stuff)

            if (bull ? mitigation < stuff : mitigation > stuff)

                ob_top  .remove(index)

                ob_btm  .remove(index)

                ob_left .remove(index)

                ob_right.remove(index)

                bull_tar.remove(index)

                bear_tar.remove(index)


    if barstate.isfirst

        for j = 0 to num - 1

            bx.unshift(box.new(na, na, na, na

              , xloc         = _xloc

              , extend       = _extend

              , bgcolor      = css

              , border_color = color.new(css, 100)

              , text         = str.tostring(strVol)

              , text_halign  = text.align_right

              , text_size    = size.auto

              , text_color   = css))



    if barstate.islast

        if ob_top.size() > 0

            for j = 0 to math.min(num - 1, ob_top.size() - 1)

                g_box  = bx.get(j)

                g_line = l.get (j)


                g_box.set_left  (ob_left .get(j))

                g_box.set_right (ob_right.get(j))

                g_box.set_top   (ob_top  .get(j))

                g_box.set_bottom(ob_btm  .get(j))



[up, dn] = vol()



//-----------------------------------------------------------------------------{

    // General functions

//-----------------------------------------------------------------------------{

size(x) =>

    switch x

        "Tiny" => size.tiny

        "Small" => size.small

        "Large" => size.large

        "Huge" => size.huge



_h_l() => [b.h, b.l]


lineStyle(x) =>

    y = switch x

        '⎯⎯⎯'  => line.style_solid

        '----' => line.style_dashed

        '····' => line.style_dotted

    y


f_line(x, y, z, css, txt, down, size, style) =>

    var line  id  = na

    var label lbl = na


    id := line.new(x, y, z, y

     , xloc  = b.xn

     , color = css

     , width = 1

     , style = style)


    lbl := label.new(int(math.avg(x, z)), y, txt

      , color     = invcol

      , textcolor = css

      , style     = down ? label.style_label_down : label.style_label_up

      , size      = size)



method sf_hl(string tf) =>

    [h, l] = request.security("", tf, _h_l(), lookahead = barmerge.lookahead_on)

    [h, l]

    

method f_hl_line(string _style, color css, string tf) =>

    var line h_line   = na

    var line l_line   = na

    var label h_label = na

    var label l_label = na


    h_line := line.new(na, na, na, na

     , xloc = b.xt

     , color = css

     , style = _style

     )


    l_line := line.new(na, na, na, na

     , xloc = b.xt

     , color = css

     , style = _style

     )


    h_label := label.new(na, na

     , xloc  = b.xt

     , text  = str.format("{0} High" , tf)

     , size  = size.small

     , style = label.style_label_left

     , color = invcol

     , textcolor = css

     )


    l_label := label.new(na, na

     , xloc = b.xt

     , text = str.format("{0} Low", tf)

     , size  = size.small

     , style = label.style_label_left

     , color = invcol

     , textcolor = css

     )


    [h_line, l_line, h_label, l_label]



//-----------------------------------------------------------------------------{

    // HTF high and low

//-----------------------------------------------------------------------------{

method highANDlow(string _tf, float _higs, float _lows, string _style, color _css) =>

    highY = ta.valuewhen(_higs != _higs[1], _higs, 1)

    highX = ta.valuewhen(_higs == b.h     , b.t  , 1)

    lowY  = ta.valuewhen(_lows != _lows[1], _lows, 1)

    lowX  = ta.valuewhen(_lows == b.l     , b.t  , 1)


    [h_line, l_line, h_label, l_label] = _style.f_hl_line(_css, _tf)


    if barstate.islast

        t_end = time + (time - time[1]) * 20

        line.set_xy1(h_line , highX, highY)

        line.set_xy2(h_line , t_end, highY)

        label.set_xy(h_label, t_end, highY)

        line.set_xy1(l_line , lowX , lowY )

        line.set_xy2(l_line , t_end, lowY )

        label.set_xy(l_label, t_end, lowY )




[d_h, d_l] = "D"  .sf_hl()

[w_h, w_l] = "W"  .sf_hl()

[m_h, m_l] = "M"  .sf_hl()

[y_h, y_l] = "12M".sf_hl()



if lvl_daily

    "D"  .highANDlow(d_h, d_l, lineStyle(s_d), css_d)

if lvl_weekly

    "W"  .highANDlow(w_h, w_l, lineStyle(s_w), css_w)

if lvl_monthly

    "M"  .highANDlow(m_h, m_l, lineStyle(s_m), css_m)

if lvl_yearly

    "12M".highANDlow(y_h, y_l, lineStyle(s_y), css_y)



//-----------------------------------------------------------------------------{

    // Market strcture pivot point

//-----------------------------------------------------------------------------{

point() =>

    ph_i = ta.pivothigh(b.h, internal_l_lookback, internal_r_lookback)

    pl_i = ta.pivotlow (b.l , internal_l_lookback, internal_r_lookback)

    ph_s = ta.pivothigh(b.h, swing_l_lookback, swing_r_lookback)

    pl_s = ta.pivotlow (b.l , swing_l_lookback, swing_r_lookback)


    [ph_i, pl_i, ph_s, pl_s]


[ph_i, pl_i, ph_s, pl_s] = point()



switch

    ph_i => pp.i_hpoint.clear(), pp.i_nBull.clear(), pp.i_hpoint.push(b.h[internal_r_lookback]), pp.i_nBull.push(b.n[internal_r_lookback]), pp.up_ms_logs.push(b.h[internal_r_lookback])

    pl_i => pp.i_lpoint.clear(), pp.i_nBear.clear(), pp.i_lpoint.push(b.l[internal_r_lookback]), pp.i_nBear.push(b.n[internal_r_lookback]), pp.dn_ms_logs.push(b.l[internal_r_lookback])

    ph_s => pp.s_hpoint.clear(), pp.s_nBull.clear(), pp.s_hpoint.push(b.h[swing_r_lookback])   , pp.s_nBull.push(b.n[swing_r_lookback])

    pl_s => pp.s_lpoint.clear(), pp.s_nBear.clear(), pp.s_lpoint.push(b.l[swing_r_lookback])   , pp.s_nBear.push(b.n[swing_r_lookback])

    => na



//-----------------------------------------------------------------------------{

    // strcture set

//-----------------------------------------------------------------------------{

method structure(bin zz, bool mtf) =>

    var color css = na

    var int count = 0

    var trend     = 0

    var itrend    = 0

    var ob_bear   = false

    bool bear_ob  = false

    bool bull_ob  = false


    if true


        //-----------------------------------------------------------------------------{

        //Internal structure bullish

        //-----------------------------------------------------------------------------{

        if zz.dn_ms_logs.size() > 1 and zz.i_hpoint.size() > 0 and zz.i_nBull.size() > 0

            if ta.crossover(b.c, zz.i_hpoint.last())

                bool choch = na

                string txt = na


                if itrend < 0

                    choch := true


                switch

                    choch and not (zz.dn_ms_logs.last() > zz.dn_ms_logs.get(zz.dn_ms_logs.indexof(zz.dn_ms_logs.last()) - 1)) => txt := "CHoCH"

                    choch and     (zz.dn_ms_logs.last() > zz.dn_ms_logs.get(zz.dn_ms_logs.indexof(zz.dn_ms_logs.last()) - 1)) => txt := "CHoCH+"

                    not choch                                                                                                 => txt := "BOS"


                itrend := 1


                switch txt

                    "CHoCH"  => css := i_ms_up_choch

                    "BOS"    => css := i_ms_up_bos

                    "CHoCH+" => css := i_ms_up_choch

                    => css


                if ((txt == "BOS" and boolean.get(i_bos) == true) or (txt == "CHoCH" and boolean.get(i_choch) == true) or (txt =="CHoCH+" and boolean.get(i_pp_choch) == true)) and mtf == false

                    f_line(zz.i_nBull.last(), zz.i_hpoint.last(), b.n, i_ms_up_bos, txt, true, size.small, line.style_dashed)


                if txt == "BOS"

                    bull_ob := true          


                zz.i_nBull.clear ()

                zz.i_hpoint.clear()

                zz.i_bulltxt.push(txt)



        //-----------------------------------------------------------------------------{

        //Internal structure bearish

        //-----------------------------------------------------------------------------{

        if zz.up_ms_logs.size() > 1 and zz.i_lpoint.size() > 0 and zz.i_nBear.size() > 0

            if ta.crossunder(b.c, zz.i_lpoint.last())

                bool choch = na

                string txt = na


                if itrend > 0

                    choch := true


                switch

                    choch and not (zz.up_ms_logs.last() < zz.up_ms_logs.get(zz.up_ms_logs.indexof(zz.up_ms_logs.last()) - 1)) => txt := "CHoCH"

                    choch and     (zz.up_ms_logs.last() < zz.up_ms_logs.get(zz.up_ms_logs.indexof(zz.up_ms_logs.last()) - 1)) => txt := "CHoCH+"

                    not choch                                                                                                 => txt := "BOS"


                itrend := -1

                

                switch txt

                    "CHoCH"  => css := i_ms_dn_choch

                    "BOS"    => css := i_ms_dn_bos

                    "CHoCH+" => css := i_ms_dn_choch

                    => css


                if ((txt == "BOS" and boolean.get(i_bos) == true) or (txt == "CHoCH" and boolean.get(i_choch) == true) or (txt =="CHoCH+" and boolean.get(i_pp_choch) == true)) and mtf == false

                    f_line(zz.i_nBear.last(), zz.i_lpoint.last(), b.n, i_ms_dn_bos, txt, false, size.small, line.style_dashed)  


                if txt == "BOS"

                    bear_ob := true                  


                zz.i_nBear.clear ()

                zz.i_lpoint.clear()

                zz.i_beartxt.push(txt)

 


        //-----------------------------------------------------------------------------{

        //Swing structure bullish

        //-----------------------------------------------------------------------------{

        if zz.s_hpoint.size() > 0

            if ta.crossover(b.c, zz.s_hpoint.last())

                bool choch = na

                string txt = na


                if trend < 0

                    choch := true


                txt := choch ? "CHoCH" : "BOS"

                trend := 1


                if ((txt == "BOS" and boolean.get(s_bos) == true) or (txt == "CHoCH" and boolean.get(s_choch) == true) and mtf == false)

                    f_line(zz.s_nBull.last(), zz.s_hpoint.last(), b.n, i_ms_up_bos, txt, true, size.small, line.style_solid)


                zz.s_nBull.clear ()

                zz.s_hpoint.clear()



        //-----------------------------------------------------------------------------{

        //Swing structure bearish

        //-----------------------------------------------------------------------------{

        if zz.s_lpoint.size() > 0

            if ta.crossunder(b.c, zz.s_lpoint.last())

                bool choch = na

                string txt = na


                if trend > 0

                    choch := true


                txt := choch ? "CHoCH" : "BOS"

                trend := -1


                if ((txt == "BOS" and boolean.get(s_bos) == true) or (txt == "CHoCH" and boolean.get(s_choch) == true) and mtf == false)

                    f_line(zz.s_nBear.last(), zz.s_lpoint.last(), b.n, i_ms_dn_bos, txt, false, size.small, line.style_solid)                    


                zz.s_nBear.clear ()

                zz.s_lpoint.clear()


    [css, bear_ob, bull_ob]



[css, bear_ob_check, bull_ob_check] = pp.structure(false)



//-----------------------------------------------------------------------------{

    // basic Liquidity wick function

//-----------------------------------------------------------------------------{

liq_wick(bool green, int len, float thresh) =>

    bool up_liq = false

    bool dn_liq = false

    bool vol    = b.v > ta.sma(b.v, len) ? true : false


    float u_c = na

    float u_h = na

    float u_o = na


    float d_c  = na

    float d_lo = na

    float d_o  = na


    upwick = math.abs(high - math.max(open, close))

    dnwick = math.abs(low  - math.min(open, close))

    body   = math.abs(close - open)


    switch green

        true  => up_liq := upwick > thresh * body and vol ? true : false

        false => dn_liq := dnwick > thresh * body and vol ? true : false

        => na


    switch up_liq

        true => u_c := close, u_h  := high, u_o := open

        => na


    switch dn_liq

        true => d_c := close, d_lo := low, d_o := open

        => na


    [up_liq, dn_liq, u_c, u_h, u_o, d_c, d_lo, d_o]

    

        

[up_liq, dn_liq, u_c, u_h, u_o, d_c, d_lo, d_o] = liq_wick(close > open, volMA, liq_thresh)



//-----------------------------------------------------------------------------{

    // set order blocks

//-----------------------------------------------------------------------------{

switch ob_show

    false => bear_ob_check := false, bull_ob_check := false

    => na


bull_ob_check.orderblock(

       obv.bear_h.last()

     , obv.bear_l.last()

     , obv.t_bear.last()

     , obv.t_bear.last()

     , close

     , true

     , ob_num

     , color.new(ob_bull_css, ob_opacity)

     , extend.right

     , xloc.bar_time

     , obv.bear_l.last()

     , obv.bear_l.last()

     , ob_opacity

     , 100

     , "")


bull_ob_check.orderblock(

       obv.bear_h.last()

     , ((obv.bear_l.last() + obv.bear_h.last()) / 2)

     , obv.t_bear.last()

     , time_close + (time_close - time_close[1]) * int(up * mult)

     , close

     , true

     , ob_num

     , ob_bull_css

     , extend.none, xloc.bar_time

     , obv.bear_l.last()

     , obv.bear_l.last()

     , 60

     , 100

     , "")


bull_ob_check.orderblock(

       ((obv.bear_l.last() + obv.bear_h.last()) / 2)

     , obv.bear_l.last()

     , obv.t_bear.last()

     , time_close + (time_close - time_close[1]) * int(math.abs(dn * mult))

     , close

     , true

     , ob_num

     , ob_bear_css

     , extend.none

     , xloc.bar_time

     , obv.bear_l.last()

     , obv.bear_l.last()

     , 60

     , 100

     , "")



bear_ob_check.orderblock(

       obv.bull_h.last()

     , obv.bull_l.last()

     , obv.t_bull.last()

     , obv.t_bull.last()

     , close

     , false

     , ob_num

     , color.new(ob_bear_css, ob_opacity)

     , extend.right

     , xloc.bar_time

     , obv.bull_h.last()

     , obv.bull_h.last()

     , ob_opacity

     , 100

     , "")


bear_ob_check.orderblock(

      obv.bull_h.last()

     , ((obv.bull_l.last() + obv.bull_h.last()) / 2)

     , obv.t_bull.last()

     , time_close + (time_close - time_close[1]) * int(up * mult)

     , close

     , false

     , ob_num

     , ob_bull_css

     , extend.none

     , xloc.bar_time

     , obv.bull_h.last()

     , obv.bull_h.last()

     , 60

     , 100

     , "")


bear_ob_check.orderblock(

       ((obv.bull_l.last() + obv.bull_h.last()) / 2)

     , obv.bull_l.last(), obv.t_bull.last()

     , time_close + (time_close - time_close[1]) * int(math.abs(dn * mult))

     , close

     , false

     , ob_num

     , ob_bear_css

     , extend.none

     , xloc.bar_time

     , obv.bull_h.last()

     , obv.bull_h.last()

     , 60

     , 100

     , "")



//-----------------------------------------------------------------------------{

    // plotting

//-----------------------------------------------------------------------------{


if pp.s_hpoint.size() > 0

    if ta.change(pp.s_hpoint.last())

        label.new(bar_index[swing_r_lookback], high[swing_r_lookback], text = "HH", color = invcol, style = label.style_label_down, textcolor = i_ms_up_bos, size = size(lbl_size))

if pp.s_lpoint.size() > 0

    if ta.change(pp.s_lpoint.last())

        


plotcandle(open,high,low,close , color     = css   , wickcolor = color.rgb(120, 123, 134, 50), bordercolor = css)


plotcandle(u_c, u_h, u_o, u_h  , wickcolor = invcol, color = invcol, bordercolor = show_liq ? liq_up_css : invcol)

plotcandle(d_c, d_c, d_lo, d_lo, wickcolor = invcol, color = , bordercolor = show_liq ? liq_dn_css : invcol)


barcolor(color = show_bar_css ? css : na)



_________________________________________________


Leave a Comment

Your email address will not be published. Required fields are marked *