Código Indicador
Código Indicador
0 at
https://mozilla.org/MPL/2.0/
// Mxwll Capital
//@version=5
bullC = input.color(defval = #14D990, title = "Bull Color", group = "Smart Money Concepts",
inline = "7")
bearC = input.color(defval = #F24968, title = "Bear Color", group = "Smart Money Concepts",
inline = "7")
showInt = input.bool(defval = true, title = "Show Internals", group = "Smart Money Concepts")
intStru = input.string(defval = "All", title = "Internal Structure", options = ["All", "BoS", "CHoCH"],
inline = "30", group = "Smart Money Concepts")
showExt = input.bool(defval = true, title = "Show Externals" ,group = "Smart Money Concepts")
extSens = input.int(25, "Externals Sensitivity", options = [10, 25, 50],group = "Smart Money
Concepts", inline = "21")
showOB = input.bool(defval = true, title = "Show Order Blocks" ,group = "Swing Blocks")
showLast = input.int(defval = 10, title = "Swing Order Blocks", minval = 0, group = "Swing Blocks")
showAOE = input.bool(defval = true, title = "Show Area of Interest", group = "Swing Blocks")
show1D = input.bool(defval = true, title = "Show Previous Day High", group = "High/Low")
showFVG = input.bool(defval = true, title = "Show Fair Value Gaps", group = "FVG")
fvgtra = input.int(defval = 80, minval = 0, maxval = 100, title = "FVG Transparency", group =
"FVG")
showFibs = input.bool(defval = true, title = "Show Auto Fibs", group = "Auto Fibs")
// extSensFibs = input.int(25, "Fibs Sensitivity", options = [10, 25, 50], group = "Auto Fibs", inline =
"22")
show236 = input.bool(defval = true, title = "", inline = "1", group = "Auto Fibs")
show382 = input.bool(defval = true, title = "", inline = "2", group = "Auto Fibs")
show5 = input.bool(defval = true, title = "", inline = "3", group = "Auto Fibs")
show618 = input.bool(defval = true, title = "", inline = "4", group = "Auto Fibs")
show786 = input.bool(defval = true, title = "", group = "Auto Fibs", inline = "5")
fib1 = input.float(defval = .236, title = "", minval = 0, step = 0.01, inline = "1", group = "Auto
Fibs")
fib2 = input.float(defval = .382, title = "", minval = 0, step = 0.01, inline = "2", group = "Auto
Fibs")
fib3 = input.float(defval = .5, title = "", minval = 0, step = 0.01, inline = "3", group = "Auto
Fibs")
fib4 = input.float(defval = .618, title = "", minval = 0, step = 0.01, inline = "4", group = "Auto
Fibs")
fib5 = input.float(defval = .786, title = "", minval = 0, step = 0.01, group = "Auto Fibs", inline =
"5")
fib1col = input.color(title = "", defval = color.gray, inline = "1" , group = "Auto Fibs")
fib2col = input.color(title = "", defval = color.lime, inline = "2" , group = "Auto Fibs")
fib3col = input.color(title = "", defval = color.yellow, inline = "3", group = "Auto Fibs")
fib4col = input.color(title = "", defval = color.orange, inline = "4", group = "Auto Fibs")
fib5col = input.color(title = "", defval = color.red , group = "Auto Fibs", inline = "5")
bigData.put("moving", 0)
bigData.put("upaxis", 0.0)
bigData.put("upaxis2", 0)
bigData.put("dnaxis", 0.0)
bigData.put("dnaxis2", 0)
bigData.put("upside", 1)
bigData.put("downside", 1)
highArr.unshift(high), lowArr.unshift(low)
timeArr.unshift(time), volArr.unshift(volume)
closeArr.unshift(close), openArr.unshift(open)
type rollingTF
float highTF =0
int highTFt =0
int lowTFt =0
float volTF =0
method tfDraw(int tfDiff, bool showRollingLab, string tf, bool showLevels) =>
for i = 0 to tfDiff
getTime = timeArr.get(i)
if TFhrdata.highTF == getHigh
TFhrdata.highTFt := timeArr.get(i)
if TFhrdata.lowTF == getLow
TFhrdata.lowTFt := timeArr.get(i)
TFhrdata.volTF += volArr.get(i)
volRolling.push(TFhrdata.volTF)
if showLevels
switch lineDraw.rTFdraw.size() == 0
lineDraw.rTFdraw.get("High").set_xy2(time, TFhrdata.highTF),
lineDraw.rTFdraw.get("Low").set_xy1(TFhrdata.lowTFt, TFhrdata.lowTF),
lineDraw.rTFdraw.get("Low").set_xy2(time, TFhrdata.lowTF)
if showRollingLab
switch lineDraw.rTFlabel.size() == 0
textcolor = color.aqua,
text = tf + "H",
size = size.tiny,
style = label.style_label_left,
color = #00000000
)),
textcolor = color.aqua,
text = tf + "L",
size = size.tiny,
style = label.style_label_left,
color = #00000000
))
[TFhrdata.volTF, volRolling]
if h.size() > 0
for i = 0 to h.size() - 1
oArr.push(o.get(i))
hArr.push(h.get(i))
lArr.push(l.get(i))
cArr.push(c.get(i))
vArr.push(v.get(i))
tArr.push(t.get(i))
oArr.shift()
hArr.shift()
lArr.shift()
cArr.shift()
vArr.shift()
tArr.shift()
for i = 0 to hArr.size() - 1
if showLevels
getTime = tArr.get(i)
if TFhrdata.highTF == getHigh
TFhrdata.highTFt := tArr.get(i)
if TFhrdata.lowTF == getLow
TFhrdata.lowTFt := tArr.get(i)
TFhrdata.volTF += vArr.get(i)
volRolling.push(TFhrdata.volTF)
var lineDraw = rollingTF.new(rTFdraw = map.new<string, line>(), rTFlabel = map.new<string,
label>())
if showLevels
switch lineDraw.rTFdraw.size() == 0
lineDraw.rTFdraw.get("High").set_xy2(time, TFhrdata.highTF),
lineDraw.rTFdraw.get("Low").set_xy1(TFhrdata.lowTFt, TFhrdata.lowTF),
lineDraw.rTFdraw.get("Low").set_xy2(time, TFhrdata.lowTF)
if showRollingLab
switch lineDraw.rTFlabel.size() == 0
textcolor = color.aqua,
text = tf + "H",
size = size.tiny,
style = label.style_label_left,
color = #00000000
)),
textcolor = color.aqua,
text = tf + "L",
size = size.tiny,
style = label.style_label_left,
color = #00000000
))
[TFhrdata.volTF, volRolling]
calculatePivots(length)=>
up = highArr.slice(0, length).max()
cHi = highArr.get(length)
intraCalc := switch
=> intraCalc[1]
topSwing = switch
=> 0
botSwing = switch
intraCalc == 1 and intraCalc[1] != 1 => cLo
=> 0
[topSwing, botSwing]
=> label.style_label_up
drawStructureExt() =>
if bigUpper != 0
bigData.put("upside", 1)
x1 = bar_index - extSens
=> 'LH'
if showHHLH
textcolor = bearC,
style = label.style_label_down,
size = size.small
))
if showOB
))
bigData.put("upaxis" , bigUpper)
bigData.put("upaxis2", x1)
counter := 1
if bigLower != 0
bigData.put("downside", 1)
x1 = bar_index - extSens
=> "HL"
if showHLLL == true
textcolor = bullC,
style = label.style_label_up,
size = size.small
))
if showOB
))
bigData.put("dnaxis" , bigLower)
bigData.put("dnaxis2", x1)
counter := -1
if showExt
if ta.crossover(close, bigData.get("upaxis"))
if bigData.get("upside") != 0
bigData.put("upside", 0)
bigData.put("moving", 1)
if ta.crossunder(close, bigData.get("dnaxis"))
if bigData.get("downside") != 0
bigData.put("downside", 0)
bigData.put("moving", -1)
counter
counter = drawStructureExt()
if id.size() > 0
for i = 0 to id.size() - 1
id.get(i).set_right(last_bar_index + 5)
if id.size() > 0
for i = id.size() - 1 to 0
id.remove(i).delete()
id.remove(i).delete()
highBlock.cleanseLevel(true)
lowBlock .cleanseLevel(false)
if barstate.islast
highBlock.updateBox()
lowBlock .updateBox()
hi = 0.0
lo = 1e8
if showFibs
if bigUpperFibs != 0
counterFibs := 1
if bigLowerFibs != 0
counterFibs := -1
if counterFibs == 1
hi := 0.0
id.set_xy1(int(bigData.get("upaxis2")), bigData.get("upaxis"))
getLow = lowArr.get(i)
lo := math.min(getLow, lo)
if lo == getLow
id.set_xy2(bar_index - i, lo)
else if counterFibs == -1
lo := 1e8
id.set_xy1(int(bigData.get("dnaxis2")), bigData.get("dnaxis"))
getHigh = highArr.get(i)
hi := math.max(highArr.get(i), hi)
if hi == getHigh
id.set_xy2(bar_index - i, hi)
x2 = id.get_x2(), x1 = id.get_x1()
y2 = id.get_y2(), y1 = id.get_y1(),
id.set_xy2(x1, y1),
id.set_xy1(x2, y2)
=> id.set_color(#14D990)
style = line.style_dashed,
width = 2
main.updateMain()
quickLine(getX2, y, color) =>
drawFibs() =>
if barstate.islast
if fibLine.size() > 0
for i = 0 to fibLine.size() - 1
fibLine .get(i).delete()
fibLab .get(i).delete()
if showFibs
mod = i % fibLine.size() - 1
drawFibs()
drawStructureInternals() =>
if showInt
if keyValues.size() == 0
keyValues.put("movingSmall", 0)
if smallUpper != 0
keyValues.put("upsideSmall", 1)
keyValues.put("upaxisSmall", smallUpper)
if smallLower != 0
keyValues.put("downsideSmall", 1)
keyValues.put("dnaxisSmall", smallLower)
if ta.crossover(close, keyValues.get("upaxisSmall"))
if keyValues.get("upsideSmall") != 0
str = switch
keyValues.put("upsideSmall", 0)
keyValues.put("movingSmall", 1)
if ta.crossunder(close, keyValues.get("dnaxisSmall"))
if keyValues.get("downsideSmall") != 0
str = switch
keyValues.put("downsideSmall", 0)
keyValues.put("movingSmall", -1)
drawStructureInternals()
drawAOE() =>
atr = ta.atr(14)
if showAOE
if closeArr.size() > 50
if aoeLevels.size() == 0
aoeLevels.put("High",
border_color = #00000000,
text_size = size.small,
))
aoeLevels.put("Low",
border_color = #00000000,
text_size = size.small,
))
getHighBox = aoeLevels.get("High")
if close <= getHighBox.get_top() * 1.01
else
getHighBox.set_text ("")
getLowBox = aoeLevels.get("Low")
else
getLowBox.set_text ("")
drawAOE()
var table tab2 = table.new(position.top_right, 13, 13, bgcolor = #20222C, border_color = #363843,
frame_color = #363843, border_width = 1, frame_width = 1)
fvg(direction) =>
if fvgMat.columns() > 3
fvgMat.remove_col(fvgMat.columns() - 1)
if fvgMat.row(0).sum() == direction
getDir = math.sign(direction)
fvgDrawings.push(
box.new(int(fvgMat.get(4, 1)),y, last_bar_time, y1, xloc = xloc.bar_time,
fvgDrawings
if showFVG
fvgDn = fvg(-3)
fvgUp = fvg(3)
if fvgDn.size() > 0
for i = fvgDn.size() - 1 to 0
getfvg = fvgDn.get(i)
getfvg.delete()
fvgDn.remove(i)
else if contract
getfvg.set_bottom(high)
if fvgUp.size() > 0
for i = fvgUp.size() - 1 to 0
getfvg = fvgUp.get(i)
getfvg.delete()
fvgUp.remove(i)
else if contract
getfvg.set_top(low)
if fvgDn.size() > 0
for i = fvgDn.size() - 1 to 0
getBottom = fvgDn.get(i).get_bottom()
minDist.set(0, 0, i)
fvgDn.get(i).set_right(fvgDn.get(i).get_left())
fvgDn.get(int(minDist.get(0, 0))).set_bgcolor(color.new(fvgcol, fvgtra))
fvgDn.get(int(minDist.get(0, 0))).set_right(last_bar_time)
minDist.set(0, 0, 0)
minDist.set(0, 1, 20e20)
if fvgUp.size() > 0
for i = fvgUp.size() - 1 to 0
getTop = fvgUp.get(i).get_top()
minDist.set(0, 0, i)
fvgUp.get(i).set_right(fvgUp.get(i).get_left())
fvgUp.get(int(minDist.get(0, 0))).set_right(last_bar_time)
[hours, minutes]
(nyHour > startHour or (nyHour == startHour and nyMinute >= startMinute)) and (nyHour <
endHour or (nyHour == endHour and nyMinute <= endMinute))
=> [color.gray, int(na), "Dead Zone", (nyHour > 16 or nyHour < 3) ? "London" : (nyHour >= 11 and
nyHour < 20) ? "Asia" : "New York"]
timetilchange2 = switch
timeIsInRange(9, 30, 16, 0) => timestamp("America/New_York", year(timenow),
month(timenow), dayofmonth(timenow), 20, 0, 0)
=> na
if na(timetilchange2)
timetilchange2 := switch
nyHour < 20 or (nyHour >= 16 and nyHour < 20) => timestamp("America/New_York",
year(timenow), month(timenow), dayofmonth(timenow), 20, 0, 0)
=> na
if id.size() > 0
volPerc1 = id.percentile_nearest_rank(10)
volPerc2 = id.percentile_nearest_rank(33)
volPerc3 = id.percentile_nearest_rank(50)
volPerc4 = id.percentile_nearest_rank(66)
volPerc5 = id.percentile_nearest_rank(90)
log.warning(str.tostring(volPerc1) + "\n" + str.tostring(volPerc2) + "\n" + str.tostring(volPerc3) +
"\n" + str.tostring(volPerc4) + "\n" + str.tostring(volPerc5))
activity = switch
activity
if barstate.islast
hr4Act = vol4hrArr.getActivity(vol4hr)
str = str.tostring(timetilchange)
nu = str.tonumber(ch) * 6
nu2 = str.substring(str.tostring(nu), 0, 2)
(nyHour2 > startHour or (nyHour2 == startHour and nyMinute2 >= startMinute)) and
else