OPEN-SOURCE SCRIPT
MGG_FX

//version=5
indicator('MGG_FX', overlay=true, max_bars_back=1000, max_labels_count=500, max_lines_count=500, max_boxes_count=500)
var GRP1 = "ASIAN RANGE"
showLines = input(title='Show Lines', defval=true, group=GRP1)
showBackground = input(title='Show Background', defval=true, group=GRP1)
showMiddleLine = input(title='Show Middle Line', defval=true, group=GRP1)
extendLines = input(title='Extend Line', defval=true, group=GRP1)
rangeTime = input.session(title='Session Time', defval='1700-0100', group=GRP1)
extendTime = input.session(title='Extend Until', defval='0100-0500', group=GRP1)
linesWidth = input.int(1, 'Box And Lines Width', minval=1, maxval=4, group=GRP1)
boxLineColor = input(color.new(#434651,50), 'Box Line Color', group=GRP1)
middleLineColor = input(color.new(#434651,50), 'Middle Line Color', group=GRP1)
backgroundColor = input(color.new(#9598a1,90), 'Box Background Color', group=GRP1)
var GRP5 = "LONDON"
showLines4 = input(title='Show Lines', defval=true, group=GRP5)
showBackground4 = input(title='Show Background', defval=true, group=GRP5)
rangeTime4 = input.session(title='Session Time', defval='0300-0400', group=GRP5)
linesWidth4 = input.int(1, 'Box And Lines Width', minval=1, maxval=4, group=GRP5)
boxLineColor4 = input(color.new(#b2b5be, 95), 'Box Line Color', group=GRP5)
backgroundColor4 = input(color.new(#b2b5be, 90), 'Box Background Color', group=GRP5)
var GRP6 = "NEWYORK"
showLines5 = input(title='Show Lines', defval=true, group=GRP6)
showBackground5 = input(title='Show Background', defval=true, group=GRP6)
rangeTime5 = input.session(title='Session Time', defval='0900-1000', group=GRP6)
linesWidth5 = input.int(1, 'Box And Lines Width', minval=1, maxval=4, group=GRP6)
boxLineColor5 = input(color.new(#b2b5be, 95), 'Box Line Color', group=GRP6)
backgroundColor5 = input(color.new(#b2b5be, 90), 'Box Background Color', group=GRP6)
////////////////////////////////////////////
inSession = not na(time(timeframe.period, rangeTime))
inExtend = not na(time(timeframe.period, extendTime))
startTime = 0
startTime := inSession and not inSession[1] ? time : startTime[1]
//Box lines
var line lowHLine = na
var line topHLine = na
var line leftVLine = na
var line rightVLine = na
var line middleHLine = na
var box bgBox = na
var low_val = 0.0
var high_val = 0.0
if inSession and not inSession[1]
low_val := low
high_val := high
high_val
// Plot lines
if inSession and timeframe.isintraday
if inSession[1]
line.delete(lowHLine)
line.delete(topHLine)
line.delete(leftVLine)
line.delete(rightVLine)
line.delete(middleHLine)
box.delete(bgBox)
if low < low_val
low_val := low
low_val
if high > high_val
high_val := high
high_val
//Create Box
//x1, y1, x2, y2
if showBackground
bgBox := box.new(startTime, high_val, time, low_val, xloc=xloc.bar_time, bgcolor=backgroundColor, border_width=0)
if showLines
lowHLine := line.new(startTime, low_val, time, low_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
topHLine := line.new(startTime, high_val, time, high_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
leftVLine := line.new(startTime, high_val, startTime, low_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
rightVLine := line.new(time, high_val, time, low_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
//Create Middle line
if showMiddleLine
middleHLine := line.new(startTime, (high_val + low_val) / 2, time, (high_val + low_val) / 2, xloc=xloc.bar_time, color=middleLineColor, style=line.style_solid, width=linesWidth)
else
if inExtend and extendLines and not inSession and timeframe.isintraday
time1 = line.get_x1(lowHLine)
time2 = line.get_x2(lowHLine)
price = line.get_y1(lowHLine)
line.delete(lowHLine)
lowHLine := line.new(time1, price, time, price, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
time1 := line.get_x1(topHLine)
time2 := line.get_x2(topHLine)
price := line.get_y1(topHLine)
line.delete(topHLine)
topHLine := line.new(time1, price, time, price, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
time1 := line.get_x1(middleHLine)
time2 := line.get_x2(middleHLine)
price := line.get_y1(middleHLine)
line.delete(middleHLine)
middleHLine := line.new(time1, price, time, price, xloc=xloc.bar_time, color=middleLineColor, style=line.style_solid, width=linesWidth)
middleHLine
////////////////////////////////////////////
inSession4 = not na(time(timeframe.period, rangeTime4))
startTime4 = 0
startTime4 := inSession4 and not inSession4[1] ? time : startTime4[1]
//Box lines
var line lowHLine4 = na
var line topHLine4 = na
var line leftVLine4 = na
var line rightVLine4 = na
var line middleHLine4 = na
var box bgBox4 = na
var low_val4 = 0.0
var high_val4 = 0.0
if inSession4 and not inSession4[1]
low_val4 := low
high_val4 := high
high_val4
// Plot lines
if inSession4 and timeframe.isintraday
if inSession4[1]
line.delete(lowHLine4)
line.delete(topHLine4)
line.delete(leftVLine4)
line.delete(rightVLine4)
line.delete(middleHLine4)
box.delete(bgBox4)
if low < low_val4
low_val4 := low
low_val4
if high > high_val4
high_val4 := high
high_val4
//Create Box
//x1, y1, x2, y2
if showBackground4
bgBox4 := box.new(startTime4, high_val4, time, low_val4, xloc=xloc.bar_time, bgcolor=backgroundColor4, border_width=0)
if showLines4
lowHLine4 := line.new(startTime4, low_val4, time, low_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
topHLine4 := line.new(startTime4, high_val4, time, high_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
leftVLine4 := line.new(startTime4, high_val4, startTime4, low_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
rightVLine4 := line.new(time, high_val4, time, low_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
////////////////////////////////////////////
inSession5 = not na(time(timeframe.period, rangeTime5))
startTime5 = 0
startTime5 := inSession5 and not inSession5[1] ? time : startTime5[1]
//Box lines
var line lowHLine5 = na
var line topHLine5 = na
var line leftVLine5 = na
var line rightVLine5 = na
var line middleHLine5 = na
var box bgBox5 = na
var low_val5 = 0.0
var high_val5 = 0.0
if inSession5 and not inSession5[1]
low_val5 := low
high_val5 := high
high_val5
// Plot lines
if inSession5 and timeframe.isintraday
if inSession5[1]
line.delete(lowHLine5)
line.delete(topHLine5)
line.delete(leftVLine5)
line.delete(rightVLine5)
line.delete(middleHLine5)
box.delete(bgBox5)
if low < low_val5
low_val5 := low
low_val5
if high > high_val5
high_val5 := high
high_val5
//Create Box
//x1, y1, x2, y2
if showBackground5
bgBox5 := box.new(startTime5, high_val5, time, low_val5, xloc=xloc.bar_time, bgcolor=backgroundColor5, border_width=0)
if showLines5
lowHLine5 := line.new(startTime5, low_val5, time, low_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
topHLine5 := line.new(startTime5, high_val5, time, high_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
leftVLine5 := line.new(startTime5, high_val5, startTime5, low_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
rightVLine5 := line.new(time, high_val5, time, low_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
///////////////////////////////////////////////
//INPUTS
ffRange = input.session(title='Time: ', defval='0200-0201', inline='a', group='FF')
ffcolor = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="FF")
ffStyle = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="FF")
mmm1Range = input.session(title='Time: ', defval='0430-0431', inline='a', group='MMM1')
mmm1color = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="MMM1")
mmm1Style = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="MMM1")
mmm2Range = input.session(title='Time: ', defval='0630-0631', inline='a', group='MMM2')
mmm2color = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="MMM2")
mmm2Style = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="MMM2")
mmm3Range = input.session(title='Time: ', defval='0800-0801', inline='a', group='MMM3')
mmm3color = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="mmm3")
mmm3Style = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="MMM3")
lcRange = input.session(title='Time: ', defval='1100-1101', inline='a', group='LC')
lccolor = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="LC")
lcStyle = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="LC")
//Plot lines
in_session_ff = time(timeframe.period, ffRange)
sessionffActive = in_session_ff and timeframe.multiplier <= 240
var line ff = na
if sessionffActive and sessionffActive[1] == false
ff := line.new(bar_index,high+0.001,bar_index,low-0.001,color=ffcolor, style=ffStyle)
in_session_mmm1 = time(timeframe.period, mmm1Range)
sessionmmm1Active = in_session_mmm1 and timeframe.multiplier <= 240
var line mmm1 = na
if sessionmmm1Active and sessionmmm1Active[1] == false
mmm1 := line.new(bar_index,high+0.001,bar_index,low-0.001,color=mmm1color, style=mmm1Style)
in_session_mmm2 = time(timeframe.period, mmm2Range)
sessionmmm2Active = in_session_mmm2 and timeframe.multiplier <= 240
var line mmm2 = na
if sessionmmm2Active and sessionmmm2Active[1] == false
mmm2 := line.new(bar_index,high+0.001,bar_index,low-0.001,color=mmm2color, style=mmm2Style)
in_session_mmm3 = time(timeframe.period, mmm3Range)
sessionmmm3Active = in_session_mmm3 and timeframe.multiplier <= 240
var line mmm3 = na
if sessionmmm3Active and sessionmmm3Active[1] == false
mmm3 := line.new(bar_index,high+0.001,bar_index,low-0.001,color=mmm3color, style=mmm3Style)
in_session_lc = time(timeframe.period, lcRange)
sessionlcActive = in_session_lc and timeframe.multiplier <= 240
var line lc = na
if sessionlcActive and sessionlcActive[1] == false
lc := line.new(bar_index,high+0.001,bar_index,low-0.001,color=lccolor, style=lcStyle)
//////////////////////////////////////////////////////////////////////
// Inputs
var GRP10 = "Daily Open"
daily = input.string(title='View', defval='Daily Open', group=GRP10)
_offset = input.int(0, title='Offset', minval=0, maxval=2)
o_color = input.color(color.new(#000000, 0), "Open Color", inline="1", group = GRP10)
// FUNCTIONS
t = time
isNewbar = not na(t) and (na(t[1]) or t > t[1])
tfInMinutes(simple string tf = "") =>
float chartTf =
timeframe.multiplier * (
timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
float result = tf == "" ? chartTf : request.security(syminfo.tickerid, tf, chartTf)
inTimeframe(_t) => tfInMinutes(_t) > tfInMinutes(timeframe.period)
// Range
reso(exp, res) => request.security(syminfo.tickerid, res, exp, lookahead=barmerge.lookahead_on)
getData(_t, _var) =>
o = reso(open[_offset], _t)
show = _var != "Off" and inTimeframe(_t)
_time = time(_t)
newbar = na(_time[1]) or _time > _time[1]
oc = _var == 'Daily Open'
[o, newbar, oc]
// ---------- Daily ----------
[d_o, d_newbar, d_oc] = getData("D", daily)
if d_newbar
if d_oc
line.new(x1=time, y1=d_o, x2=time_close("D"), y2=d_o, xloc=xloc.bar_time, style=line.style_dotted, color=o_color)
//-------------------- WATERMARK--------------------
////////////////////////////////////////////////////
//text inputs
title = input.string("JDVID_FX", "Tittle", group = "NICK NAME")
subtitle = input.string("𝗖𝗬𝗖𝗟𝗘 | 𝗧𝗜𝗠𝗜𝗡𝗚 | 𝗣𝗥𝗘𝗖𝗜𝗦𝗜𝗢𝗡", "Subtitle", group = "text")
//symbol info
symInfoCheck = input.bool(title="Show Symbol Info", defval=true, group = "watermark position")
symInfo = syminfo.ticker + " | " + timeframe.period + (timeframe.isminutes ? "M" : na)
date = str.format("{0}/{1}/{2}", dayofmonth(time_close), month(time_close), year(time_close))
//text positioning
textVPosition = input.string("top", "Vertical Position", options = ["top", "middle", "bottom"], group = "watermark position")
textHPosition = input.string("center", "Horizontal Position", options = ["left", "center", "right"], group = "watermark position")
//symbol info positioning
symVPosition = input.string("bottom", "Vertical Position", options = ["top", "middle", "bottom"], group = "symbol position")
symHPosition = input.string("center", "Horizontal Position", options = ["left", "center", "right"], group = "symbol position")
//cell size
cellWidthPercent = input.float(0, "Cell Width (%)", minval = 0, maxval = 100, tooltip = "The width of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the width based on the text inside the cell. Value 0 has the same effect.", group = "cell size")
cellHeightPercent = input.float(0, "Cell Height (%)", minval = 0, maxval = 100, tooltip = "The height of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the height based on the text inside of the cell. Value 0 has the same effect.", group = "cell size")
//title settings
c_title = input(color.new(color.black, 0), "Title Color", group = "title settings")
s_title = input.string("large", "Title Size", options = ["tiny", "small", "normal", "large", "huge", "auto"], group = "title settings")
a_title = input.string("center","Title Alignment", options = ["center","left", "right"], group = "title settings")
//subtitle settings
c_subtitle = input(color.new(color.black, 30), "Subtitle Color", group = "subtitle settings")
s_subtitle = input.string("small", "Subtitle Size", options = ["tiny", "small", "normal", "large", "huge", "auto"], group = "subtitle settings")
a_subtitle = input.string("center","Subtitle Alignment", options = ["center","left", "right"], group = "subtitle settings")
//symbol settings
c_symInfo = input(color.new(color.black, 30), "Subtitle Color", group = "symbol settings")
s_symInfo = input.string("normal", "Subtitle Size", options = ["tiny", "small", "normal", "large", "huge", "auto"], group = "symbol settings")
a_symInfo = input.string("center","Subtitle Alignment", options = ["center","left", "right"], group = "symbol settings")
c_bg = input(color.new(color.blue, 100), "Background", group = "background")
//text watermark creation
var table textWatermark = table.new(textVPosition + "_" + textHPosition, 1, 3)
table.cell(textWatermark, 0, 0, title, width = cellWidthPercent, height = cellHeightPercent, text_color = c_title, text_halign = a_title, text_size = s_title, bgcolor = c_bg)
table.cell(textWatermark, 0, 1, subtitle, width = cellWidthPercent, height = cellHeightPercent, text_color = c_subtitle, text_halign = a_subtitle, text_size= s_subtitle, bgcolor = c_bg)
//symbol info watermark creation
var table symWatermark = table.new(symVPosition + "_" + symHPosition, 5, 5)
if symInfoCheck
table.cell(symWatermark, 0, 1, symInfo, width = cellWidthPercent, height = cellHeightPercent, text_color = c_symInfo, text_halign = a_symInfo, text_size = s_symInfo, bgcolor = c_bg)
table.cell(symWatermark, 0, 0, date, width = cellWidthPercent, height = cellHeightPercent, text_color = c_symInfo, text_halign = a_symInfo, text_size = s_symInfo, bgcolor = c_bg)
indicator('MGG_FX', overlay=true, max_bars_back=1000, max_labels_count=500, max_lines_count=500, max_boxes_count=500)
var GRP1 = "ASIAN RANGE"
showLines = input(title='Show Lines', defval=true, group=GRP1)
showBackground = input(title='Show Background', defval=true, group=GRP1)
showMiddleLine = input(title='Show Middle Line', defval=true, group=GRP1)
extendLines = input(title='Extend Line', defval=true, group=GRP1)
rangeTime = input.session(title='Session Time', defval='1700-0100', group=GRP1)
extendTime = input.session(title='Extend Until', defval='0100-0500', group=GRP1)
linesWidth = input.int(1, 'Box And Lines Width', minval=1, maxval=4, group=GRP1)
boxLineColor = input(color.new(#434651,50), 'Box Line Color', group=GRP1)
middleLineColor = input(color.new(#434651,50), 'Middle Line Color', group=GRP1)
backgroundColor = input(color.new(#9598a1,90), 'Box Background Color', group=GRP1)
var GRP5 = "LONDON"
showLines4 = input(title='Show Lines', defval=true, group=GRP5)
showBackground4 = input(title='Show Background', defval=true, group=GRP5)
rangeTime4 = input.session(title='Session Time', defval='0300-0400', group=GRP5)
linesWidth4 = input.int(1, 'Box And Lines Width', minval=1, maxval=4, group=GRP5)
boxLineColor4 = input(color.new(#b2b5be, 95), 'Box Line Color', group=GRP5)
backgroundColor4 = input(color.new(#b2b5be, 90), 'Box Background Color', group=GRP5)
var GRP6 = "NEWYORK"
showLines5 = input(title='Show Lines', defval=true, group=GRP6)
showBackground5 = input(title='Show Background', defval=true, group=GRP6)
rangeTime5 = input.session(title='Session Time', defval='0900-1000', group=GRP6)
linesWidth5 = input.int(1, 'Box And Lines Width', minval=1, maxval=4, group=GRP6)
boxLineColor5 = input(color.new(#b2b5be, 95), 'Box Line Color', group=GRP6)
backgroundColor5 = input(color.new(#b2b5be, 90), 'Box Background Color', group=GRP6)
////////////////////////////////////////////
inSession = not na(time(timeframe.period, rangeTime))
inExtend = not na(time(timeframe.period, extendTime))
startTime = 0
startTime := inSession and not inSession[1] ? time : startTime[1]
//Box lines
var line lowHLine = na
var line topHLine = na
var line leftVLine = na
var line rightVLine = na
var line middleHLine = na
var box bgBox = na
var low_val = 0.0
var high_val = 0.0
if inSession and not inSession[1]
low_val := low
high_val := high
high_val
// Plot lines
if inSession and timeframe.isintraday
if inSession[1]
line.delete(lowHLine)
line.delete(topHLine)
line.delete(leftVLine)
line.delete(rightVLine)
line.delete(middleHLine)
box.delete(bgBox)
if low < low_val
low_val := low
low_val
if high > high_val
high_val := high
high_val
//Create Box
//x1, y1, x2, y2
if showBackground
bgBox := box.new(startTime, high_val, time, low_val, xloc=xloc.bar_time, bgcolor=backgroundColor, border_width=0)
if showLines
lowHLine := line.new(startTime, low_val, time, low_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
topHLine := line.new(startTime, high_val, time, high_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
leftVLine := line.new(startTime, high_val, startTime, low_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
rightVLine := line.new(time, high_val, time, low_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
//Create Middle line
if showMiddleLine
middleHLine := line.new(startTime, (high_val + low_val) / 2, time, (high_val + low_val) / 2, xloc=xloc.bar_time, color=middleLineColor, style=line.style_solid, width=linesWidth)
else
if inExtend and extendLines and not inSession and timeframe.isintraday
time1 = line.get_x1(lowHLine)
time2 = line.get_x2(lowHLine)
price = line.get_y1(lowHLine)
line.delete(lowHLine)
lowHLine := line.new(time1, price, time, price, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
time1 := line.get_x1(topHLine)
time2 := line.get_x2(topHLine)
price := line.get_y1(topHLine)
line.delete(topHLine)
topHLine := line.new(time1, price, time, price, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
time1 := line.get_x1(middleHLine)
time2 := line.get_x2(middleHLine)
price := line.get_y1(middleHLine)
line.delete(middleHLine)
middleHLine := line.new(time1, price, time, price, xloc=xloc.bar_time, color=middleLineColor, style=line.style_solid, width=linesWidth)
middleHLine
////////////////////////////////////////////
inSession4 = not na(time(timeframe.period, rangeTime4))
startTime4 = 0
startTime4 := inSession4 and not inSession4[1] ? time : startTime4[1]
//Box lines
var line lowHLine4 = na
var line topHLine4 = na
var line leftVLine4 = na
var line rightVLine4 = na
var line middleHLine4 = na
var box bgBox4 = na
var low_val4 = 0.0
var high_val4 = 0.0
if inSession4 and not inSession4[1]
low_val4 := low
high_val4 := high
high_val4
// Plot lines
if inSession4 and timeframe.isintraday
if inSession4[1]
line.delete(lowHLine4)
line.delete(topHLine4)
line.delete(leftVLine4)
line.delete(rightVLine4)
line.delete(middleHLine4)
box.delete(bgBox4)
if low < low_val4
low_val4 := low
low_val4
if high > high_val4
high_val4 := high
high_val4
//Create Box
//x1, y1, x2, y2
if showBackground4
bgBox4 := box.new(startTime4, high_val4, time, low_val4, xloc=xloc.bar_time, bgcolor=backgroundColor4, border_width=0)
if showLines4
lowHLine4 := line.new(startTime4, low_val4, time, low_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
topHLine4 := line.new(startTime4, high_val4, time, high_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
leftVLine4 := line.new(startTime4, high_val4, startTime4, low_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
rightVLine4 := line.new(time, high_val4, time, low_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
////////////////////////////////////////////
inSession5 = not na(time(timeframe.period, rangeTime5))
startTime5 = 0
startTime5 := inSession5 and not inSession5[1] ? time : startTime5[1]
//Box lines
var line lowHLine5 = na
var line topHLine5 = na
var line leftVLine5 = na
var line rightVLine5 = na
var line middleHLine5 = na
var box bgBox5 = na
var low_val5 = 0.0
var high_val5 = 0.0
if inSession5 and not inSession5[1]
low_val5 := low
high_val5 := high
high_val5
// Plot lines
if inSession5 and timeframe.isintraday
if inSession5[1]
line.delete(lowHLine5)
line.delete(topHLine5)
line.delete(leftVLine5)
line.delete(rightVLine5)
line.delete(middleHLine5)
box.delete(bgBox5)
if low < low_val5
low_val5 := low
low_val5
if high > high_val5
high_val5 := high
high_val5
//Create Box
//x1, y1, x2, y2
if showBackground5
bgBox5 := box.new(startTime5, high_val5, time, low_val5, xloc=xloc.bar_time, bgcolor=backgroundColor5, border_width=0)
if showLines5
lowHLine5 := line.new(startTime5, low_val5, time, low_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
topHLine5 := line.new(startTime5, high_val5, time, high_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
leftVLine5 := line.new(startTime5, high_val5, startTime5, low_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
rightVLine5 := line.new(time, high_val5, time, low_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
///////////////////////////////////////////////
//INPUTS
ffRange = input.session(title='Time: ', defval='0200-0201', inline='a', group='FF')
ffcolor = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="FF")
ffStyle = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="FF")
mmm1Range = input.session(title='Time: ', defval='0430-0431', inline='a', group='MMM1')
mmm1color = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="MMM1")
mmm1Style = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="MMM1")
mmm2Range = input.session(title='Time: ', defval='0630-0631', inline='a', group='MMM2')
mmm2color = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="MMM2")
mmm2Style = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="MMM2")
mmm3Range = input.session(title='Time: ', defval='0800-0801', inline='a', group='MMM3')
mmm3color = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="mmm3")
mmm3Style = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="MMM3")
lcRange = input.session(title='Time: ', defval='1100-1101', inline='a', group='LC')
lccolor = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="LC")
lcStyle = input.string(title="-", defval=line.style_solid, options=[line.style_dotted, line.style_dashed, line.style_solid],inline="s_1",group="LC")
//Plot lines
in_session_ff = time(timeframe.period, ffRange)
sessionffActive = in_session_ff and timeframe.multiplier <= 240
var line ff = na
if sessionffActive and sessionffActive[1] == false
ff := line.new(bar_index,high+0.001,bar_index,low-0.001,color=ffcolor, style=ffStyle)
in_session_mmm1 = time(timeframe.period, mmm1Range)
sessionmmm1Active = in_session_mmm1 and timeframe.multiplier <= 240
var line mmm1 = na
if sessionmmm1Active and sessionmmm1Active[1] == false
mmm1 := line.new(bar_index,high+0.001,bar_index,low-0.001,color=mmm1color, style=mmm1Style)
in_session_mmm2 = time(timeframe.period, mmm2Range)
sessionmmm2Active = in_session_mmm2 and timeframe.multiplier <= 240
var line mmm2 = na
if sessionmmm2Active and sessionmmm2Active[1] == false
mmm2 := line.new(bar_index,high+0.001,bar_index,low-0.001,color=mmm2color, style=mmm2Style)
in_session_mmm3 = time(timeframe.period, mmm3Range)
sessionmmm3Active = in_session_mmm3 and timeframe.multiplier <= 240
var line mmm3 = na
if sessionmmm3Active and sessionmmm3Active[1] == false
mmm3 := line.new(bar_index,high+0.001,bar_index,low-0.001,color=mmm3color, style=mmm3Style)
in_session_lc = time(timeframe.period, lcRange)
sessionlcActive = in_session_lc and timeframe.multiplier <= 240
var line lc = na
if sessionlcActive and sessionlcActive[1] == false
lc := line.new(bar_index,high+0.001,bar_index,low-0.001,color=lccolor, style=lcStyle)
//////////////////////////////////////////////////////////////////////
// Inputs
var GRP10 = "Daily Open"
daily = input.string(title='View', defval='Daily Open', group=GRP10)
_offset = input.int(0, title='Offset', minval=0, maxval=2)
o_color = input.color(color.new(#000000, 0), "Open Color", inline="1", group = GRP10)
// FUNCTIONS
t = time
isNewbar = not na(t) and (na(t[1]) or t > t[1])
tfInMinutes(simple string tf = "") =>
float chartTf =
timeframe.multiplier * (
timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
float result = tf == "" ? chartTf : request.security(syminfo.tickerid, tf, chartTf)
inTimeframe(_t) => tfInMinutes(_t) > tfInMinutes(timeframe.period)
// Range
reso(exp, res) => request.security(syminfo.tickerid, res, exp, lookahead=barmerge.lookahead_on)
getData(_t, _var) =>
o = reso(open[_offset], _t)
show = _var != "Off" and inTimeframe(_t)
_time = time(_t)
newbar = na(_time[1]) or _time > _time[1]
oc = _var == 'Daily Open'
[o, newbar, oc]
// ---------- Daily ----------
[d_o, d_newbar, d_oc] = getData("D", daily)
if d_newbar
if d_oc
line.new(x1=time, y1=d_o, x2=time_close("D"), y2=d_o, xloc=xloc.bar_time, style=line.style_dotted, color=o_color)
//-------------------- WATERMARK--------------------
////////////////////////////////////////////////////
//text inputs
title = input.string("JDVID_FX", "Tittle", group = "NICK NAME")
subtitle = input.string("𝗖𝗬𝗖𝗟𝗘 | 𝗧𝗜𝗠𝗜𝗡𝗚 | 𝗣𝗥𝗘𝗖𝗜𝗦𝗜𝗢𝗡", "Subtitle", group = "text")
//symbol info
symInfoCheck = input.bool(title="Show Symbol Info", defval=true, group = "watermark position")
symInfo = syminfo.ticker + " | " + timeframe.period + (timeframe.isminutes ? "M" : na)
date = str.format("{0}/{1}/{2}", dayofmonth(time_close), month(time_close), year(time_close))
//text positioning
textVPosition = input.string("top", "Vertical Position", options = ["top", "middle", "bottom"], group = "watermark position")
textHPosition = input.string("center", "Horizontal Position", options = ["left", "center", "right"], group = "watermark position")
//symbol info positioning
symVPosition = input.string("bottom", "Vertical Position", options = ["top", "middle", "bottom"], group = "symbol position")
symHPosition = input.string("center", "Horizontal Position", options = ["left", "center", "right"], group = "symbol position")
//cell size
cellWidthPercent = input.float(0, "Cell Width (%)", minval = 0, maxval = 100, tooltip = "The width of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the width based on the text inside the cell. Value 0 has the same effect.", group = "cell size")
cellHeightPercent = input.float(0, "Cell Height (%)", minval = 0, maxval = 100, tooltip = "The height of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the height based on the text inside of the cell. Value 0 has the same effect.", group = "cell size")
//title settings
c_title = input(color.new(color.black, 0), "Title Color", group = "title settings")
s_title = input.string("large", "Title Size", options = ["tiny", "small", "normal", "large", "huge", "auto"], group = "title settings")
a_title = input.string("center","Title Alignment", options = ["center","left", "right"], group = "title settings")
//subtitle settings
c_subtitle = input(color.new(color.black, 30), "Subtitle Color", group = "subtitle settings")
s_subtitle = input.string("small", "Subtitle Size", options = ["tiny", "small", "normal", "large", "huge", "auto"], group = "subtitle settings")
a_subtitle = input.string("center","Subtitle Alignment", options = ["center","left", "right"], group = "subtitle settings")
//symbol settings
c_symInfo = input(color.new(color.black, 30), "Subtitle Color", group = "symbol settings")
s_symInfo = input.string("normal", "Subtitle Size", options = ["tiny", "small", "normal", "large", "huge", "auto"], group = "symbol settings")
a_symInfo = input.string("center","Subtitle Alignment", options = ["center","left", "right"], group = "symbol settings")
c_bg = input(color.new(color.blue, 100), "Background", group = "background")
//text watermark creation
var table textWatermark = table.new(textVPosition + "_" + textHPosition, 1, 3)
table.cell(textWatermark, 0, 0, title, width = cellWidthPercent, height = cellHeightPercent, text_color = c_title, text_halign = a_title, text_size = s_title, bgcolor = c_bg)
table.cell(textWatermark, 0, 1, subtitle, width = cellWidthPercent, height = cellHeightPercent, text_color = c_subtitle, text_halign = a_subtitle, text_size= s_subtitle, bgcolor = c_bg)
//symbol info watermark creation
var table symWatermark = table.new(symVPosition + "_" + symHPosition, 5, 5)
if symInfoCheck
table.cell(symWatermark, 0, 1, symInfo, width = cellWidthPercent, height = cellHeightPercent, text_color = c_symInfo, text_halign = a_symInfo, text_size = s_symInfo, bgcolor = c_bg)
table.cell(symWatermark, 0, 0, date, width = cellWidthPercent, height = cellHeightPercent, text_color = c_symInfo, text_halign = a_symInfo, text_size = s_symInfo, bgcolor = c_bg)
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.