0% found this document useful (0 votes)
38 views8 pages

Estrategias Ict

The document describes settings and parameters for displaying volumetric order blocks on a chart. It includes inputs for toggling the display of order blocks, setting the number to show, colors, and options for filtering, timeframes, and other display settings. Types and arrays are defined to store the data for the individual volumetric order blocks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views8 pages

Estrategias Ict

The document describes settings and parameters for displaying volumetric order blocks on a chart. It includes inputs for toggling the display of order blocks, setting the number to show, colors, and options for filtering, timeframes, and other display settings. Types and arrays are defined to store the data for the individual volumetric order blocks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

//

//
//==> Volumetric Order Blocks
ob_show = input.bool (true
, "Show Last " , inline = "1", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Display volumetric order blocks on the chart \n\n[Input] Ammount of
volumetric order blocks to show")
ob_num = input.int (2
, "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Orderblocks number", minval = 1, maxval = 10)
ob_metrics_show = input.bool (true
, "Internal Buy/Sell Activity" , inline = "2", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Display volume metrics that have formed the orderblock")
css_metric_up = input.color (color.new(color.teal, 50)
, " " , inline = "2", group = "VOLUMETRIC ORDER BLOCKS")
css_metric_dn = input.color (color.new(color.red , 50)
, "" , inline = "2", group = "VOLUMETRIC ORDER BLOCKS")
ob_swings = input.bool (false
, "Swing Order Blocks" , inline = "a", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Display swing volumetric order blocks")
css_swing_up = input.color (color.new(#42bda8, 40)
, " " , inline = "a", group = "VOLUMETRIC ORDER BLOCKS")
css_swing_dn = input.color (color.new(#ff5252, 40)
, "" , inline = "a", group = "VOLUMETRIC ORDER BLOCKS")
ob_lookback_bool = input.bool (false
, "Lenght " , inline = "3", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "[Enable] Use the lenght period to determine the lowest/highest point
of the orderblock creation\n\n[Disable] Use the last opposite candle to determine
the orderblock creation")
ob_filter = input.string ("None"
, "Filtering " , inline = "d", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Filter out volumetric order blocks by BOS/CHoCH/CHoCH+", options =
["None", "BOS", "CHoCH", "CHoCH+"])
ob_looback = input.int (5
, "" , inline = "3", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Lookback to find lowest point for the construction of the volumetric
order blocks")
ob_mitigation = input.string ("Absolute"
, "Mitigation " , inline = "4", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Trigger to remove volumetric order blocks", options = ["Absolute",
"Middle"])
ob_timeframe = input.timeframe (""
, "Timeframe " , inline = "5", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Timeframe of the volumetric order blocks")
use_grayscale = input.bool (true
, "Grayscale" , inline = "6", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Use gray as basic order blocks color")
use_show_metric = input.bool (true
, "Show Metrics" , inline = "7", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Show volume associated with the orderblock and his relevance")
use_middle_line = input.bool (true
, "Show Middle-Line" , inline = "8", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Show mid-line order blocks")
use_overlap = input.bool (true
, "Hide Overlap" , inline = "9", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "Hide overlapping order blocks")
use_overlap_method = input.string ("Previous"
, "Overlap Method " , inline = "Z", group = "VOLUMETRIC ORDER BLOCKS"
, tooltip = "[Recent] Preserve the most recent volumetric order blocks\n\
n[Previous] Preserve the previous volumetric order blocks", options = ["Recent",
"Previous"])
ob_bull_css = input.color (color.new(color.teal, 90)
, "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS")
ob_bear_css = input.color (color.new(color.red , 90)
, "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS")
//
//-----------------------------------------------------------------------------{
// Custom Type
//-----------------------------------------------------------------------------{
type ob
float[] up_vol
float[] up_top
float[] up_bottom
int [] up_current_time
int [] up_last_time
int [] up_n
float[] dn_vol
float[] dn_top
float[] dn_bottom
int [] dn_current_time
int [] dn_last_time
int [] dn_n
float[] metric_up
float[] metric_dn

//-----------------------------------------------------------------------------{
// Type set
//-----------------------------------------------------------------------------{
bar b = bar.new()
var obv = ob.new(
array.new< float >(1, na)
, array.new< float >(1, na)
, array.new< float >(1, na)
, array.new< int >(1, na)
, array.new< int >(1, na)
, array.new< int >(1, na)

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


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

obsec(float src) =>

id = request.security("", ob_timeframe, src)


id

lstyle(style) =>

out = switch style


'⎯⎯⎯' => line.style_solid
'----' => line.style_dashed
'····' => line.style_dotted
[posVol, negVol]

[upvol, dnvol] = request.security("", ob_timeframe, vol())

volblock(bool condition, bool bull, string mitigation, float top, float bottom, int
left, int right, color css, float upx, float dnx, int position, float upv, float
dnv) =>
var ob_top = array.new< float >()
var ob_bottom = array.new< float >()
var ob_left = array.new< int >()
var ob_right = array.new< int >()
var ob_avg = array.new< float >()
var ob_vol = array.new< float >()
var redvol = array.new< float >()
var greenvol = array.new< float >()
var pos = array.new< int >()
var when = array.new< int >()
var countup = array.new< int >()
var countdn = array.new< int >()

var orderblock = array.new< box >()


var continuationorderblock = array.new< box >()
var uporderblock = array.new< box >()
var dnorderblock = array.new< box >()
var middlelvl = array.new< line >()

float sum = math.abs(ob_vol.sum())

if condition
paperlow = array.new< float >()
paperhigh = array.new< float >()
paperindex = array.new< int >()

paperlow .clear()
paperhigh.clear()

float avg = na
var bool isna = na

for i = 1 to ob_looback + 1

paperlow .push(low [i])


paperhigh .push(high[i])
paperindex.push(time[i])

if ob_lookback_bool == false

avg := math.avg(top, bottom)

ob_top .unshift(top )
ob_bottom.unshift(bottom)
ob_left .unshift(left )

if ob_lookback_bool

avg := bull ? math.avg(paperlow.min(),


paperhigh.get(paperlow.indexof(paperlow.min()))) : math.avg(paperhigh.max(),
paperlow.get(paperhigh.indexof(paperhigh.max())))

ob_top .unshift(bull ?
paperhigh .get(paperlow.indexof(paperlow.min())) : paperhigh .max())
ob_bottom.unshift(bull ? paperlow .min()
: paperlow .get(paperhigh.indexof(paperhigh.max())))
ob_left .unshift(bull ?
paperindex.get(paperlow.indexof(paperlow.min())) :
paperindex.get(paperhigh.indexof(paperhigh.max())))

ob_right .unshift(right )
ob_avg .unshift(avg )
ob_vol .unshift(bull ? dnv : upv)
redvol .unshift(dnx )
greenvol .unshift(upx )
pos .unshift(position )
when .unshift(1 )
countup .unshift(0 )
countdn .unshift(0 )

if use_overlap

int num = use_overlap_method == "Recent" ? 1 : 0

if ob_avg.size() > 1

if (bull ? ob_bottom.first() < ob_top.get(1) : ob_top.first() >


ob_bottom.get(1))

ob_top .remove(num)
ob_bottom.remove(num)
ob_left .remove(num)
ob_right .remove(num)
ob_avg .remove(num)
ob_vol .remove(num)
redvol .remove(num)
greenvol .remove(num)
pos .remove(num)
when .remove(num)
countup .remove(num)
countdn .remove(num)

if barstate.isconfirmed
out = switch mitigation
"Middle" => ob_avg
"Absolute" => bull ? ob_bottom : ob_top

target = out

for stuff in target

idx = target.indexof(stuff)

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

ob_top .remove(idx)
ob_bottom.remove(idx)
ob_left .remove(idx)
ob_right .remove(idx)
ob_avg .remove(idx)
ob_vol .remove(idx)
redvol .remove(idx)
greenvol .remove(idx)
pos .remove(idx)
when .remove(idx)
countup .remove(idx)
countdn .remove(idx)

if true

if barstate.isfirst

for i = 0 to ob_num - 1

orderblock .unshift(box.new (na, na, na, na, xloc =


xloc.bar_time, extend = extend.none , bgcolor = use_grayscale ? color.new(css,t) :
css, border_color = color.new(color.white,100)))
continuationorderblock.unshift(box.new (na, na, na, na, xloc =
xloc.bar_time, extend = extend.right, bgcolor = use_grayscale ? color.new(css,t) :
css, border_color = color.new(color.white,100)))
uporderblock .unshift(box.new (na, na, na, na, xloc =
xloc.bar_time, extend = extend.none , bgcolor = use_grayscale ? color.new(css,t) :
css, border_color = color.new(color.white,100)))
dnorderblock .unshift(box.new (na, na, na, na, xloc =
xloc.bar_time, extend = extend.none , bgcolor = use_grayscale ? color.new(css,t) :
css, border_color = color.new(color.white,100)))

middlelvl .unshift(line.new(na, na, na, na, xloc =


xloc.bar_time, extend = extend.none , color = color.new(css,0), style =
line.style_dashed, width = 1))

if barstate.islast

if ob_top.size() > 0

for i = 0 to math.min(ob_num - 1, ob_top.size() - 1)

get_orderblock = orderblock .get(i)


get_continuationorderblock = continuationorderblock.get(i)
get_uporderblock = uporderblock .get(i)
get_dnorderblock = dnorderblock .get(i)
get_middlelvl = middlelvl .get(i)

// MAIN ORDERBLOCK
box.set_top (get_orderblock, ob_top .get(i)
)
box.set_bottom(get_orderblock, ob_bottom .get(i)
)
box.set_left (get_orderblock, ob_left .get(i)
)
box.set_right (get_orderblock, time
)

// CONTINUATION BLOCK
box.set_top (get_continuationorderblock, ob_top .get(i)
)
box.set_bottom(get_continuationorderblock, ob_bottom.get(i)
)
box.set_left (get_continuationorderblock, time
)
box.set_right (get_continuationorderblock, time + (time -
time[1]) * 100)

// MIDDLE LEVEL
if use_middle_line

line.set_x1(get_middlelvl, ob_left .get(i))


line.set_x2(get_middlelvl, time )
line.set_y1(get_middlelvl, ob_avg .get(i))
line.set_y2(get_middlelvl, ob_avg .get(i))

if ob_metrics_show

box.set_top (get_uporderblock , ob_top .get(i))


box.set_bottom(get_uporderblock , ob_avg .get(i))
box.set_left (get_uporderblock , ob_left .get(i))
box.set_right (get_uporderblock , ob_left .get(i))
box.set_bgcolor(get_uporderblock , css_metric_up )

box.set_top (get_dnorderblock, ob_avg .get(i))


box.set_bottom(get_dnorderblock, ob_bottom .get(i))
box.set_left (get_dnorderblock, ob_left .get(i))
box.set_right (get_dnorderblock, ob_left .get(i))
box.set_bgcolor(get_dnorderblock, css_metric_dn )

takeup = box.get_right(get_uporderblock)
takedn = box.get_right(get_dnorderblock)
box.set_right (get_dnorderblock, takedn + (time - time[1])
* countdn.get(i))
box.set_right (get_uporderblock, takeup + (time - time[1])
* countup.get(i))

if use_show_metric

box.set_text (get_continuationorderblock,
str.tostring(math.round(ob_vol.get(i) / 1000,3)) + "K" + " (" +
str.tostring( math.abs(math.round((ob_vol.get(i) - (i == 0 ? sum : ob_vol.get(0)) )
/ (i == 0 ? sum : ob_vol.get(0)) ,3)) * 10) + "%)")
box.set_text_size (get_continuationorderblock, size.auto)
box.set_text_halign(get_continuationorderblock,
text.align_left)
box.set_text_color (get_continuationorderblock,
color.new(css,0))

if ob_metrics_show

if barstate.isconfirmed and when.size() > 0

for i = 0 to countup.size() - 1

if redvol.get(i) < greenvol.get(i)


switch when.get(i)
1 => countup.set(i, countup.get(i) + 1), when.set(i, 2)
2 => countup.set(i, countup.get(i) + 1), when.set(i, 3)
3 => countdn.set(i, countdn.get(i) + 1), when.set(i, 1)

if redvol.get(i) > greenvol.get(i)

switch when.get(i)
1 => countdn.set(i, countdn.get(i) + 1), when.set(i, 2)
2 => countdn.set(i, countdn.get(i) + 1), when.set(i, 3)
3 => countup.set(i, countup.get(i) + 1), when.set(i, 1)

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
)

if msline.size() == 450 // Limit to 450 to avoid issue with other drawing


object
line.delete(msline.shift())
msline.push(id)

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
)

//-----------------------------------------------------------------------------{
// Market strcture pivot point
//-----------------------------------------------------------------------------{
switch
b.c > b.o => boolean.set(green_candle, true)
b.c < b.o => boolean.set(red_candle , true)

_v = request.security("", ob_timeframe, volume)

switch
boolean.get(green_candle) => obv.up_bottom.push(obsec(low)),
obv.up_top.push(obsec(high)), obv.up_vol.push(math.abs(_v)),
obv.up_current_time.push(time), obv.up_last_time.push(time[1]),
obv.up_n.push(bar_index), obv.metric_up.push(upvol),
obv.metric_dn.push(math.abs(dnvol))
boolean.get(red_candle) => obv.dn_bottom.push(obsec(low)),
obv.dn_top.push(obsec(high)), obv.dn_vol.push(math.abs(_v)),
obv.dn_current_time.push(time), obv.dn_last_time.push(time[1]),
obv.dn_n.push(bar_index), obv.metric_up.push(upvol),
obv.metric_dn.push(math.abs(dnvol))
=> na

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 )

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) =>

var color css = na


var int count = 0
var int trend = 0
var int itrend = 0
var bool ob_bear = false
bool bear_ob = false
bool bull_ob = false
bool swing_up = false
bool swing_dn = false

if true

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy