OrderBlox

Indicator working on the same logic as my other indicator “Institutional OrderBlock Pressure”. But this one uses Accumulation/Distribution as a reference to find OrderBlock instead of Price Action. This has a much cleaner interface. It can work in addition to “Institutional OrderBlock pressure”.

Orderblox in action on Dow Jones Index.

Screenshot taken from the Settings menu of Orderblox

Here is the complete list of features present in this indicator :

  • Full Indicator Customization
  • OB Detection by Accumulation/Distribution
  • Acc/Dist Length

All options have their original default settings. You need to be able to readjust them depending on the market instrument you want to analyze. You have the possibility to put alerts which will notify you when an indicator gives a new signal. For this, we have united all the alerts in one thanks to the “Any Alert Function Call” option, simply activate or deactivate the options you want to have in your alerts before placing the alert.

Rate this Indicator?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this Indicator.

5
(1)

Or copy / paste the source code into your pine editor :

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RickSimpson
//@version=5
indicator('OrderBlox', 'OrderBlox', true, max_bars_back=300, max_labels_count=300)

//◀─── Inputs ───►

i_colacc   = input.color(color.new(#0863b5,      0), 'Accumulation Color',               confirm=true,         group='Chart Customization', inline='srcol')
i_coldist  = input.color(color.new(#e3001f,      0), 'Distribution Color',               confirm=true,         group='Chart Customization', inline='srcol')
adtransp   = input.int(65,                             'Box Transparency',                 minval=1, maxval=100, group='Chart Customization')
adlength   = input.int(12,                             'Accumulation/Distribution Length', minval=1, maxval=100, group='OrderBlock Settings')
adboxcount = input.int(20,                             'Maximum Box Displayed',            minval=1, maxval=200, group='OrderBlock Settings')

//Price Variables Declaration

int index  = 1
close_     = close[index]
low_       = low[index]
high_      = high[index]
open_      = open[index]
bar_index_ = bar_index[index]

//Box Variables Declaration

var box[] bearboxarray         = array.new_box()
var box[] bullboxarray         = array.new_box()
int       bearcandle         = 0
int       bullcandle         = 0
var color adbearboxcolor       = color.new(i_coldist,  65)
var color adbullboxcolor       = color.new(i_colacc,   65)
var color adbearborderboxcolor = color.new(i_coldist,   0)
var color adbullborderboxcolor = color.new(i_colacc,    0)

//Inversed Candle Direction Calculation

for i = 1 to 0 by 1
    bearcandle := bearcandle + (close[i] > open[i] ? 1 : 0)
    bearcandle
for i = 1 to 0 by 1
    bullcandle := bullcandle + (close[i] < open[i] ? 1 : 0) 
    bullcandle

//Normalized Distribution Calculation

abs    = math.abs(open[index] - close[index]) / math.abs(high[index] - low[index]) / 100
ad     = math.sum(close == high and close == low or high == low ? 0 : (close - open) / (high - low) * volume, adlength)
norm   = 100 * ad / math.sum(volume, adlength)
nindex = norm > 0 and norm > norm[1]

//Conditions

bear = nindex and (bearcandle == (0)) and abs
bull = nindex and (bullcandle == (0)) and abs

//Distribution Box Calculation

f_choppedoffbear(bearboxarray) =>
    if array.size(bearboxarray) > 0
        for i            = array.size(bearboxarray) - 1 to 0 by 1
            cutbox       = array.get(bearboxarray, i)
            boxlowzone   = box.get_bottom(cutbox)
            boxhighzone  = box.get_top(cutbox)
            boxrightzone = box.get_right(cutbox)
            if na or bar_index - 1 == boxrightzone and not(high > boxlowzone and low < boxlowzone or high > boxhighzone and low < boxhighzone)
                box.set_right(array.get(bearboxarray, i), bar_index)

//Distribution Box Plotting

if bear
    boxhighzone = high_
    boxlowzone  = close_ < open_ ? close_ : open_
    bearbox     = box.new(bar_index_, boxhighzone, bar_index, boxlowzone, border_color=adbearborderboxcolor, border_style=line.style_dashed, bgcolor=adbearboxcolor)
    if array.size(bearboxarray) > adboxcount
        box.delete(array.shift(bearboxarray))
    array.push(bearboxarray, bearbox)

f_choppedoffbear(bearboxarray)

//Accumulation Box Calculation

f_choppedoffbull(bullboxarray) =>
    if array.size(bullboxarray) > 0
        for i            = array.size(bullboxarray) - 1 to 0 by 1
            cutbox       = array.get(bullboxarray, i)
            boxlowzone   = box.get_bottom(cutbox)
            boxhighzone  = box.get_top(cutbox)
            boxrightzone = box.get_right(cutbox)
            if na or bar_index - 1 == boxrightzone and not(high > boxlowzone and low < boxlowzone or high > boxhighzone and low < boxhighzone)
                box.set_right(array.get(bullboxarray, i), bar_index)

//Accumulation Box Plotting

if bull
    boxlowzone  = low_
    boxhighzone = close_ < open_ ? open_ : close_
    bullbox     = box.new(bar_index_, boxhighzone, bar_index, boxlowzone, border_color=adbullborderboxcolor, border_style=line.style_dashed, bgcolor=adbullboxcolor)
    if array.size(bullboxarray) > adboxcount
        box.delete(array.shift(bullboxarray))
    array.push(bullboxarray, bullbox)

f_choppedoffbear(bullboxarray)

The content covered on this website is NOT investment advice and I am not a financial advisor.