Pine script 协助创建筛选程序的功能

Pine script 协助创建筛选程序的功能,pine-script,Pine Script,下午好, 我目前正在使用下面的脚本监控3个市场开放的最高和最低初始余额。目前,我在两个符号之间切换,看看价格走势是否高于最高或最低IB 我想把我的想法写进代码中,就是要有一个能让我查看10-20个符号的屏幕。哪个会显示绿色、红色或白色。绿色表示价格已超过最高IB,红色表示低于最低IB,白色表示介于两者之间 类似于: 目前,代码重复,唯一的区别是三个市场的时间输入 由于每个符号将重复相同的代码/过程,我相信可以将其制作成一个函数,其中: 如果价格动作高于所有IBs=1=绿色 如果价格动作低于所

下午好,

我目前正在使用下面的脚本监控3个市场开放的最高和最低初始余额。目前,我在两个符号之间切换,看看价格走势是否高于最高或最低IB

我想把我的想法写进代码中,就是要有一个能让我查看10-20个符号的屏幕。哪个会显示绿色、红色或白色。绿色表示价格已超过最高IB,红色表示低于最低IB,白色表示介于两者之间

类似于:

目前,代码重复,唯一的区别是三个市场的时间输入

由于每个符号将重复相同的代码/过程,我相信可以将其制作成一个函数,其中:

  • 如果价格动作高于所有IBs=1=绿色
  • 如果价格动作低于所有IBs=-1=红色
  • 如果价格动作不在上述两项中=0=白色
  • 如有任何指导,将不胜感激:

    下面的代码是从上面的IB脚本中提取的:

    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)
    
    // IB Highest and Lowest Settings
    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')
    
    time\u int\u 01=input(“0000-0100:1234567”,“亚洲IB范围”,input.session)
    in_time_int_01=时间(timeframe.period,time_int_01)
    var highe_01=0.0
    var lowe_01=10e10
    如果在时间内
    如果不在时间范围内[1]
    高=高
    lowe_01:=低
    其他的
    高\u 01:=最大值(高,高\u 01)
    lowe_01:=最小值(low,lowe_01)
    ////////////////////////////////////初始平衡亚洲完成
    ////////////////////////////////////亚洲阴谋开始
    //高
    AsiaIBHighInput=input('0100-0101:1234567',title=“Capture Asia IB High”)//设置您感兴趣的开盘区间
    AsiaIBHigh=时间(“1”,AsiaIBHighInput)
    var AsiaIBHighPA=0.0
    如果亚洲高
    如果不是亚洲高[1]
    AsiaIBHighPA:=高0.01
    plotAsiaIBHigh=plot(DisplayAllIBs?AsiaIBHighPA:na,title=“Asia IB High”,color=color.purple,linewidth=1,style=plot.style\u 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”)
    //低
    AsiaIBLowInput=input('0100-0101:1234567',title=“Capture Asia IB Low”)//设置您感兴趣的开盘区间
    AsiaIBLow=时间(“1”,AsiaIBLow输入)
    var Asiaibowpa=0.0
    如果亚洲爆发
    如果不是AsiaIBLow[1]
    AsiaIBLowPA:=lowe_01
    plotAsiaIBLow=plot(DisplayAllIBs?AsiaIBLowPA:na,title=“Asia IB Low”,color=color.purple,linewidth=1,style=plot.style\u 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”)
    ////////////////////////////////////亚洲情节完成
    //亚洲终点//
    //伦敦起点//
    ////////////////////////////////////初始余额伦敦启动
    时间=输入(“0800-0900:1234567”,“伦敦IB范围”,输入会话)
    in_time_int_02=时间(timeframe.period,time_int_02)
    var highe_02=0.0
    var lowe_02=10e10
    如果在时间内
    如果不在时间内,请输入02[1]
    高02:=高
    lowe_02:=低
    其他的
    高02:=最大值(高,高02)
    lowe_02:=最小值(low,lowe_02)
    ////////////////////////////////////初始余额伦敦雀
    ////////////////////////////////////伦敦阴谋开始
    //高
    LonIBHighInput=input('0900-0901:1234567',title=“Capture London IB High”)//设置您感兴趣的开盘区间
    LonIBHigh=时间(“1”,LonIBHighInput)
    var LonIBHighPA=0.0
    如果高
    如果不是LonIBHigh[1]
    LonIBHighPA:=高02
    plotLonIBHigh=plot(显示Allibs?LonIBHighPA:na,title=“Lon IB High”,color=color.yellow,linewidth=1,style=plot.style\u 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”)
    //低
    LonIBLowInput=input('0900-0901:1234567',title=“Capture London IB Low”)//设置您感兴趣的开盘区间
    LonIBLow=时间(“1”,LonIBLow输入)
    var/Pa=0.0
    如果你吹了
    如果没有,请点击[1]
    LonIBLowPA:=lowe_02
    plotLonIBLow=plot(显示ALLIBS?LonIBLowPA:na,title=“Lon IB Low”,color=color.yellow,线宽=1,style=plot.style\u 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”)
    ////////////////////////////////////伦敦地块完工
    //伦敦终点//
    //纽约起点//
    ////////////////////////////////////初始余额纽约开始
    time_int_03=输入(“1430-1530:1234567”,“纽约IB范围”,input.session)
    in_time_int_03=时间(timeframe.period,time_int_03)
    var highe_03=0.0
    var lowe_03=10e10
    如果在时间内
    如果不在时间内(国际)03[1]
    高03:=高
    lowe_03:=低
    其他的
    高03:=最大值(高,高03)
    lowe_03:=最小值(low,lowe_03)
    ////////////////////////////////////初始平衡纽约终点
    ////////////////////////////////////纽约情节开始
    //高
    NYIBHighInput=input('1530-1531:1234567',title=“Capture New York IB High”)//设置您感兴趣的开盘区间
    NYIBHigh=时间(“1”,NYIBHighInput)
    var NYIBHighPA=0.0
    如果尼伯海
    如果不是NYIBHigh[1]
    NYIBHighPA:=高\u 03
    plotNYIBHigh=plot(DisplayAllIBs?NYIBHighPA:na,title=“纽约IB High”,color=color.blue,linewidth=1,style=plot.style\u 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”)
    //低
    NYIBLowInput=input('1530-1531:1234567',title=“Capture New York IB Low”)//设置期初范围
    
    //@version=4
    study(title="Panel Wave Trend & MF", shorttitle="Panel Wave Trend & MF")
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    // USER Symbol Input
    
    Symbol01 = input(title = "Symbol Selection", defval="COINBASE:BTCUSD")
    Symbol02 = input(title = "Symbol Selection", defval="COINBASE:LTCUSD")
    Symbol03 = input(title = "Symbol Selection", defval="COINBASE:BCHUSD")
    Symbol04 = input(title = "Symbol Selection", defval="COINBASE:ETHUSD")
    Symbol05 = input(title = "Symbol Selection", defval="COINBASE:CGLDUSD")
    Symbol06 = input(title = "Symbol Selection", defval="COINBASE:ALGOUSD")
    
    // User adjustment inputs
    offset_val = input(title="Label Offset", type=input.integer, defval=20)
    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")
    MidLinebackcolor = input(false, title="Optional background colour Price Action (PA) above or below all Midline")
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    //TRYING TO IMPLEMENT THE BELOW IB PROCESSES INTO A FUNCTION SO THAT IT CAN USED ACROSS SEVERAL SYMBOLS IN A SCREENER
    //The below works out the Initial Balance for Asia, London and New York then plots from the time the IB has finshed its 60 mins.
    //It then looks at the 3 IBs to see which IB is the highest and plots it.
    //The aim is to plot green on the monitoring panel if the price has gone above the highest IB
    //Plot red if price has gone below the lowest IB
    //Plot white if it is inbetween the highest and lowest IB
    
    
    // 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)
    
    // IB Highest and Lowest Settings
    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')
    
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    //TRYING TO IMPLEMENT THE ABOVE IB PROCESSES INTO A FUNCTION SO THAT IT CAN USED ACROSS SEVERAL SYMBOLS IN A SCREENER
    //The below works out the Initial Balance for Asia, London and New York then plots from the time the IB has finshed its 60 mins.
    //It then looks at the 3 IBs to see which IB is the highest and plots it.
    //The aim is to plot green on the monitoring panel if the price has gone above the highest IB
    //Plot red if price has gone below the lowest IB
    //Plot white if it is inbetween the highest and lowest IB
    
    
    IBCALC () =>
    
    //    AsiaIBTime = input('0000-0100:1234567')
    //    var highe_A = 0.0
    //    var lowe_A  = 10e10
    //    if AsiaIBTime
    //        if not AsiaIBTime[1]
    //            highe_A := high
    //            lowe_A  := low
    //        else
    //            highe_A := max(high, highe_A)
    //            lowe_A  := min(low, lowe_A)
    
    
    
    
        AboveAllIBs = color.green //#0CAB07 // Dark Green  -> Long
        BelowAllIBs = color.red //#DE071C // Dark Red    -> Short
        InBetween   = color.white //#E1DE14 // Yellow      #000000   #555555
        
        
        C   = close
        O   = open
        
    
        IBcolor_  = C > O ? C > C[1] ? AboveAllIBs : AboveAllIBs : C < O ? C < C[1] ? BelowAllIBs : BelowAllIBs : InBetween
    
    
        [IBcolor_]
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    [IBcolor_] = IBCALC ()
    
    color_Sym01 = security(Symbol01, timeframe.period, IBcolor_)
    color_Sym02 = security(Symbol02, timeframe.period, IBcolor_)
    color_Sym03 = security(Symbol03, timeframe.period, IBcolor_)
    color_Sym04 = security(Symbol04, timeframe.period, IBcolor_)
    color_Sym05 = security(Symbol05, timeframe.period, IBcolor_)
    color_Sym06 = security(Symbol06, timeframe.period, IBcolor_)
    
    // === PLOT HISTOGRAM ===
    
    // === Allocate Strategies to Lines ===
    Sym01_bar = 6
    Sym02_bar = 5
    Sym03_bar = 4
    Sym04_bar = 3
    Sym05_bar = 2
    Sym06_bar = 1
    
    
    // === Plot Signals per Strategy ===
    plot(Sym01_bar, title="BTCUSD", color = color_Sym01, transp = 0, style = plot.style_columns)
    plot(Sym02_bar, title="LTCUSD", color = color_Sym02, transp = 0, style = plot.style_columns)
    plot(Sym03_bar, title="BCHUSD", color = color_Sym03, transp = 0, style = plot.style_columns)
    plot(Sym04_bar, title="ETHUSD", color = color_Sym04, transp = 0, style = plot.style_columns)
    plot(Sym05_bar, title="CGLDUSD", color = color_Sym05, transp = 0, style = plot.style_columns)
    plot(Sym06_bar, title="ALGOUSD", color = color_Sym06, transp = 0, style = plot.style_columns)
    
    
    // === Plot Background lines ===
    line0 = hline(0, title="Line 0", linestyle=hline.style_dotted, editable = false)
    line1 = hline(1, title="Line 1", linestyle=hline.style_dotted, editable = false)
    line2 = hline(2, title="Line 2", linestyle=hline.style_dotted, editable = false)
    line3 = hline(3, title="Line 3", linestyle=hline.style_dotted, editable = false)
    line4 = hline(4, title="Line 4", linestyle=hline.style_dotted, editable = false)
    line5 = hline(5, title="Line 5", linestyle=hline.style_dotted, editable = false)
    line6 = hline(6, title="Line 6", linestyle=hline.style_dotted, editable = false)
    
    
    // === Plot Labels ===
    chper = time - time[1]
    chper := change(chper) > 0 ? chper[1] : chper
    
    var label l_Sym01 = na, var label l_Sym02 = na, var label l_Sym03 = na, var label l_Sym04 = na, var label l_Sym05 = na, var label l_Sym06 = na
    label.delete(l_Sym01), label.delete(l_Sym02), label.delete(l_Sym03), label.delete(l_Sym04), label.delete(l_Sym05), label.delete(l_Sym06)
    
    l_Sym01 := label.new(x = time + chper * 20, y = Sym01_bar-1, text = "BTCUSD",   textcolor=#FFFFFF, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym02 := label.new(x = time + chper * 20, y = Sym02_bar-1, text = "LTCUSD",   textcolor=#FFFFFF, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym03 := label.new(x = time + chper * 20, y = Sym03_bar-1, text = "BCHUSD",   textcolor=#FFFFFF, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym04 := label.new(x = time + chper * 20, y = Sym04_bar-1, text = "ETHUSD",   textcolor=#FFFFFF, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym05 := label.new(x = time + chper * 20, y = Sym05_bar-1, text = "CGLDUSD",  textcolor=#FFFFFF, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym06 := label.new(x = time + chper * 20, y = Sym06_bar-1, text = "ALGOUSD",  textcolor=#FFFFFF, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    
    //@version=4
    study(title="Help (Panel Wave Trend & MF)", shorttitle="Panel Wave Trend & MF")
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    // USER Symbol Input
    
    Symbol01 = input(title = "Symbol Selection", defval="COINBASE:BTCUSD")
    Symbol02 = input(title = "Symbol Selection", defval="COINBASE:LTCUSD")
    Symbol03 = input(title = "Symbol Selection", defval="COINBASE:BCHUSD")
    Symbol04 = input(title = "Symbol Selection", defval="COINBASE:ETHUSD")
    Symbol05 = input(title = "Symbol Selection", defval="COINBASE:CGLDUSD")
    Symbol06 = input(title = "Symbol Selection", defval="COINBASE:ALGOUSD")
    
    // User adjustment inputs
    offset_val = input(title="Label Offset", type=input.integer, defval=20)
    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")
    MidLinebackcolor = input(false, title="Optional background colour Price Action (PA) above or below all Midline")
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    //TRYING TO IMPLEMENT THE BELOW IB PROCESSES INTO A FUNCTION SO THAT IT CAN USED ACROSS SEVERAL SYMBOLS IN A SCREENER
    //The below works out the Initial Balance for Asia, London and New York then plots from the time the IB has finshed its 60 mins.
    //It then looks at the 3 IBs to see which IB is the highest and plots it.
    //The aim is to plot green on the monitoring panel if the price has gone above the highest IB
    //Plot red if price has gone below the lowest IB
    //Plot white if it is inbetween the highest and lowest IB
    
    // Start of the function, must include all calculations
    IBCALC () =>
        
        // 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)
        
        // IB Highest and Lowest Settings
        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')
        
        
        
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        
        //TRYING TO IMPLEMENT THE ABOVE IB PROCESSES INTO A FUNCTION SO THAT IT CAN USED ACROSS SEVERAL SYMBOLS IN A SCREENER
        //The below works out the Initial Balance for Asia, London and New York then plots from the time the IB has finshed its 60 mins.
        //It then looks at the 3 IBs to see which IB is the highest and plots it.
        //The aim is to plot green on the monitoring panel if the price has gone above the highest IB
        //Plot red if price has gone below the lowest IB
        //Plot white if it is inbetween the highest and lowest IB
    
    
        // IBCALC () =>
        
        //    AsiaIBTime = input('0000-0100:1234567')
        //    var highe_A = 0.0
        //    var lowe_A  = 10e10
        //    if AsiaIBTime
        //        if not AsiaIBTime[1]
        //            highe_A := high
        //            lowe_A  := low
        //        else
        //            highe_A := max(high, highe_A)
        //            lowe_A  := min(low, lowe_A)
    
    
    
    
        AboveAllIBs = color.green //#0CAB07 // Dark Green  -> Long
        BelowAllIBs = color.red //#DE071C // Dark Red    -> Short
        InBetween   = color.white //#E1DE14 // Yellow      #000000   #555555
        
        
        // C   = close
        // O   = open
        
    
        // IBcolor_  = C > O ? C > C[1] ? AboveAllIBs : AboveAllIBs : C < O ? C < C[1] ? BelowAllIBs : BelowAllIBs : InBetween
        IBcolor_  = Buy ? AboveAllIBs : Sell ? BelowAllIBs : InBetween
        
        
        [IBcolor_]
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    [IBcolor_] = IBCALC ()
    
    color_Sym01 = security(Symbol01, timeframe.period, IBcolor_)
    color_Sym02 = security(Symbol02, timeframe.period, IBcolor_)
    color_Sym03 = security(Symbol03, timeframe.period, IBcolor_)
    color_Sym04 = security(Symbol04, timeframe.period, IBcolor_)
    color_Sym05 = security(Symbol05, timeframe.period, IBcolor_)
    color_Sym06 = security(Symbol06, timeframe.period, IBcolor_)
    
    // === PLOT HISTOGRAM ===
    
    // === Allocate Strategies to Lines ===
    Sym01_bar = 6
    Sym02_bar = 5
    Sym03_bar = 4
    Sym04_bar = 3
    Sym05_bar = 2
    Sym06_bar = 1
    
    
    // === Plot Signals per Strategy ===
    plot(Sym01_bar, title="BTCUSD", color = color_Sym01, transp = 0, style = plot.style_columns)
    plot(Sym02_bar, title="LTCUSD", color = color_Sym02, transp = 0, style = plot.style_columns)
    plot(Sym03_bar, title="BCHUSD", color = color_Sym03, transp = 0, style = plot.style_columns)
    plot(Sym04_bar, title="ETHUSD", color = color_Sym04, transp = 0, style = plot.style_columns)
    plot(Sym05_bar, title="CGLDUSD", color = color_Sym05, transp = 0, style = plot.style_columns)
    plot(Sym06_bar, title="ALGOUSD", color = color_Sym06, transp = 0, style = plot.style_columns)
    
    
    // === Plot Background lines ===
    line0 = hline(0, title="Line 0", linestyle=hline.style_dotted, editable = false)
    line1 = hline(1, title="Line 1", linestyle=hline.style_dotted, editable = false)
    line2 = hline(2, title="Line 2", linestyle=hline.style_dotted, editable = false)
    line3 = hline(3, title="Line 3", linestyle=hline.style_dotted, editable = false)
    line4 = hline(4, title="Line 4", linestyle=hline.style_dotted, editable = false)
    line5 = hline(5, title="Line 5", linestyle=hline.style_dotted, editable = false)
    line6 = hline(6, title="Line 6", linestyle=hline.style_dotted, editable = false)
    
    
    // === Plot Labels ===
    chper = time - time[1]
    chper := change(chper) > 0 ? chper[1] : chper
    
    var label l_Sym01 = na, var label l_Sym02 = na, var label l_Sym03 = na, var label l_Sym04 = na, var label l_Sym05 = na, var label l_Sym06 = na
    label.delete(l_Sym01), label.delete(l_Sym02), label.delete(l_Sym03), label.delete(l_Sym04), label.delete(l_Sym05), label.delete(l_Sym06)
    
    l_Sym01 := label.new(x = time + chper * 20, y = Sym01_bar-1, text = "BTCUSD",   textcolor=#000000, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym02 := label.new(x = time + chper * 20, y = Sym02_bar-1, text = "LTCUSD",   textcolor=#000000, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym03 := label.new(x = time + chper * 20, y = Sym03_bar-1, text = "BCHUSD",   textcolor=#000000, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym04 := label.new(x = time + chper * 20, y = Sym04_bar-1, text = "ETHUSD",   textcolor=#000000, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym05 := label.new(x = time + chper * 20, y = Sym05_bar-1, text = "CGLDUSD",  textcolor=#000000, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)
    l_Sym06 := label.new(x = time + chper * 20, y = Sym06_bar-1, text = "ALGOUSD",  textcolor=#000000, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price, size=size.small)