选取IB数据的时间段进行数据分析
Selected time periods of IB data for data analysis
下午好,
以下脚本捕获市场开盘时间(伦敦、纽约和亚洲)的初始余额(前 60 分钟内的第一个最高价和最低价)。
IB 的构建发生在前 60 分钟内,然后显示,因此例如伦敦 0800 到 0900 IB 构建并显示 0900 之后。
脚本然后查看三个 IB 高点并计算出最高点并将其绘制出来(在下面的脚本中显示为白线)。
我正在努力解决的问题是如何排除新 IB 的构建阶段发挥作用。下面的图片应该有助于解释这一点:
我如何排除蓝色地块的 IB 建设阶段,在那 1 小时内,紫色和黄色将仅包含在计算中,白线将继续在最高高度,不包括 IB 建设。
如果需要我可以进一步解释。如有任何帮助,我们将不胜感激。
到目前为止请看脚本:
//@version=4
study("Highest Test Script", overlay=true)
offset_val = input(title="Daily Label Offset", type=input.integer, defval=10)
offset_valW = input(title="Weekly Label Offset", type=input.integer, defval=30)
// Asia Start
time_int_01 = input("0000-0100:1234567", "Asia", input.session)
in_time_int_01 = time(timeframe.period, time_int_01)
var highe_01 = 0.0
var lowe_01 = 10e10
if in_time_int_01
if not in_time_int_01[1]
highe_01 := high
lowe_01 := low
else
highe_01 := max(high, highe_01)
lowe_01 := min(low, lowe_01)
plot(not in_time_int_01 ? highe_01 : na, title="Asia High", color=color.purple, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_01 ? highe_01 : na, style=shape.labelup, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC High", offset = offset_val, transp=20, title="Asia/UTC High")
plot(not in_time_int_01 ? lowe_01 : na, title="Asia Low", color=color.purple, linewidth=2, style=plot.style_linebr)
plotshape(not in_time_int_01 ? lowe_01 : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC Low", offset = offset_val, transp=20, title="Asia/UTC Low")
// Asia Finish
// London Start
time_int_02 = input("0800-0900:1234567", "London", input.session)
time_int_002 = input("0900-0800:1234567", "London", input.session)
in_time_int_02 = time(timeframe.period, time_int_02)
var highe_02 = 0.0
var lowe_02 = 10e10
if in_time_int_02
if not in_time_int_02[1]
highe_02 := high
lowe_02 := low
else
highe_02 := max(high, highe_02)
lowe_02 := min(low, lowe_02)
plot(not in_time_int_02 ? highe_02 : na, title="London High", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 ? highe_02 : na, style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London High", offset = offset_val, transp=20, title="London High")
plot(not in_time_int_02 ? lowe_02 : na, title="London Low", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 ? lowe_02 : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London Low", offset = offset_val, transp=20, title="London Low")
// London Finsh
// New York Start
time_int_03 = input("1430-1530:1234567", "New York", input.session)
in_time_int_03 = time(timeframe.period, time_int_03)
var highe_03 = 0.0
var lowe_03 = 10e10
if in_time_int_03
if not in_time_int_03[1]
highe_03 := high
lowe_03 := low
else
highe_03 := max(high, highe_03)
lowe_03 := min(low, lowe_03)
plot(not in_time_int_03 ? highe_03 : na, title="New York High", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 ? highe_03 : na, style=shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York High", offset = offset_val, transp=20, title="New York High")
plot(not in_time_int_03 ? lowe_03 : na, title="New York Low", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 ? lowe_03 : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York Low", offset = offset_val, transp=20, title="New York Low")
// New York Finish
//Londontest = (not time_int_002 ? highe_02 : na)
//DailyIBHighest = max(highe_01, Londontest, highe_03)
DailyIBHighest = max(highe_01, highe_02, highe_03)
plot(DailyIBHighest, color=color.white, linewidth=1, style=plot.style_linebr)
#####更新 18/02/2021 @ 1600 #####
在进一步思考这个问题之后,我正在努力实现的是计算出最大 IB 高,具体如下:
0000 - 0100
黄色 - highe_02
蓝色 - highe_03
0100 - 0800
黄色 - highe_02
蓝色 - highe_03
紫色 - highe_01
0800 - 0900
蓝色 - highe_03
紫色 - highe_01
0900 - 1430
黄色 - highe_02
蓝色 - highe_03
紫色 - highe_01
1430 - 1530
黄色 - highe_02
紫色 - highe_01
1530 - 0000
黄色 - highe_02
蓝色 - highe_03
紫色 - highe_01
##### 更新 19/02/2021 @ 0845 ####
我已经将原始 IBs high/low 设置为 false 可以打开以确认红线正确对齐。这是我希望它显示的方式,但我觉得我没有采取正确的方式,因为我想将输出红线合并为一个输出,以便我可以将其用于警报。
//@version=4
study("Highest Test Script", overlay=true)
offset_val = input(title="Daily Label Offset", type=input.integer, defval=10)
offset_valW = input(title="Weekly Label Offset", type=input.integer, defval=30)
ShowIB = input(false, title="show IBs")
// Asia Start
time_int_01 = input("0000-0100:1234567", "Asia", input.session)
time_int_001 = input("0100-0000:1234567", "London", input.session)
in_time_int_01 = time(timeframe.period, time_int_01)
in_time_int_001 = time(timeframe.period, time_int_001)
var highe_01 = 0.0
var lowe_01 = 10e10
if in_time_int_01
if not in_time_int_01[1]
highe_01 := high
lowe_01 := low
else
highe_01 := max(high, highe_01)
lowe_01 := min(low, lowe_01)
plot(not in_time_int_01 and ShowIB ? highe_01 : na, title="Asia High", color=color.purple, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_01 and ShowIB ? highe_01 : na, style=shape.labelup, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC High", offset = offset_val, transp=20, title="Asia/UTC High")
plot(not in_time_int_01 and ShowIB ? lowe_01 : na, title="Asia Low", color=color.purple, linewidth=2, style=plot.style_linebr)
plotshape(not in_time_int_01 and ShowIB ? lowe_01 : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC Low", offset = offset_val, transp=20, title="Asia/UTC Low")
// Asia Finish
// London Start
time_int_02 = input("0800-0900:1234567", "London", input.session)
time_int_002 = input("0900-0800:1234567", "London", input.session)
in_time_int_02 = time(timeframe.period, time_int_02)
in_time_int_002 = time(timeframe.period, time_int_002)
var highe_02 = 0.0
var lowe_02 = 10e10
if in_time_int_02
if not in_time_int_02[1]
highe_02 := high
lowe_02 := low
else
highe_02 := max(high, highe_02)
lowe_02 := min(low, lowe_02)
plot(not in_time_int_02 and ShowIB ? highe_02 : na, title="London High", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 and ShowIB ? highe_02 : na, style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London High", offset = offset_val, transp=20, title="London High")
plot(not in_time_int_02 and ShowIB ? lowe_02 : na, title="London Low", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 and ShowIB ? lowe_02 : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London Low", offset = offset_val, transp=20, title="London Low")
// London Finsh
// New York Start
time_int_03 = input("1430-1530:1234567", "New York", input.session)
time_int_003 = input("1530-1430:1234567", "New York", input.session)
in_time_int_03 = time(timeframe.period, time_int_03)
in_time_int_003 = time(timeframe.period, time_int_003)
var highe_03 = 0.0
var lowe_03 = 10e10
if in_time_int_03
if not in_time_int_03[1]
highe_03 := high
lowe_03 := low
else
highe_03 := max(high, highe_03)
lowe_03 := min(low, lowe_03)
plot(not in_time_int_03 and ShowIB ? highe_03 : na, title="New York High", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 and ShowIB ? highe_03 : na, style=shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York High", offset = offset_val, transp=20, title="New York High")
plot(not in_time_int_03 and ShowIB ? lowe_03 : na, title="New York Low", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 and ShowIB ? lowe_03 : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York Low", offset = offset_val, transp=20, title="New York Low")
// New York Finish
Session01 = input("0000-0100:1234567", "0000 - 0100", input.session)
S1 = time(timeframe.period, Session01)
Session02 = input("0100-0800:1234567", "0100 - 0800", input.session)
S2 = time(timeframe.period, Session02)
Session03 = input("0800-0900:1234567", "0800 - 0900", input.session)
S3 = time(timeframe.period, Session03)
Session04 = input("0900-1430:1234567", "0900 - 1430", input.session)
S4 = time(timeframe.period, Session04)
Session05 = input("1430-1530:1234567", "1430 - 1530", input.session)
S5 = time(timeframe.period, Session05)
Session06 = input("1530-0000:1234567", "1530 - 0000", input.session)
S6 = time(timeframe.period, Session06)
Test1 = S2 or S4 or S6 ? max(highe_01, highe_02, highe_03) : na
Test2 = S5 ? max(highe_02, highe_01) : na
Test3 = S1 ? max(highe_02, highe_03) : na
Test4 = S3 ? max(highe_03, highe_01) : na
Test1a = S2 or S4 or S6 ? min(lowe_01, lowe_02, lowe_03) : na
Test2a = S5 ? min(lowe_02, lowe_01) : na
Test3a = S1 ? min(lowe_02, lowe_03) : na
Test4a = S3 ? min(lowe_03, lowe_01) : na
plot(Test1, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test2, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test3, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test4, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test1a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test2a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test3a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test4a, color=color.red, linewidth=1, style=plot.style_linebr)
有没有办法将下面的摘录放入 var 或函数中?只是好像代码有点多,感觉自己没有正确完成。
Session01 = input("0000-0100:1234567", "0000 - 0100", input.session)
S1 = time(timeframe.period, Session01)
Session02 = input("0100-0800:1234567", "0100 - 0800", input.session)
S2 = time(timeframe.period, Session02)
Session03 = input("0800-0900:1234567", "0800 - 0900", input.session)
S3 = time(timeframe.period, Session03)
Session04 = input("0900-1430:1234567", "0900 - 1430", input.session)
S4 = time(timeframe.period, Session04)
Session05 = input("1430-1530:1234567", "1430 - 1530", input.session)
S5 = time(timeframe.period, Session05)
Session06 = input("1530-0000:1234567", "1530 - 0000", input.session)
S6 = time(timeframe.period, Session06)
Test1 = S2 or S4 or S6 ? max(highe_01, highe_02, highe_03) : na
Test2 = S5 ? max(highe_02, highe_01) : na
Test3 = S1 ? max(highe_02, highe_03) : na
Test4 = S3 ? max(highe_03, highe_01) : na
Test1a = S2 or S4 or S6 ? min(lowe_01, lowe_02, lowe_03) : na
Test2a = S5 ? min(lowe_02, lowe_01) : na
Test3a = S1 ? min(lowe_02, lowe_03) : na
Test4a = S3 ? min(lowe_03, lowe_01) : na
plot(Test1, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test2, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test3, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test4, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test1a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test2a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test3a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test4a, color=color.red, linewidth=1, style=plot.style_linebr)
希望这次我没猜错。只有我的设计显示黑线而不是白线。
//@version=4
study("Help (Highest Test Script)", overlay=true)
offset_val = input(title="Daily Label Offset", type=input.integer, defval=10)
offset_valW = input(title="Weekly Label Offset", type=input.integer, defval=30)
// Asia Start
time_int_01 = input("0000-0100:1234567", "Asia", input.session)
in_time_int_01 = time(timeframe.period, time_int_01)
// London Start
time_int_02 = input("0800-0900:1234567", "London", input.session)
time_int_002 = input("0900-0800:1234567", "London", input.session)
in_time_int_02 = time(timeframe.period, time_int_02)
// New York Start
time_int_03 = input("1430-1530:1234567", "New York", input.session)
in_time_int_03 = time(timeframe.period, time_int_03)
// Asia Start
var highe_01 = 0.0
var lowe_01 = 10e10
if in_time_int_01
if not in_time_int_01[1]
highe_01 := high
lowe_01 := low
else
highe_01 := max(high, highe_01)
lowe_01 := min(low, lowe_01)
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? highe_01 : na, title="Asia High", color=color.purple, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_01 ? highe_01 : na, style=shape.labelup, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC High", offset = offset_val, transp=20, title="Asia/UTC High")
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? lowe_01 : na, title="Asia Low", color=color.purple, linewidth=2, style=plot.style_linebr)
plotshape(not in_time_int_01 ? lowe_01 : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC Low", offset = offset_val, transp=20, title="Asia/UTC Low")
// Asia Finish
// London Start
var highe_02 = 0.0
var lowe_02 = 10e10
if in_time_int_02
if not in_time_int_02[1]
highe_02 := high
lowe_02 := low
else
highe_02 := max(high, highe_02)
lowe_02 := min(low, lowe_02)
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? highe_02 : na, title="London High", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 ? highe_02 : na, style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London High", offset = offset_val, transp=20, title="London High")
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? lowe_02 : na, title="London Low", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 ? lowe_02 : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London Low", offset = offset_val, transp=20, title="London Low")
// London Finsh
// New York Start
var highe_03 = 0.0
var lowe_03 = 10e10
if in_time_int_03
if not in_time_int_03[1]
highe_03 := high
lowe_03 := low
else
highe_03 := max(high, highe_03)
lowe_03 := min(low, lowe_03)
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? highe_03 : na, title="New York High", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 ? highe_03 : na, style=shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York High", offset = offset_val, transp=20, title="New York High")
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? lowe_03 : na, title="New York Low", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 ? lowe_03 : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York Low", offset = offset_val, transp=20, title="New York Low")
// New York Finish
//Londontest = (not time_int_002 ? highe_02 : na)
//DailyIBHighest = max(highe_01, Londontest, highe_03)
DailyIBHighest = max(highe_01, highe_02, highe_03)
plot(DailyIBHighest, color=color.white, linewidth=1, style=plot.style_linebr)
我已经成功实现了下面是最终代码。
@AnyDozer 如果您能将目光投向代码以获得建议意见,我将不胜感激。
//@version=4
study("Initial Balance Markets Time Zones - Modified", overlay=true)
// User adjustment inputs
offset_val = input(title="Label Offset", type=input.integer, defval=30)
backcolor = input(true, title="Optional background colour Price Action (PA) above or below all IB highs/lows")
DisplayAllIBs = input(false, title="Optional to display all IB highs/lows")
// Asia START //
//////////////////////////////////// Initial Balance Asia Start
time_int_01 = input("0000-0100:1234567", "Asia IB Range", input.session)
in_time_int_01 = time(timeframe.period, time_int_01)
var highe_01 = 0.0
var lowe_01 = 10e10
if in_time_int_01
if not in_time_int_01[1]
highe_01 := high
lowe_01 := low
else
highe_01 := max(high, highe_01)
lowe_01 := min(low, lowe_01)
//////////////////////////////////// Initial Balance Asia Finish
//////////////////////////////////// Asia Plot Start
//High
AsiaIBHighInput = input('0100-0101:1234567', title="Capture Asia IB High") //set the opening range you are interested in
AsiaIBHigh = time("1", AsiaIBHighInput)
var AsiaIBHighPA = 0.0
if AsiaIBHigh
if not AsiaIBHigh[1]
AsiaIBHighPA := highe_01
plotAsiaIBHigh = plot(DisplayAllIBs ? AsiaIBHighPA : na, title=" Asia IB High", color=color.purple, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? AsiaIBHighPA : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia IB High", offset = offset_val, transp=20, title="Asia IB High")
//Low
AsiaIBLowInput = input('0100-0101:1234567', title="Capture Asia IB Low") //set the opening range you are interested in
AsiaIBLow = time("1", AsiaIBLowInput)
var AsiaIBLowPA = 0.0
if AsiaIBLow
if not AsiaIBLow[1]
AsiaIBLowPA := lowe_01
plotAsiaIBLow = plot(DisplayAllIBs ? AsiaIBLowPA : na, title=" Asia IB Low", color=color.purple, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? AsiaIBLowPA : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia IB Low", offset = offset_val, transp=20, title="Asia IB Low")
//////////////////////////////////// Asia Plot Finish
// Asia FINISH //
// London START //
//////////////////////////////////// Initial Balance London Start
time_int_02 = input("0800-0900:1234567", "London IB Range", input.session)
in_time_int_02 = time(timeframe.period, time_int_02)
var highe_02 = 0.0
var lowe_02 = 10e10
if in_time_int_02
if not in_time_int_02[1]
highe_02 := high
lowe_02 := low
else
highe_02 := max(high, highe_02)
lowe_02 := min(low, lowe_02)
//////////////////////////////////// Initial Balance London Finsh
//////////////////////////////////// London Plot Start
//High
LonIBHighInput = input('0900-0901:1234567', title="Capture London IB High") //set the opening range you are interested in
LonIBHigh = time("1", LonIBHighInput)
var LonIBHighPA = 0.0
if LonIBHigh
if not LonIBHigh[1]
LonIBHighPA := highe_02
plotLonIBHigh = plot(DisplayAllIBs ? LonIBHighPA : na, title=" Lon IB High", color=color.yellow, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? LonIBHighPA : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="Lon IB High", offset = offset_val, transp=20, title="Lon IB High")
//Low
LonIBLowInput = input('0900-0901:1234567', title="Capture London IB Low") //set the opening range you are interested in
LonIBLow = time("1", LonIBLowInput)
var LonIBLowPA = 0.0
if LonIBLow
if not LonIBLow[1]
LonIBLowPA := lowe_02
plotLonIBLow = plot(DisplayAllIBs ? LonIBLowPA : na, title=" Lon IB Low", color=color.yellow, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? LonIBLowPA : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="Lon IB Low", offset = offset_val, transp=20, title="Lon IB Low")
//////////////////////////////////// London Plot Finish
// London FINISH //
// New York START //
//////////////////////////////////// Initial Balance New York Start
time_int_03 = input("1430-1530:1234567", "New York IB Range", input.session)
in_time_int_03 = time(timeframe.period, time_int_03)
var highe_03 = 0.0
var lowe_03 = 10e10
if in_time_int_03
if not in_time_int_03[1]
highe_03 := high
lowe_03 := low
else
highe_03 := max(high, highe_03)
lowe_03 := min(low, lowe_03)
//////////////////////////////////// Initial Balance New York Finish
//////////////////////////////////// New York Plot Start
//High
NYIBHighInput = input('1530-1531:1234567', title="Capture New York IB High") //set the opening range you are interested in
NYIBHigh = time("1", NYIBHighInput)
var NYIBHighPA = 0.0
if NYIBHigh
if not NYIBHigh[1]
NYIBHighPA := highe_03
plotNYIBHigh = plot(DisplayAllIBs ? NYIBHighPA : na, title=" New York IB High", color=color.blue, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? NYIBHighPA : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York IB High", offset = offset_val, transp=20, title="New York IB High")
//Low
NYIBLowInput = input('1530-1531:1234567', title="Capture New York IB Low") //set the opening range you are interested in
NYIBLow = time("1", NYIBLowInput)
var NYIBLowPA = 0.0
if NYIBLow
if not NYIBLow[1]
NYIBLowPA := lowe_03
plotNYIBLow = plot(DisplayAllIBs ? NYIBLowPA : na, title=" New York IB Low", color=color.blue, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? NYIBLowPA : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York IB Low", offset = offset_val, transp=20, title="New York IB Low")
//////////////////////////////////// New York Plot Finish
// New York FINISH //
// Background colors
AsiaAboveHigh = close>(AsiaIBHighPA)
LondonAboveHigh = close>(LonIBHighPA)
NewYorkAboveHigh = close>(NYIBHighPA)
Buy = AsiaAboveHigh and LondonAboveHigh and NewYorkAboveHigh
bgcolor(Buy and backcolor ? color.green : na, transp=95, title='Check Chart Buy Signal above all IB Highs')
AsiaBelowLow = close<(AsiaIBLowPA)
LondonBelowLow = close<(LonIBLowPA)
NewYorkBelowLow = close<(NYIBLowPA)
Sell = AsiaBelowLow and LondonBelowLow and NewYorkBelowLow
bgcolor(Sell and backcolor ? color.red : na, transp=95, title='Check Chart Sell Signal below all IB Lows')
// Condition Alerts
alertcondition(Buy==1 ? Buy : na, title="Buy Alert", message="Check Chart Buy Signal above all IB High, {{close}}")
alertcondition(Sell==1 ? Sell :na, title="Sell Alert", message="Check Chart Sell Signal below all IB Low, {{close}}")
AllIBHighest = max(AsiaIBHighPA, LonIBHighPA, NYIBHighPA)
IBHighest = plot(AllIBHighest, title="Highest IB", color=color.red, linewidth=1, style=plot.style_linebr)
plotshape(AllIBHighest, style=shape.labelup, location=location.absolute, color=color.red, textcolor=color.white, show_last=1, text="Highest IB", offset = offset_val, transp=20, title="Highest IB")
AllIBLowest = min(AsiaIBLowPA, LonIBLowPA, NYIBLowPA)
IBLowest = plot(AllIBLowest, title="Lowest IB", color=color.red, linewidth=1, style=plot.style_linebr)
plotshape(AllIBLowest, style=shape.labeldown, location=location.absolute, color=color.red, textcolor=color.white, show_last=1, text="Lowest IB", offset = offset_val, transp=20, title="Lowest IB")
下午好,
以下脚本捕获市场开盘时间(伦敦、纽约和亚洲)的初始余额(前 60 分钟内的第一个最高价和最低价)。
IB 的构建发生在前 60 分钟内,然后显示,因此例如伦敦 0800 到 0900 IB 构建并显示 0900 之后。
脚本然后查看三个 IB 高点并计算出最高点并将其绘制出来(在下面的脚本中显示为白线)。
我正在努力解决的问题是如何排除新 IB 的构建阶段发挥作用。下面的图片应该有助于解释这一点:
如果需要我可以进一步解释。如有任何帮助,我们将不胜感激。
到目前为止请看脚本:
//@version=4
study("Highest Test Script", overlay=true)
offset_val = input(title="Daily Label Offset", type=input.integer, defval=10)
offset_valW = input(title="Weekly Label Offset", type=input.integer, defval=30)
// Asia Start
time_int_01 = input("0000-0100:1234567", "Asia", input.session)
in_time_int_01 = time(timeframe.period, time_int_01)
var highe_01 = 0.0
var lowe_01 = 10e10
if in_time_int_01
if not in_time_int_01[1]
highe_01 := high
lowe_01 := low
else
highe_01 := max(high, highe_01)
lowe_01 := min(low, lowe_01)
plot(not in_time_int_01 ? highe_01 : na, title="Asia High", color=color.purple, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_01 ? highe_01 : na, style=shape.labelup, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC High", offset = offset_val, transp=20, title="Asia/UTC High")
plot(not in_time_int_01 ? lowe_01 : na, title="Asia Low", color=color.purple, linewidth=2, style=plot.style_linebr)
plotshape(not in_time_int_01 ? lowe_01 : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC Low", offset = offset_val, transp=20, title="Asia/UTC Low")
// Asia Finish
// London Start
time_int_02 = input("0800-0900:1234567", "London", input.session)
time_int_002 = input("0900-0800:1234567", "London", input.session)
in_time_int_02 = time(timeframe.period, time_int_02)
var highe_02 = 0.0
var lowe_02 = 10e10
if in_time_int_02
if not in_time_int_02[1]
highe_02 := high
lowe_02 := low
else
highe_02 := max(high, highe_02)
lowe_02 := min(low, lowe_02)
plot(not in_time_int_02 ? highe_02 : na, title="London High", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 ? highe_02 : na, style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London High", offset = offset_val, transp=20, title="London High")
plot(not in_time_int_02 ? lowe_02 : na, title="London Low", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 ? lowe_02 : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London Low", offset = offset_val, transp=20, title="London Low")
// London Finsh
// New York Start
time_int_03 = input("1430-1530:1234567", "New York", input.session)
in_time_int_03 = time(timeframe.period, time_int_03)
var highe_03 = 0.0
var lowe_03 = 10e10
if in_time_int_03
if not in_time_int_03[1]
highe_03 := high
lowe_03 := low
else
highe_03 := max(high, highe_03)
lowe_03 := min(low, lowe_03)
plot(not in_time_int_03 ? highe_03 : na, title="New York High", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 ? highe_03 : na, style=shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York High", offset = offset_val, transp=20, title="New York High")
plot(not in_time_int_03 ? lowe_03 : na, title="New York Low", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 ? lowe_03 : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York Low", offset = offset_val, transp=20, title="New York Low")
// New York Finish
//Londontest = (not time_int_002 ? highe_02 : na)
//DailyIBHighest = max(highe_01, Londontest, highe_03)
DailyIBHighest = max(highe_01, highe_02, highe_03)
plot(DailyIBHighest, color=color.white, linewidth=1, style=plot.style_linebr)
#####更新 18/02/2021 @ 1600 #####
在进一步思考这个问题之后,我正在努力实现的是计算出最大 IB 高,具体如下:
0000 - 0100
黄色 - highe_02
蓝色 - highe_03
0100 - 0800
黄色 - highe_02
蓝色 - highe_03
紫色 - highe_01
0800 - 0900
蓝色 - highe_03
紫色 - highe_01
0900 - 1430
黄色 - highe_02
蓝色 - highe_03
紫色 - highe_01
1430 - 1530
黄色 - highe_02
紫色 - highe_01
1530 - 0000
黄色 - highe_02
蓝色 - highe_03
紫色 - highe_01
##### 更新 19/02/2021 @ 0845 ####
我已经将原始 IBs high/low 设置为 false 可以打开以确认红线正确对齐。这是我希望它显示的方式,但我觉得我没有采取正确的方式,因为我想将输出红线合并为一个输出,以便我可以将其用于警报。
//@version=4
study("Highest Test Script", overlay=true)
offset_val = input(title="Daily Label Offset", type=input.integer, defval=10)
offset_valW = input(title="Weekly Label Offset", type=input.integer, defval=30)
ShowIB = input(false, title="show IBs")
// Asia Start
time_int_01 = input("0000-0100:1234567", "Asia", input.session)
time_int_001 = input("0100-0000:1234567", "London", input.session)
in_time_int_01 = time(timeframe.period, time_int_01)
in_time_int_001 = time(timeframe.period, time_int_001)
var highe_01 = 0.0
var lowe_01 = 10e10
if in_time_int_01
if not in_time_int_01[1]
highe_01 := high
lowe_01 := low
else
highe_01 := max(high, highe_01)
lowe_01 := min(low, lowe_01)
plot(not in_time_int_01 and ShowIB ? highe_01 : na, title="Asia High", color=color.purple, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_01 and ShowIB ? highe_01 : na, style=shape.labelup, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC High", offset = offset_val, transp=20, title="Asia/UTC High")
plot(not in_time_int_01 and ShowIB ? lowe_01 : na, title="Asia Low", color=color.purple, linewidth=2, style=plot.style_linebr)
plotshape(not in_time_int_01 and ShowIB ? lowe_01 : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC Low", offset = offset_val, transp=20, title="Asia/UTC Low")
// Asia Finish
// London Start
time_int_02 = input("0800-0900:1234567", "London", input.session)
time_int_002 = input("0900-0800:1234567", "London", input.session)
in_time_int_02 = time(timeframe.period, time_int_02)
in_time_int_002 = time(timeframe.period, time_int_002)
var highe_02 = 0.0
var lowe_02 = 10e10
if in_time_int_02
if not in_time_int_02[1]
highe_02 := high
lowe_02 := low
else
highe_02 := max(high, highe_02)
lowe_02 := min(low, lowe_02)
plot(not in_time_int_02 and ShowIB ? highe_02 : na, title="London High", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 and ShowIB ? highe_02 : na, style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London High", offset = offset_val, transp=20, title="London High")
plot(not in_time_int_02 and ShowIB ? lowe_02 : na, title="London Low", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 and ShowIB ? lowe_02 : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London Low", offset = offset_val, transp=20, title="London Low")
// London Finsh
// New York Start
time_int_03 = input("1430-1530:1234567", "New York", input.session)
time_int_003 = input("1530-1430:1234567", "New York", input.session)
in_time_int_03 = time(timeframe.period, time_int_03)
in_time_int_003 = time(timeframe.period, time_int_003)
var highe_03 = 0.0
var lowe_03 = 10e10
if in_time_int_03
if not in_time_int_03[1]
highe_03 := high
lowe_03 := low
else
highe_03 := max(high, highe_03)
lowe_03 := min(low, lowe_03)
plot(not in_time_int_03 and ShowIB ? highe_03 : na, title="New York High", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 and ShowIB ? highe_03 : na, style=shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York High", offset = offset_val, transp=20, title="New York High")
plot(not in_time_int_03 and ShowIB ? lowe_03 : na, title="New York Low", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 and ShowIB ? lowe_03 : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York Low", offset = offset_val, transp=20, title="New York Low")
// New York Finish
Session01 = input("0000-0100:1234567", "0000 - 0100", input.session)
S1 = time(timeframe.period, Session01)
Session02 = input("0100-0800:1234567", "0100 - 0800", input.session)
S2 = time(timeframe.period, Session02)
Session03 = input("0800-0900:1234567", "0800 - 0900", input.session)
S3 = time(timeframe.period, Session03)
Session04 = input("0900-1430:1234567", "0900 - 1430", input.session)
S4 = time(timeframe.period, Session04)
Session05 = input("1430-1530:1234567", "1430 - 1530", input.session)
S5 = time(timeframe.period, Session05)
Session06 = input("1530-0000:1234567", "1530 - 0000", input.session)
S6 = time(timeframe.period, Session06)
Test1 = S2 or S4 or S6 ? max(highe_01, highe_02, highe_03) : na
Test2 = S5 ? max(highe_02, highe_01) : na
Test3 = S1 ? max(highe_02, highe_03) : na
Test4 = S3 ? max(highe_03, highe_01) : na
Test1a = S2 or S4 or S6 ? min(lowe_01, lowe_02, lowe_03) : na
Test2a = S5 ? min(lowe_02, lowe_01) : na
Test3a = S1 ? min(lowe_02, lowe_03) : na
Test4a = S3 ? min(lowe_03, lowe_01) : na
plot(Test1, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test2, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test3, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test4, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test1a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test2a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test3a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test4a, color=color.red, linewidth=1, style=plot.style_linebr)
有没有办法将下面的摘录放入 var 或函数中?只是好像代码有点多,感觉自己没有正确完成。
Session01 = input("0000-0100:1234567", "0000 - 0100", input.session)
S1 = time(timeframe.period, Session01)
Session02 = input("0100-0800:1234567", "0100 - 0800", input.session)
S2 = time(timeframe.period, Session02)
Session03 = input("0800-0900:1234567", "0800 - 0900", input.session)
S3 = time(timeframe.period, Session03)
Session04 = input("0900-1430:1234567", "0900 - 1430", input.session)
S4 = time(timeframe.period, Session04)
Session05 = input("1430-1530:1234567", "1430 - 1530", input.session)
S5 = time(timeframe.period, Session05)
Session06 = input("1530-0000:1234567", "1530 - 0000", input.session)
S6 = time(timeframe.period, Session06)
Test1 = S2 or S4 or S6 ? max(highe_01, highe_02, highe_03) : na
Test2 = S5 ? max(highe_02, highe_01) : na
Test3 = S1 ? max(highe_02, highe_03) : na
Test4 = S3 ? max(highe_03, highe_01) : na
Test1a = S2 or S4 or S6 ? min(lowe_01, lowe_02, lowe_03) : na
Test2a = S5 ? min(lowe_02, lowe_01) : na
Test3a = S1 ? min(lowe_02, lowe_03) : na
Test4a = S3 ? min(lowe_03, lowe_01) : na
plot(Test1, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test2, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test3, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test4, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test1a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test2a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test3a, color=color.red, linewidth=1, style=plot.style_linebr)
plot(Test4a, color=color.red, linewidth=1, style=plot.style_linebr)
希望这次我没猜错。只有我的设计显示黑线而不是白线。
//@version=4
study("Help (Highest Test Script)", overlay=true)
offset_val = input(title="Daily Label Offset", type=input.integer, defval=10)
offset_valW = input(title="Weekly Label Offset", type=input.integer, defval=30)
// Asia Start
time_int_01 = input("0000-0100:1234567", "Asia", input.session)
in_time_int_01 = time(timeframe.period, time_int_01)
// London Start
time_int_02 = input("0800-0900:1234567", "London", input.session)
time_int_002 = input("0900-0800:1234567", "London", input.session)
in_time_int_02 = time(timeframe.period, time_int_02)
// New York Start
time_int_03 = input("1430-1530:1234567", "New York", input.session)
in_time_int_03 = time(timeframe.period, time_int_03)
// Asia Start
var highe_01 = 0.0
var lowe_01 = 10e10
if in_time_int_01
if not in_time_int_01[1]
highe_01 := high
lowe_01 := low
else
highe_01 := max(high, highe_01)
lowe_01 := min(low, lowe_01)
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? highe_01 : na, title="Asia High", color=color.purple, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_01 ? highe_01 : na, style=shape.labelup, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC High", offset = offset_val, transp=20, title="Asia/UTC High")
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? lowe_01 : na, title="Asia Low", color=color.purple, linewidth=2, style=plot.style_linebr)
plotshape(not in_time_int_01 ? lowe_01 : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia/UTC Low", offset = offset_val, transp=20, title="Asia/UTC Low")
// Asia Finish
// London Start
var highe_02 = 0.0
var lowe_02 = 10e10
if in_time_int_02
if not in_time_int_02[1]
highe_02 := high
lowe_02 := low
else
highe_02 := max(high, highe_02)
lowe_02 := min(low, lowe_02)
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? highe_02 : na, title="London High", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 ? highe_02 : na, style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London High", offset = offset_val, transp=20, title="London High")
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? lowe_02 : na, title="London Low", color=color.yellow, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_02 ? lowe_02 : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="London Low", offset = offset_val, transp=20, title="London Low")
// London Finsh
// New York Start
var highe_03 = 0.0
var lowe_03 = 10e10
if in_time_int_03
if not in_time_int_03[1]
highe_03 := high
lowe_03 := low
else
highe_03 := max(high, highe_03)
lowe_03 := min(low, lowe_03)
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? highe_03 : na, title="New York High", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 ? highe_03 : na, style=shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York High", offset = offset_val, transp=20, title="New York High")
plot(not in_time_int_01 and not in_time_int_02 and not in_time_int_03 ? lowe_03 : na, title="New York Low", color=color.blue, linewidth=3, style=plot.style_linebr)
plotshape(not in_time_int_03 ? lowe_03 : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York Low", offset = offset_val, transp=20, title="New York Low")
// New York Finish
//Londontest = (not time_int_002 ? highe_02 : na)
//DailyIBHighest = max(highe_01, Londontest, highe_03)
DailyIBHighest = max(highe_01, highe_02, highe_03)
plot(DailyIBHighest, color=color.white, linewidth=1, style=plot.style_linebr)
我已经成功实现了下面是最终代码。
@AnyDozer 如果您能将目光投向代码以获得建议意见,我将不胜感激。
//@version=4
study("Initial Balance Markets Time Zones - Modified", overlay=true)
// User adjustment inputs
offset_val = input(title="Label Offset", type=input.integer, defval=30)
backcolor = input(true, title="Optional background colour Price Action (PA) above or below all IB highs/lows")
DisplayAllIBs = input(false, title="Optional to display all IB highs/lows")
// Asia START //
//////////////////////////////////// Initial Balance Asia Start
time_int_01 = input("0000-0100:1234567", "Asia IB Range", input.session)
in_time_int_01 = time(timeframe.period, time_int_01)
var highe_01 = 0.0
var lowe_01 = 10e10
if in_time_int_01
if not in_time_int_01[1]
highe_01 := high
lowe_01 := low
else
highe_01 := max(high, highe_01)
lowe_01 := min(low, lowe_01)
//////////////////////////////////// Initial Balance Asia Finish
//////////////////////////////////// Asia Plot Start
//High
AsiaIBHighInput = input('0100-0101:1234567', title="Capture Asia IB High") //set the opening range you are interested in
AsiaIBHigh = time("1", AsiaIBHighInput)
var AsiaIBHighPA = 0.0
if AsiaIBHigh
if not AsiaIBHigh[1]
AsiaIBHighPA := highe_01
plotAsiaIBHigh = plot(DisplayAllIBs ? AsiaIBHighPA : na, title=" Asia IB High", color=color.purple, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? AsiaIBHighPA : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia IB High", offset = offset_val, transp=20, title="Asia IB High")
//Low
AsiaIBLowInput = input('0100-0101:1234567', title="Capture Asia IB Low") //set the opening range you are interested in
AsiaIBLow = time("1", AsiaIBLowInput)
var AsiaIBLowPA = 0.0
if AsiaIBLow
if not AsiaIBLow[1]
AsiaIBLowPA := lowe_01
plotAsiaIBLow = plot(DisplayAllIBs ? AsiaIBLowPA : na, title=" Asia IB Low", color=color.purple, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? AsiaIBLowPA : na, style=shape.labeldown, location=location.absolute, color=color.purple, textcolor=color.white, show_last=1, text="Asia IB Low", offset = offset_val, transp=20, title="Asia IB Low")
//////////////////////////////////// Asia Plot Finish
// Asia FINISH //
// London START //
//////////////////////////////////// Initial Balance London Start
time_int_02 = input("0800-0900:1234567", "London IB Range", input.session)
in_time_int_02 = time(timeframe.period, time_int_02)
var highe_02 = 0.0
var lowe_02 = 10e10
if in_time_int_02
if not in_time_int_02[1]
highe_02 := high
lowe_02 := low
else
highe_02 := max(high, highe_02)
lowe_02 := min(low, lowe_02)
//////////////////////////////////// Initial Balance London Finsh
//////////////////////////////////// London Plot Start
//High
LonIBHighInput = input('0900-0901:1234567', title="Capture London IB High") //set the opening range you are interested in
LonIBHigh = time("1", LonIBHighInput)
var LonIBHighPA = 0.0
if LonIBHigh
if not LonIBHigh[1]
LonIBHighPA := highe_02
plotLonIBHigh = plot(DisplayAllIBs ? LonIBHighPA : na, title=" Lon IB High", color=color.yellow, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? LonIBHighPA : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="Lon IB High", offset = offset_val, transp=20, title="Lon IB High")
//Low
LonIBLowInput = input('0900-0901:1234567', title="Capture London IB Low") //set the opening range you are interested in
LonIBLow = time("1", LonIBLowInput)
var LonIBLowPA = 0.0
if LonIBLow
if not LonIBLow[1]
LonIBLowPA := lowe_02
plotLonIBLow = plot(DisplayAllIBs ? LonIBLowPA : na, title=" Lon IB Low", color=color.yellow, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? LonIBLowPA : na, style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.white, show_last=1, text="Lon IB Low", offset = offset_val, transp=20, title="Lon IB Low")
//////////////////////////////////// London Plot Finish
// London FINISH //
// New York START //
//////////////////////////////////// Initial Balance New York Start
time_int_03 = input("1430-1530:1234567", "New York IB Range", input.session)
in_time_int_03 = time(timeframe.period, time_int_03)
var highe_03 = 0.0
var lowe_03 = 10e10
if in_time_int_03
if not in_time_int_03[1]
highe_03 := high
lowe_03 := low
else
highe_03 := max(high, highe_03)
lowe_03 := min(low, lowe_03)
//////////////////////////////////// Initial Balance New York Finish
//////////////////////////////////// New York Plot Start
//High
NYIBHighInput = input('1530-1531:1234567', title="Capture New York IB High") //set the opening range you are interested in
NYIBHigh = time("1", NYIBHighInput)
var NYIBHighPA = 0.0
if NYIBHigh
if not NYIBHigh[1]
NYIBHighPA := highe_03
plotNYIBHigh = plot(DisplayAllIBs ? NYIBHighPA : na, title=" New York IB High", color=color.blue, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? NYIBHighPA : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York IB High", offset = offset_val, transp=20, title="New York IB High")
//Low
NYIBLowInput = input('1530-1531:1234567', title="Capture New York IB Low") //set the opening range you are interested in
NYIBLow = time("1", NYIBLowInput)
var NYIBLowPA = 0.0
if NYIBLow
if not NYIBLow[1]
NYIBLowPA := lowe_03
plotNYIBLow = plot(DisplayAllIBs ? NYIBLowPA : na, title=" New York IB Low", color=color.blue, linewidth=1, style=plot.style_linebr)
plotshape(DisplayAllIBs ? NYIBLowPA : na, style=shape.labeldown, location=location.absolute, color=color.blue, textcolor=color.white, show_last=1, text="New York IB Low", offset = offset_val, transp=20, title="New York IB Low")
//////////////////////////////////// New York Plot Finish
// New York FINISH //
// Background colors
AsiaAboveHigh = close>(AsiaIBHighPA)
LondonAboveHigh = close>(LonIBHighPA)
NewYorkAboveHigh = close>(NYIBHighPA)
Buy = AsiaAboveHigh and LondonAboveHigh and NewYorkAboveHigh
bgcolor(Buy and backcolor ? color.green : na, transp=95, title='Check Chart Buy Signal above all IB Highs')
AsiaBelowLow = close<(AsiaIBLowPA)
LondonBelowLow = close<(LonIBLowPA)
NewYorkBelowLow = close<(NYIBLowPA)
Sell = AsiaBelowLow and LondonBelowLow and NewYorkBelowLow
bgcolor(Sell and backcolor ? color.red : na, transp=95, title='Check Chart Sell Signal below all IB Lows')
// Condition Alerts
alertcondition(Buy==1 ? Buy : na, title="Buy Alert", message="Check Chart Buy Signal above all IB High, {{close}}")
alertcondition(Sell==1 ? Sell :na, title="Sell Alert", message="Check Chart Sell Signal below all IB Low, {{close}}")
AllIBHighest = max(AsiaIBHighPA, LonIBHighPA, NYIBHighPA)
IBHighest = plot(AllIBHighest, title="Highest IB", color=color.red, linewidth=1, style=plot.style_linebr)
plotshape(AllIBHighest, style=shape.labelup, location=location.absolute, color=color.red, textcolor=color.white, show_last=1, text="Highest IB", offset = offset_val, transp=20, title="Highest IB")
AllIBLowest = min(AsiaIBLowPA, LonIBLowPA, NYIBLowPA)
IBLowest = plot(AllIBLowest, title="Lowest IB", color=color.red, linewidth=1, style=plot.style_linebr)
plotshape(AllIBLowest, style=shape.labeldown, location=location.absolute, color=color.red, textcolor=color.white, show_last=1, text="Lowest IB", offset = offset_val, transp=20, title="Lowest IB")