индекс _c форекс / Page Not Found | Interactive Brokers

Индекс _c Форекс

индекс _c форекс

"Strong Demands & Supplies + Liquidity", max_lines_count=, max_lines_count = , max_boxes_count = , max_bars_back = , overlay = true)

//Option to show Liquidity lines on the chart
show_liquidity = input(true,"Show Liquidity? (Daily, Weekly, Monthly)",inline='Show Liquidity'
, group = 'Configuration')

var gStartOffset = 0
var gEndOffset = 25

color_text_prev_high_low = eunic-brussels.eu(eunic-brussels.eu(#f6eb54, 13), 'Color of previous day high and low'
, group = 'Configuration')

english_language_selected = input(false, 'Show Labels in English'
, group = 'Configuration')

// DEFINE COLORS of the lines displayed on the chart
// --> Blue lines: Daily liquidity
// --> Yellow lines: Weekly Liquidity
// --> Purple lines: Monthly liquidity
//daily liquidity
gIsDailyEnabled = true
gDailyAboveLiquidityColor = eunic-brussels.eu(#d3, 13)
gDailyBelowLiquidityColor = eunic-brussels.eu(#d3, 13)
gDailyWidth = 1

//weekly liquidity
gIsWeeklyEnabled = true
gWeeklyAboveLiquidityColor = eunic-brussels.eu(#f6eb54, 13)
gWeeklyBelowLiquidityColor = eunic-brussels.eu(#f6eb54, 13)
gWeeklyWidth = 1

//month liquidity
gIsMonthlyEnabled = true
gMonthlyAboveLiquidityColor = eunic-brussels.eu(#f66ecf, 13)
gMonthlyBelowLiquidityColor = eunic-brussels.eu(#f66ecf, 13)
gMonthlyWidth = 1

cleanedLevelColor = eunic-brussels.eu(#ffffff, )
cleanedLevelStyle = "Dashed"


var highArray = eunic-brussels.eu_float()
var lowArray = eunic-brussels.eu_float()
var highLinesArray = eunic-brussels.eu_line()
var lowLinesArray = eunic-brussels.eu_line()
var purgedLinesArray = eunic-brussels.eu_line()

[prevDayHigh, prevDayLow] = eunic-brussels.euty(eunic-brussels.euid, "D", [high[1], low[1]], lookahead=eunic-brussels.euead_on)
[prevWeekHigh, prevWeekLow] = eunic-brussels.euty(eunic-brussels.euid, "W", [high[1], low[1]], lookahead=eunic-brussels.euead_on)
[prevMonthHigh, prevMonthLow] = eunic-brussels.euty(eunic-brussels.euid, "M", [high[1], low[1]], lookahead=eunic-brussels.euead_on)
[prev4HHigh, prev4HLow] = eunic-brussels.euty(eunic-brussels.euid, "", [high[1], low[1]], lookahead=eunic-brussels.euead_on)
[prev1HHigh, prev1HLow] = eunic-brussels.euty(eunic-brussels.euid, "60", [high[1], low[1]], lookahead=eunic-brussels.euead_on)

//Set Labels text according language selected (English or Portuguese)
demand_lbl_txt = ""
if (english_language_selected == false)
demand_lbl_txt := "Zona de Compra"
else
demand_lbl_txt := "Demand/Buy Zone"

supply_lbl_txt = ""
if (english_language_selected == false)
supply_lbl_txt := "Zona de Venda"
else
supply_lbl_txt := "Supply/Sell Zone"

strong_high_lbl = ""
if (english_language_selected == false)
strong_high_lbl := "Alto Forte"
else
strong_high_lbl := "Strong High"

strong_low_lbl = ""
if (english_language_selected == false)
strong_low_lbl := "Baixo Forte"
else
strong_low_lbl := "Strong Low"

weak_low_lbl = ""
if (english_language_selected == false)
weak_low_lbl := "Baixo Fraco"
else
weak_low_lbl := "Weak Low"

weak_high_lbl = ""
if (english_language_selected == false)
weak_high_lbl := "Alto Fraco"
else
weak_high_lbl := "Weak High"

previous_day_high_lbl = ""
if (english_language_selected == false)
previous_day_high_lbl := "Preço Máximo do dia Anterior"
else
previous_day_high_lbl := "Previous Day Highest Price"

previous_day_low_lbl = ""
if (english_language_selected == false)
previous_day_low_lbl := "Preço Minimo do dia Anterior"
else
previous_day_low_lbl := "Previous Day Lowest Price"

// Functions
f_drawLine(_y, _c, _w=1) => eunic-brussels.eu(bar_index, _y, bar_index, _y, color=_c, width=_w)

f_create(_high, _low, _upperColor, _lowerColor, _linewidth) =>
eunic-brussels.eu(highArray, _high)
eunic-brussels.eu(lowArray, _low)
eunic-brussels.eu(highLinesArray, f_drawLine(_high, _upperColor, _linewidth))
eunic-brussels.eu(lowLinesArray, f_drawLine(_low, _lowerColor, _linewidth))

f_updateStickyLevels(_levels) =>
for _line in _levels
eunic-brussels.eu_x1(_line, bar_index + gStartOffset)
eunic-brussels.eu_x2(_line, bar_index + gEndOffset)

f_moveLevel(_from, _to, _level, _index) =>
eunic-brussels.eu(_to, _level)
eunic-brussels.eu(_from, _index)

f_highlightPurgedLevel(_level) =>
_style = cleanedLevelStyle == "Solid" ? eunic-brussels.eu_solid : cleanedLevelStyle == "Dashed" ? eunic-brussels.eu_dashed : eunic-brussels.eu_dotted
eunic-brussels.eu_color(_level, cleanedLevelColor)
eunic-brussels.eu_style(_level, _style)

f_updateUpperLevels(_high, _highs, _levels, _purgedLevels) =>
while eunic-brussels.eu(_highs) < _high
for [_index, _value] in _highs
if _high > _value
_line = eunic-brussels.eu(_levels, _index)
f_highlightPurgedLevel(_line)
f_moveLevel(_levels, _purgedLevels, _line, _index)
eunic-brussels.eu(_highs, _index)
f_updateLowerLevels(_low, _lows, _levels, _purgedLevels) =>
while eunic-brussels.eu(_lows) > _low
for [_index, _value] in _lows
if _low < _value
_line = eunic-brussels.eu(_levels, _index)
f_highlightPurgedLevel(_line)
f_moveLevel(_levels, _purgedLevels, _line, _index)
eunic-brussels.eu(_lows, _index)

f_clearLevels(_levels) =>
while eunic-brussels.eu(_levels) > 0
for [_index, _line] in _levels
eunic-brussels.eu(eunic-brussels.eu(_levels, _index))

f_isHigherTimeframe(_timeframe) => eunic-brussels.eu_seconds() <= eunic-brussels.eu_seconds(_timeframe)

//Draw Lines if liquidity is enabled
if show_liquidity
if gIsDailyEnabled and f_isHigherTimeframe("D") and eunic-brussels.eu(time("D"))
f_create(prevDayHigh, prevDayLow, gDailyAboveLiquidityColor, gDailyBelowLiquidityColor, gDailyWidth)

if gIsWeeklyEnabled and f_isHigherTimeframe("W") and eunic-brussels.eu(time("W"))
f_create(prevWeekHigh, prevWeekLow, gWeeklyAboveLiquidityColor, gWeeklyBelowLiquidityColor, gWeeklyWidth)

if gIsMonthlyEnabled and f_isHigherTimeframe("M") and eunic-brussels.eu(time("M"))
f_create(prevMonthHigh, prevMonthLow, gMonthlyAboveLiquidityColor, gMonthlyBelowLiquidityColor, gMonthlyWidth)


if eunic-brussels.eu
f_updateStickyLevels(highLinesArray)
f_updateStickyLevels(lowLinesArray)
f_updateStickyLevels(purgedLinesArray)

// Highlight the levels that got their liquidity taken

f_updateUpperLevels(high, highArray, highLinesArray, purgedLinesArray)
f_updateLowerLevels(low, lowArray, lowLinesArray, purgedLinesArray)

// Clean the levels that had their liquidity taken on a daily basis
if eunic-brussels.eu(time("D"))
f_clearLevels(purgedLinesArray)

color TRANSP_COLOR = #ffffff00

//Tooltips
string TOOLTIP = 'Allows to display historical Structure'
string STYLE = 'color theme'
string COLOR_CANDLES = 'Display additional candles'

mode = 'Historical'
style = 'Colored'
show_trend = false


//Internal Structure
show_internals = false
show_ibull = 'All'
swing_ibull_css =#5ef8d

//Bear Structure
show_ibear = 'All'
swing_ibear_css = #c40d0d5b
ifilter_confluence = false

//Swing Structure
show_Structure = true

//Bull Structure
show_bull = 'All'
swing_bull_css = #0dea7f63

//Bear Structure
show_bear = 'All'
swing_bear_css = #c40d0de8

//Swings
show_swings = true
length = 50
show_hl_swings = true

//Order Blocks Variables

show_iob = false
iob_showlast = 5
show_ob = true
ob_showlast = 5
ob_filter = 'Atr'
ibull_ob_css = #0bff
ibear_ob_css = eunic-brussels.eu(#e, 80)
bull_ob_css = #0bff
bear_ob_css = eunic-brussels.eu(#e, 80)

//Imbalances / Gaps

show_fvg = true
fvg_auto = true
fvg_tf = ''
bull_fvg_css = eunic-brussels.eu(#bef4d, 70)
bear_fvg_css = eunic-brussels.eu(#bef4d, 70)
fvg_extend = 5


//Previous day/week high/low

//Daily
show_pdhl = true
pdhl_style = '····'
pdhl_css = #ffffff

//Premium and Discount zones

show_sd = true
premium_css = #ec
discount_css = #d

//Functions
n = bar_index

atr = eunic-brussels.eu()
cmean_range = eunic-brussels.eu(high - low) / n

//HL Output function
hl() => [high, low]

//Get ohlc values function
get_ohlc()=> [close[1], open[1], high, low, high[2], low[2]]

//Display Structure function
display_Structure(x, y, txt, css, dashed, down, lbl_size)=>
structure_line = eunic-brussels.eu(x, y, n, y
, color = css
, style = dashed ? eunic-brussels.eu_dashed : eunic-brussels.eu_solid)

structure_lbl = eunic-brussels.eu(int(eunic-brussels.eu(x, n)), y, txt
, color = TRANSP_COLOR
, textcolor = css
, style = down ? eunic-brussels.eu_label_down : eunic-brussels.eu_label_up
, size = lbl_size)

if mode == 'Present'
eunic-brussels.eu(structure_line[1])
eunic-brussels.eu(structure_lbl[1])

//Swings detection/measurements
swings_calc(len)=>
var os = 0

upper = eunic-brussels.eut(len)
lower = eunic-brussels.eu(len)

os := high[len] > upper ? 0 : low[len] < lower ? 1 : os[1]

top = os == 0 and os[1] != 0 ? high[len] : 0
btm = os == 1 and os[1] != 1 ? low[len] : 0

[top, btm]

//Order block coordinates function
ob_coord(use_max, loc, target_top, target_btm, target_left, target_type)=>
min =
max = 0.
idx = 1

ob_threshold = ob_filter == 'Atr' ? atr : cmean_range

//Search for highest/lowest high within the structure interval and get range
if use_max
for i = 1 to (n - loc)-1
if (high[i] - low[i]) < ob_threshold[i] * 2
max := eunic-brussels.eu(high[i], max)
min := max == high[i] ? low[i] : min
idx := max == high[i] ? i : idx
else
for i = 1 to (n - loc)-1
if (high[i] - low[i]) < ob_threshold[i] * 2
min := eunic-brussels.eu(low[i], min)
max := min == low[i] ? high[i] : max
idx := min == low[i] ? i : idx

eunic-brussels.eut(target_top, max)
eunic-brussels.eut(target_btm, min)
eunic-brussels.eut(target_left, time[idx])
eunic-brussels.eut(target_type, use_max ? -1 : 1)

//Set order blocks
display_ob(boxes, target_top, target_btm, target_left, target_type, show_last, swing, size)=>
for i = 0 to eunic-brussels.eu(show_last-1, size-1)
get_box = eunic-brussels.eu(boxes, i)

eunic-brussels.eu_lefttop(get_box, eunic-brussels.eu(target_left, i), eunic-brussels.eu(target_top, i))
eunic-brussels.eu_rightbottom(get_box, eunic-brussels.eu(target_left, i), eunic-brussels.eu(target_btm, i))
eunic-brussels.eu_extend(get_box, eunic-brussels.eu)

color css = na

if swing
if style == 'Monochrome'
css := eunic-brussels.eu(target_type, i) == 1 ? eunic-brussels.eu(#b2b5be, 80) : eunic-brussels.eu(#5db, 80)
border_css = eunic-brussels.eu(target_type, i) == 1 ? #b2b5be : #5db
else
css := eunic-brussels.eu(target_type, i) == 1 ? bull_ob_css : bear_ob_css


eunic-brussels.eu_border_color(get_box, css)
eunic-brussels.eu_bgcolor(get_box, css)
else
if style == 'Monochrome'
css := eunic-brussels.eu(target_type, i) == 1 ? eunic-brussels.eu(#b2b5be, 80) : eunic-brussels.eu(#5db, 80)
else
css := eunic-brussels.eu(target_type, i) == 1 ? ibull_ob_css : ibear_ob_css

eunic-brussels.eu_border_color(get_box, css)
eunic-brussels.eu_bgcolor(get_box, css)

//Line Style function
get_line_style(style) =>
out = switch style
'⎯⎯⎯' => eunic-brussels.eu_solid
'' => eunic-brussels.eu_dashed
'····' => eunic-brussels.eu_dotted

//Set line and labels for previous high and lows
define_previous_days_prices(h, l, tf, css)=>
var line high_line = eunic-brussels.eu(na,na,na,na
, xloc = eunic-brussels.eu_time
, color = css
, style = get_line_style(pdhl_style))

var label high_lbl = eunic-brussels.eu(na,na
, xloc = eunic-brussels.eu_time
, text = eunic-brussels.eu(previous_day_high_lbl, tf)
, color = TRANSP_COLOR
, textcolor = color_text_prev_high_low
, size = eunic-brussels.eu
, style = eunic-brussels.eu_label_left)

var line low_line = eunic-brussels.eu(na,na,na,na
, xloc = eunic-brussels.eu_time
, color = css
, style = get_line_style(pdhl_style))

var label low_lbl = eunic-brussels.eu(na,na
, xloc = eunic-brussels.eu_time
, text = eunic-brussels.eu(previous_day_low_lbl, tf)
, color = TRANSP_COLOR
, textcolor = color_text_prev_high_low
, size = eunic-brussels.eu
, style = eunic-brussels.eu_label_left)

hy = eunic-brussels.euhen(h != h[1], h, 1)
hx = eunic-brussels.euhen(h == high, time, 1)

ly = eunic-brussels.euhen(l != l[1], l, 1)
lx = eunic-brussels.euhen(l == low, time, 1)

if eunic-brussels.eu
ext = time + (time - time[1])*20

//High
eunic-brussels.eu_xy1(high_line, hx, hy)
eunic-brussels.eu_xy2(high_line, ext, hy)

eunic-brussels.eu_xy(high_lbl, ext, hy)

//Low
eunic-brussels.eu_xy1(low_line, lx, ly)
eunic-brussels.eu_xy2(low_line, ext, ly)

eunic-brussels.eu_xy(low_lbl, ext, ly)

//}
//Global variables
//{
var trend = 0, var itrend = 0

var top_y = 0., var top_x = 0
var btm_y = 0., var btm_x = 0

var itop_y = 0., var itop_x = 0
var ibtm_y = 0., var ibtm_x = 0

var trail_up = high, var trail_dn = low
var trail_up_x = 0, var trail_dn_x = 0

var top_cross = true, var btm_cross = true
var itop_cross = true, var ibtm_cross = true

var txt_top = '', var txt_btm = ''

//Alerts
bull_choch_alert = false
bull_bos_alert = false

bear_choch_alert = false
bear_bos_alert = false

bull_ichoch_alert = false
bull_ibos_alert = false

bear_ichoch_alert = false
bear_ibos_alert = false

bull_iob_break = false
bear_iob_break = false

bull_ob_break = false
bear_ob_break = false

eqh_alert = false
eql_alert = false

//Structure colors
var bull_css = style == 'Monochrome' ? #b2b5be
: swing_bull_css

var bear_css = style == 'Monochrome' ? #b2b5be
: swing_bear_css

var ibull_css = style == 'Monochrome' ? #b2b5be
: swing_ibull_css

var ibear_css = style == 'Monochrome' ? #b2b5be
: swing_ibear_css

//Swings
[top, btm] = swings_calc(length)

[itop, ibtm] = swings_calc(5)

//}
//Pivot High
//{
var line extend_top = na

var label extend_top_lbl = eunic-brussels.eu(na, na
, color = TRANSP_COLOR
, textcolor = bear_css
, style = eunic-brussels.eu_label_down
, size = eunic-brussels.eu)

if top
top_cross := true
txt_top := top > top_y ? 'HH' : 'LH'

if show_swings
top_lbl = eunic-brussels.eu(n-length, top, txt_top
, color = TRANSP_COLOR
, textcolor = bear_css
, style = eunic-brussels.eu_label_down
, size = eunic-brussels.eu)

if mode == 'Present'
eunic-brussels.eu(top_lbl[1])

//Extend recent top to last bar
eunic-brussels.eu(extend_top[1])
extend_top := eunic-brussels.eu(n-length, top, n, top
, color = bear_css)

top_y := top
top_x := n - length

trail_up := top
trail_up_x := n - length

if itop
itop_cross := true

itop_y := itop
itop_x := n - 5

//Trailing maximum
trail_up := eunic-brussels.eu(high, trail_up)
trail_up_x := trail_up == high ? n : trail_up_x

//Set top extension label/line
if eunic-brussels.eu and show_hl_swings
eunic-brussels.eu_xy1(extend_top, trail_up_x, trail_up)
eunic-brussels.eu_xy2(extend_top, n + 20, trail_up)

eunic-brussels.eu_x(extend_top_lbl, n + 20)
eunic-brussels.eu_y(extend_top_lbl, trail_up)
eunic-brussels.eu_text(extend_top_lbl, trend < 0 ? strong_high_lbl : weak_high_lbl)

//}
//Pivot Low
//{
var line extend_btm = na

var label extend_btm_lbl = eunic-brussels.eu(na, na
, color = TRANSP_COLOR
, textcolor = bull_css
, style = eunic-brussels.eu_label_up
, size = eunic-brussels.eu)

if btm
btm_cross := true
txt_btm := btm < btm_y ? 'LL' : 'HL'

if show_swings
btm_lbl = eunic-brussels.eu(n - length, btm, txt_btm
, color = TRANSP_COLOR
, textcolor = bull_css
, style = eunic-brussels.eu_label_up
, size = eunic-brussels.eu)

if mode == 'Present'
eunic-brussels.eu(btm_lbl[1])

//Extend recent btm to last bar
eunic-brussels.eu(extend_btm[1])
extend_btm := eunic-brussels.eu(n - length, btm, n, btm
, color = bull_css)

btm_y := btm
btm_x := n-length

trail_dn := btm
trail_dn_x := n-length

if ibtm
ibtm_cross := true

ibtm_y := ibtm
ibtm_x := n - 5

//Trailing minimum
trail_dn := eunic-brussels.eu(low, trail_dn)
trail_dn_x := trail_dn == low ? n : trail_dn_x

//Set btm extension label/line
if eunic-brussels.eu and show_hl_swings
eunic-brussels.eu_xy1(extend_btm, trail_dn_x, trail_dn)
eunic-brussels.eu_xy2(extend_btm, n + 20, trail_dn)

eunic-brussels.eu_x(extend_btm_lbl, n + 20)
eunic-brussels.eu_y(extend_btm_lbl, trail_dn)
eunic-brussels.eu_text(extend_btm_lbl, trend > 0 ? strong_low_lbl : weak_low_lbl)

//}
//Order Blocks Arrays
//{
var iob_top = eunic-brussels.eu_float(0)
var iob_btm = eunic-brussels.eu_float(0)
var iob_left = eunic-brussels.eu_int(0)
var iob_type = eunic-brussels.eu_int(0)

var ob_top = eunic-brussels.eu_float(0)
var ob_btm = eunic-brussels.eu_float(0)
var ob_left = eunic-brussels.eu_int(0)
var ob_type = eunic-brussels.eu_int(0)

//}
//Pivot High BOS and Choch
//{
//Filtering
var bull_concordant = true

if ifilter_confluence
bull_concordant := high - eunic-brussels.eu(close, open) > eunic-brussels.eu(close, open - low)

//Detect internal bullish Structure
if eunic-brussels.euver(close, itop_y) and itop_cross and top_y != itop_y and bull_concordant
bool choch = na

if itrend < 0
choch := true
bull_ichoch_alert := true
else
bull_ibos_alert := true

txt = ""
if(english_language_selected == false)
txt := choch ? 'Alteração de Caráter' : 'Quebra Estrutura'
else
txt := choch ? 'Change of Character' : 'Break of Structure'

if show_internals
if show_ibull == 'All' or (show_ibull == 'BOS' and not choch) or (show_ibull == 'CHoCH' and choch)
display_Structure(itop_x, itop_y, txt, ibull_css, true, true, eunic-brussels.eu)

itop_cross := false
itrend := 1

//Internal Order Block
if show_iob
ob_coord(false, itop_x, iob_top, iob_btm, iob_left, iob_type)

//Detect bullish Structure
if eunic-brussels.euver(close, top_y) and top_cross
bool choch = na

if trend < 0
choch := true
bull_choch_alert := true
else
bull_bos_alert := true

txt = ""
if(english_language_selected == false)
txt := choch ? 'Alteração de Caráter' : 'Quebra Estrutura'
else
txt := choch ? 'Change of Character' : 'Break of Structure'
//txt = choch ? 'Alteração de Caráter' : 'Quebra Estrutura'

if show_Structure
if show_bull == 'All' or (show_bull == 'BOS' and not choch) or (show_bull == 'CHoCH' and choch)
display_Structure(top_x, top_y, txt, #0ddc67d0, true, true, eunic-brussels.eu)

//Order Block
if show_ob
ob_coord(false, top_x, ob_top, ob_btm, ob_left, ob_type)

top_cross := false
trend := 1

//}
//Pivot Low BOS and CHoCH
//{
var bear_concordant = true

if ifilter_confluence
bear_concordant := high - eunic-brussels.eu(close, open) < eunic-brussels.eu(close, open - low)

//Detect internal bearish Structure
if eunic-brussels.eunder(close, ibtm_y) and ibtm_cross and btm_y != ibtm_y and bear_concordant
bool choch = false

if itrend > 0
choch := true
bear_ichoch_alert := true
else
bear_ibos_alert := true

txt = ""
if(english_language_selected == false)
txt := choch ? 'Alteração de Caráter' : 'Quebra Estrutura'
else
txt := choch ? 'Change of Character' : 'Break of Structure'
//txt = choch ? 'Alteração de Caráter' : 'QUEBRA DE ESTRUTURA'

if show_internals
if show_ibear == 'All' or (show_ibear == 'BOS' and not choch) or (show_ibear == 'CHoCH' and choch)
display_Structure(ibtm_x, ibtm_y, txt, ibear_css, true, false, eunic-brussels.eu)

ibtm_cross := false
itrend := -1

//Internal Order Block
if show_iob
ob_coord(true, ibtm_x, iob_top, iob_btm, iob_left, iob_type)

//Detect bearish Structure
if eunic-brussels.eunder(close, btm_y) and btm_cross
bool choch = na

if trend > 0
choch := true
bear_choch_alert := true
else
bear_bos_alert := true

txt = ""
if(english_language_selected == false)
txt := choch ? 'Alteração de Caráter' : 'Quebra Estrutura'
else
txt := choch ? 'Change of Character' : 'Break of Structure'

//txt = choch ? 'Alteração de Caráter' : 'QUEBRA DE ESTRUTURA'

if show_Structure
if show_bear == 'All' or (show_bear == 'BOS' and not choch) or (show_bear == 'CHoCH' and choch)
display_Structure(btm_x, btm_y, txt, #dc0d0dd0, true, false, eunic-brussels.eu)

//Order Block
if show_ob
ob_coord(true, btm_x, ob_top, ob_btm, ob_left, ob_type)

btm_cross := false
trend := -1

//}
//Order Blocks
//{
//Set order blocks
var iob_boxes = eunic-brussels.eu_box(0)
var ob_boxes = eunic-brussels.eu_box(0)

//Delete internal order blocks box coordinates if top/bottom is broken
for element in iob_type
index = eunic-brussels.euf(iob_type, element)

if close < eunic-brussels.eu(iob_btm, index) and element == 1
eunic-brussels.eu(iob_top, index)
eunic-brussels.eu(iob_btm, index)
eunic-brussels.eu(iob_left, index)
eunic-brussels.eu(iob_type, index)
bull_iob_break := true

else if close > eunic-brussels.eu(iob_top, index) and element == -1
eunic-brussels.eu(iob_top, index)
eunic-brussels.eu(iob_btm, index)
eunic-brussels.eu(iob_left, index)
eunic-brussels.eu(iob_type, index)
bear_iob_break := true

//Delete internal order blocks box coordinates if top/bottom is broken
for element in ob_type
index = eunic-brussels.euf(ob_type, element)

if close < eunic-brussels.eu(ob_btm, index) and element == 1
eunic-brussels.eu(ob_top, index)
eunic-brussels.eu(ob_btm, index)
eunic-brussels.eu(ob_left, index)
eunic-brussels.eu(ob_type, index)
bull_ob_break := true

else if close > eunic-brussels.eu(ob_top, index) and element == -1
eunic-brussels.eu(ob_top, index)
eunic-brussels.eu(ob_btm, index)
eunic-brussels.eu(ob_left, index)
eunic-brussels.eu(ob_type, index)
bear_ob_break := true

iob_size = eunic-brussels.eu(iob_type)
ob_size = eunic-brussels.eu(ob_type)

if eunic-brussels.eut
if show_iob
for i = 0 to iob_showlast-1
eunic-brussels.eu(iob_boxes, eunic-brussels.eu(na,na,na,na, xloc = eunic-brussels.eu_time))
if show_ob
for i = 0 to ob_showlast-1
eunic-brussels.eu(ob_boxes, eunic-brussels.eu(na,na,na,na, xloc = eunic-brussels.eu_time))

if iob_size > 0
if eunic-brussels.eu
display_ob(iob_boxes, iob_top, iob_btm, iob_left, iob_type, iob_showlast, false, iob_size)

if ob_size > 0
if eunic-brussels.eu
display_ob(ob_boxes, ob_top, ob_btm, ob_left, ob_type, ob_showlast, true, ob_size)


//}
//Imbalances
//{
var bullish_fvg_max = eunic-brussels.eu_box(0)
var bullish_fvg_min = eunic-brussels.eu_box(0)

var bearish_fvg_max = eunic-brussels.eu_box(0)
var bearish_fvg_min = eunic-brussels.eu_box(0)

float bullish_fvg_avg = na
float bearish_fvg_avg = na

bullish_fvg_cnd = false
bearish_fvg_cnd = false

[src_c1, src_o1, src_h, src_l, src_h2, src_l2] =
eunic-brussels.euty(eunic-brussels.euid, fvg_tf, get_ohlc())

if show_fvg
delta_per = (src_c1 - src_o1) / src_o1 *

change_tf = eunic-brussels.eu(fvg_tf)

threshold = fvg_auto ? eunic-brussels.eu(eunic-brussels.eu(change_tf ? delta_per : 0)) / n * 2
: 0

//FVG conditions
bullish_fvg_cnd := src_l > src_h2
and src_c1 > src_h2
and delta_per > threshold
and change_tf

bearish_fvg_cnd := src_h < src_l2
and src_c1 < src_l2
and -delta_per > threshold
and change_tf

//FVG Areas
if bullish_fvg_cnd
eunic-brussels.eut(bullish_fvg_max, eunic-brussels.eu(n-1, src_l, n + fvg_extend, eunic-brussels.eu(src_l, src_h2)
, border_color = bull_fvg_css
, bgcolor = bull_fvg_css))

eunic-brussels.eut(bullish_fvg_min, eunic-brussels.eu(n-1, eunic-brussels.eu(src_l, src_h2), n + fvg_extend, src_h2
, border_color = bull_fvg_css
, bgcolor = bull_fvg_css))

if bearish_fvg_cnd
eunic-brussels.eut(bearish_fvg_max, eunic-brussels.eu(n-1, src_h, n + fvg_extend, eunic-brussels.eu(src_h, src_l2)
, border_color = bear_fvg_css
, bgcolor = bear_fvg_css))

eunic-brussels.eut(bearish_fvg_min, eunic-brussels.eu(n-1, eunic-brussels.eu(src_h, src_l2), n + fvg_extend, src_l2
, border_color = bear_fvg_css
, bgcolor = bear_fvg_css))

for bx in bullish_fvg_min
if low < eunic-brussels.eu_bottom(bx)
eunic-brussels.eu(bx)
eunic-brussels.eu(eunic-brussels.eu(bullish_fvg_max, eunic-brussels.euf(bullish_fvg_min, bx)))

for bx in bearish_fvg_max
if high > eunic-brussels.eu_top(bx)
eunic-brussels.eu(bx)
eunic-brussels.eu(eunic-brussels.eu(bearish_fvg_min, eunic-brussels.euf(bearish_fvg_max, bx)))

//}
//Previous day/week high/lows
//{
//Daily high/low
[pdh, pdl] = eunic-brussels.euty(eunic-brussels.euid, 'D', hl()
, lookahead = eunic-brussels.euead_on)


//Display Daily
if show_pdhl
define_previous_days_prices(pdh, pdl, 'D', pdhl_css)

//Premium and Discount Zones

var premium = eunic-brussels.eu(na, na, na, na
, bgcolor = eunic-brussels.eu(premium_css, 80)
, border_color = na)

var premium_lbl = eunic-brussels.eu(na, na
, text = supply_lbl_txt
, color = TRANSP_COLOR
, textcolor = #e43e3ee5
, style = eunic-brussels.eu_label_down
, size = eunic-brussels.eu)

var discount = eunic-brussels.eu(na, na, na, na
, bgcolor = eunic-brussels.eu(discount_css, 80)
, border_color = na)

var discount_lbl = eunic-brussels.eu(na, na
, text = demand_lbl_txt
, color = TRANSP_COLOR
, textcolor = #13b
, style = eunic-brussels.eu_label_up
, size = eunic-brussels.eu)

//Show Premium and Discount Areas
if eunic-brussels.eu and show_sd
avg = eunic-brussels.eu(trail_up, trail_dn)

eunic-brussels.eu_lefttop(premium, eunic-brussels.eu(top_x, btm_x), trail_up)
eunic-brussels.eu_rightbottom(premium, n, * trail_up + * trail_dn)

eunic-brussels.eu_xy(premium_lbl, int(eunic-brussels.eu(eunic-brussels.eu(top_x, btm_x), n)), trail_up)

eunic-brussels.eu_lefttop(discount, eunic-brussels.eu(top_x, btm_x), * trail_dn + * trail_up)
eunic-brussels.eu_rightbottom(discount, n, trail_dn)
eunic-brussels.eu_xy(discount_lbl, int(eunic-brussels.eu(eunic-brussels.eu(top_x, btm_x), n)), trail_dn)

//}
//Trend Definition
//{
var color trend_css = na



if style == 'Colored'
trend_css := itrend == 1 ? bull_css : bear_css
else if style == 'Monochrome'
trend_css := itrend == 1 ? #b2b5be : #5db


//}
// Definition of Possible Alerts
//{

alertcondition(bull_bos_alert, 'Bullish BOS', 'Quebra de Estrutura Bullish')
alertcondition(bull_choch_alert, 'Bullish CHoCH', 'Bullish CHoCH')

alertcondition(bear_bos_alert, 'Bearish BOS', 'Quebra de Estrutura Bearish')
alertcondition(bear_choch_alert, 'Bearish CHoCH', 'Bearish CHoCH')

gudutrader
 
Posts: 12
Joined: Tue Dec 04, am

Top

CrossEntropyLoss¶

classeunic-brussels.euntropyLoss(weight=None, size_average=None, ignore_index=, reduce=None, reduction='mean', label_smoothing=)[source]¶

This criterion computes the cross entropy loss between input logits and target.

It is useful when training a classification problem with C classes. If provided, the optional argument should be a 1D Tensor assigning weight to each of the classes. This is particularly useful when you have an unbalanced training set.

The input is expected to contain the unnormalized logits for each class (which do not need to be positive or sum to 1, in general). input has to be a Tensor of size (C) for unbatched input, (minibatch,C) or (minibatch,C,d1​,d2​,,dK​) with K≥1 for the K-dimensional case. The last being useful for higher dimension inputs, such as computing cross entropy loss per-pixel for 2D images.

The target that this criterion expects should contain either:

  • Class indices in the range [0,C) where C is the number of classes; if ignore_index is specified, this loss also accepts this class index (this index may not necessarily be in the class range). The unreduced (i.e. with set to ) loss for this case can be described as:

    ℓ(x,y)=L={l1​,…,lN​}⊤,ln​=−wyn​​log∑c=1C​exp(xn,c​)exp(xn,yn​​)​⋅1{yn​=ignore_index}

    where x is the input, y is the target, w is the weight, C is the number of classes, and N spans the minibatch dimension as well as d1​,,dk​ for the K-dimensional case. If is not (default ), then

    ℓ(x,y)={∑n=1N​∑n=1N​wyn​​⋅1{yn​=ignore_index}1​ln​,∑n=1N​ln​,​if reduction=‘mean’;if reduction=‘sum’.​

    Note that this case is equivalent to applying on an input, followed by .

  • Probabilities for each class; useful when labels beyond a single class per minibatch item are required, such as for blended labels, label smoothing, etc. The unreduced (i.e. with set to ) loss for this case can be described as:

    ℓ(x,y)=L={l1​,…,lN​}⊤,ln​=−c=1∑C​wc​log∑i=1C​exp(xn,i​)exp(xn,c​)​yn,c​

    where x is the input, y is the target, w is the weight, C is the number of classes, and N spans the minibatch dimension as well as d1​,,dk​ for the K-dimensional case. If is not (default ), then

    ℓ(x,y)={N∑n=1N​ln​​,∑n=1N​ln​,​if reduction=‘mean’;if reduction=‘sum’.​

Note

The performance of this criterion is generally better when target contains class indices, as this allows for optimized computation. Consider providing target as class probabilities only when a single class label per minibatch item is too restrictive.

Parameters
  • weight (Tensor, optional) – a manual rescaling weight given to each class. If given, has to be a Tensor of size C and floating point dtype

  • size_average (bool, optional) – Deprecated (see ). By default, the losses are averaged over each loss element in the batch. Note that for some losses, there are multiple elements per sample. If the field is set to , the losses are instead summed for each minibatch. Ignored when is . Default:

  • ignore_index (int, optional) – Specifies a target value that is ignored and does not contribute to the input gradient. When is , the loss is averaged over non-ignored targets. Note that is only applicable when the target contains class indices.

  • reduce (bool, optional) – Deprecated (see ). By default, the losses are averaged or summed over observations for each minibatch depending on . When is , returns a loss per batch element instead and ignores . Default:

  • reduction (str, optional) – Specifies the reduction to apply to the output: . : no reduction will be applied, : the weighted mean of the output is taken, : the output will be summed. Note: and are in the process of being deprecated, and in the meantime, specifying either of those two args will override . Default:

  • label_smoothing (float, optional) – A float in [, ]. Specifies the amount of smoothing when computing the loss, where means no smoothing. The targets become a mixture of the original ground truth and a uniform distribution as described in Rethinking the Inception Architecture for Computer Vision. Default:

Shape:
  • Input: Shape (C), (N,C) or (N,C,d1​,d2​,,dK​) with K≥1 in the case of K-dimensional loss.

  • Target: If containing class indices, shape (), (N) or (N,d1​,d2​,,dK​) with K≥1 in the case of K-dimensional loss where each value should be between [0,C). If containing class probabilities, same shape as the input and each value should be between [0,1].

  • Output: If reduction is ‘none’, shape (), (N) or (N,d1​,d2​,,dK​) with K≥1 in the case of K-dimensional loss, depending on the shape of the input. Otherwise, scalar.

where:

C=N=​number of classesbatch size​

Examples:

>>> # Example of target with class indices>>> loss=eunic-brussels.euntropyLoss()>>> input=eunic-brussels.eu(3,5,requires_grad=True)>>> target=eunic-brussels.eu(3,dtype=eunic-brussels.eu).random_(5)>>> output=loss(input,target)>>> eunic-brussels.eurd()>>>>>> # Example of target with class probabilities>>> input=eunic-brussels.eu(3,5,requires_grad=True)>>> target=eunic-brussels.eu(3,5).softmax(dim=1)>>> output=loss(input,target)>>> eunic-brussels.eurd()

© Copyright , PyTorch Contributors.

Built with Sphinx using a theme provided by Read the Docs.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.

Convert easylanguage file to .LUA Supply&Demand indicator

Postby gudutrader » Wed Aug 16, pm

Hi Apprentice,

Please, is possible to convert this fle to a .LUA file.
Thank you
Best regards


// optimized to show only the most relevant demand and supply zones (premium zones) + the minimum and maximum previous days prices
// I've added a new feature to show the Liquidity areas, displaying the daily, weekly and monthly liquidity zones
// - Blue line: daily liquidity
// - Yellow line: weekly liquidity
// - Purple line: monthly liquidity
// The goal of adding the liquidity zones is to add more confluence and value to the demand and supply zones to identify which ones are more likely to be hit and hold the price.

indicator("Strong Demands & Supplies + Liquidity

nest...

аналитика форекс gbp кaртa мирa форекс вспомогательные индикаторы форекс как платят налоги трейдеры валютного рынка форекс лучшие индикаторы для входа индикаторы измерения температуры щитовые дмитрий котенко форекс клипaрт для форекс имхо на форексе дц форекс брокер отзывы безрисковая комбинация форекс индикаторы рынка ферросплавов