//@version = 5 indicator("Amine",overlay = true,max_bars_back = 2000,max_lines_count = 500 ) max = math.max(close,open) min = math.min(close,open) var line bull_ob_u = na var line bull_ob_l = na var line bear_ob_u = na var line bear_ob_l = na // // trans = color.new(color.white,100) tz = input.string("GMT+2","Timezone") Consecutive_ = input.int(2,"Consecutive Alert") //Bars is_newbar(sess) => t = time('D', sess,tz) na(t[1]) and not na(t) or t[1] < t is_lastbar(sess) => t = time('D', sess,tz) (not(na(t)))[1] and na(t) is_session(sess) => not na(time('D', sess,tz)) session(europe,Europe,EuropeBackgroundColor,EuropeBorderColor,tx_)=> //Europe europeNewbar = is_newbar(Europe) europeSession = is_session(Europe) if europe and europeSession float europeLow = na europeLow := if europeSession if europeNewbar low else math.min(europeLow[1], low) else europeLow[1] float europeHigh = na europeHigh := if europeSession if europeNewbar high else math.max(europeHigh[1], high) else europeHigh[1] int europeStart = na europeStart := if europeSession if europeNewbar time else math.min(europeStart[1], time) else na int europeEnd = na europeEnd := if europeSession if europeNewbar time_close else math.max(europeEnd[1], time_close) else na europeBox = if europeNewbar box.new(left=europeStart, bottom=europeLow, right=europeEnd, top=europeHigh, border_width=1, xloc=xloc.bar_time, border_style=line.style_dashed, border_color=EuropeBorderColor, bgcolor=EuropeBackgroundColor) europeLab = if europeNewbar label.new((europeStart+europeEnd)/2,europeHigh,xloc=xloc.bar_time,color=color.new(color.white,100),style=label.style_label_down,textcolor=EuropeBorderColor,text=tx_) if not europeNewbar label.set_x(europeLab[1], (europeStart+europeEnd)/2) box.set_right(europeBox[1], europeEnd) box.set_top(europeBox[1], europeHigh) label.set_y(europeLab[1], europeHigh) box.set_bottom(europeBox[1], europeLow) // London session lon_on = input.bool(true,"",inline = "lon") lon_tx = input.string("London","",inline = "lon") london = input.session("0900-1400:1234567", "",inline = "lon") lon_col1 = input(title='London box border', defval=#2962ff) lon_col2 = input(title='London box color', defval=color.new(#2962ff, 85)) lon_gr = input.color(color.white,"Bullish",inline = "sd") lon_re = input.color(color.white,"Bearish",inline = "sd") session(lon_on,london,lon_col2,lon_col1,lon_tx) // first_bar = (is_newbar(london)) first_bar_time = ta.valuewhen(is_newbar(london),time,0) last_bar = (is_lastbar(london)) in_session = is_session(london) var int fh_ = 0 var int fl_ = 0 var int start_t_h = 0 var int start_t_l = 0 if first_bar fh_ := 0 fl_ := 0 start_t_h := 0 start_t_l := 0 if 1>0 start_t_l := start_t_l+1 start_t_h := start_t_h+1 first_high()=> first_high = 0 if close=high[i+1] and high[i]>=high[i+2] and high[i]>=high[i+3] first_high := i break [first_high] [first_high] = first_high() // plot(first_high) first_low()=> first_low = 0 if close>high[1] for i=0 to start_t_l if low[i]<=low[i+1] and low[i]<=low[i+2] and low[i]<=low[i+3] first_low := i break [first_low] [first_low] = first_low() // plot(first_low) highest_3 = (ta.highest(3))[first_high] lowest_3 = (ta.lowest(3))[first_low] // plot(highest_3) if close=highest_3 and time[first_high]>=first_bar_time and in_session and not(first_bar) //and high[1]>(ta.highest(3))[2] fh_ := 1 if close>high[1] and low[first_low]<=lowest_3 and time[first_low]>=first_bar_time and in_session and not(first_bar)//and low[1]<(ta.lowest(3))[2] fl_ := 1 // plot(fl_) first_h = close=highest_3 and time[first_high]>=first_bar_time and in_session and fh_[1]==0 first_l = close>high[1] and low[first_low]<=lowest_3 and time[first_low]>=first_bar_time and in_session and fl_[1]==0 var float f_high = 0 var float f_low = 0 var int first_h_done = 0 var int first_l_done = 0 if first_bar f_high := 99999999 f_low := 0 first_h_done := 0 first_l_done := 0 if first_h and first_h_done==0 f_high := high[first_high] if first_l and first_l_done==0 f_low := low[first_low] // low[1] // plot(f_high) // plot(f_low) var int from_lbr = 1 if close bars_from_low = 1 if ta.crossover(max,f_high) for i=from_lbr to 1 if low[i]<=low[i+1] and low[i]<=low[i-1] bars_from_low := i break [bars_from_low] [bars_from_low] = new_l() lowest_ = ta.lowest(bars_from_low>0?bars_from_low+1:1) new_l1()=> bars_from_low1 = 0 for i=1 to bars_from_low if low[i]==lowest_ bars_from_low1 := i break [bars_from_low1] [bars_from_low1] = new_l1() // plot(bars_from_low1) // var int from_hbr = 1 if close>high[1] from_hbr := 1 else from_hbr := from_hbr +1 // plot(from_hbr) new_h()=> bars_from_high = 1 if ta.crossunder(min,f_low) for i=from_hbr to 1 if high[i]>=high[i+1] and high[i]>=high[i-1] bars_from_high := i break [bars_from_high] [bars_from_high] = new_h() highest_ = ta.highest(bars_from_high>0?bars_from_high+1:1) // plot(bars_from_high) // plot(highest_) new_h1()=> bars_from_high1 = 0 for i=1 to bars_from_high if high[i]==highest_ bars_from_high1 := i break [bars_from_high1] [bars_from_high1] = new_h1() // plot(bars_from_high1) // plot(bars_from_high) var float h_line_val = 0.00 if max>f_high // ta.crossover(max,f_high) h_line_val := 9999999 if ta.crossover(max,h_line_val[1]) f_low := low[bars_from_low1] first_l_done := 1 var float l_line_val = 0 if min0 from_h_br := from_h_br+1 highest_from_h_br = ta.highest(from_h_br) var int what_brh = 0 var int what_brl = 0 // plot(f_high) if max>f_high// ta.crossover(max,f_high) what_brh := 1 what_brl := 0 if minf_high and close0 from_l_br := from_l_br+1 lowest_from_l_br = ta.lowest(from_l_br) if close>high[1] and what_brl==-1//math.min(close,open,low)[1]high[1] and what_brl==-1//and low_broken[1]==0 f_low := lowest_from_l_br // math.min(last_low,low)//low[1] first_l_done := 1 // h_ch_same = (first_h and first_h_done==0 ) or (ta.crossunder(min,l_line_val[1])) or (close high_start_bar = 0 for i=from_h_ch to from_h_ch+1000 if high[i]==f_high high_start_bar := i break [high_start_bar] [high_start_bar] = high_line_start() // plot(high_start_bar) if ta.change(f_high) h_line_val := f_high // plot(f_high) // -- // l_ch_same = (first_l and first_l_done==0) or (ta.crossover(max,h_line_val[1])) or (close>high[1] and what_brl==-1) from_l_ch = ta.barssince(ta.change(f_low) or l_ch_same) low_line_start()=> low_start_bar = 0 for i=from_l_ch to from_l_ch+1000 if low[i]==f_low low_start_bar := i break [low_start_bar] [low_start_bar] = low_line_start() if ta.change(f_low) l_line_val := f_low nhigh_line_start()=> nhigh_start_bar = 0 for i=0 to 1000 if high[i]==f_high nhigh_start_bar := i break [nhigh_start_bar] [nhigh_start_bar] = nhigh_line_start() var line nh_line = na var label nh_label = na var int new_h = 0 if (ta.change(f_high) or h_ch_same) and barstate.isconfirmed and in_session and time[nhigh_start_bar]>=first_bar_time and not(first_bar) and lon_on nh_line := line.new(time[nhigh_start_bar],high[nhigh_start_bar],time,high[nhigh_start_bar],xloc = xloc.bar_time,extend = extend.none,color=lon_gr) nh_label := label.new(time[nhigh_start_bar],high[nhigh_start_bar],"●",xloc.bar_time,yloc.abovebar,color=trans,style = label.style_none,textcolor=lon_gr) line.delete(nh_line[1]) label.delete(nh_label[1]) new_h := 0 if ta.crossover(max,f_high) and new_h[1]==0 new_h := 1 if in_session and new_h==0 line.set_x2(nh_line,time) if not(in_session) line.delete(nh_line[1]) label.delete(nh_label[1]) nlow_line_start()=> nlow_start_bar = 0 for i=0 to 1000 if low[i]==f_low nlow_start_bar := i break [nlow_start_bar] [nlow_start_bar] = nlow_line_start() var line nl_line = na var label nl_label = na var int new_l = 0 if (ta.change(f_low) or l_ch_same) and barstate.isconfirmed and in_session and time[nlow_start_bar]>=first_bar_time and not(first_bar) and lon_on nl_line := line.new(time[nlow_start_bar],low[nlow_start_bar],time,low[nlow_start_bar],xloc = xloc.bar_time,extend = extend.none,color=lon_re) nl_label := label.new(time[nlow_start_bar],low[nlow_start_bar],"●",xloc.bar_time,yloc.belowbar,color=trans,style = label.style_none,textcolor=lon_re) line.delete(nl_line[1]) label.delete(nl_label[1]) new_l := 0 if ta.crossunder(min,f_low) and new_l[1]==0 new_l := 1 if in_session and new_l==0 line.set_x2(nl_line,time) if not(in_session) line.delete(nl_line[1]) label.delete(nl_label[1]) // old high low // var float last_h = 0 var float last_l = 0 var int lon_l_alert = 0 var int lon_s_alert = 0 var line h_line = na var label h_label = na var float lonlowest_b1 = 0 low_l = ta.lowest(high_start_bar>0?high_start_bar:1) if ta.crossover(max,f_high) and in_session and time[high_start_bar]>=first_bar_time and f_high==h_line_val[1] and lon_on lonlowest_b1 :=low_l last_h := f_high[1] lon_l_alert := lon_l_alert + 1 lon_s_alert := 0 h_line := line.new(time[high_start_bar],high[high_start_bar],time,high[high_start_bar],xloc = xloc.bar_time,extend = extend.none,color=lon_gr) h_label := label.new(time[high_start_bar],high[high_start_bar],"●",xloc.bar_time,yloc.abovebar,color=trans,style = label.style_none,textcolor=lon_gr) // plot(lonlowest_b1,color = color.white) var line l_line = na var label l_label = na var float lonhighest_s1 = 0 high_l = ta.highest(low_start_bar>0?low_start_bar:1) if ta.crossunder(min,f_low) and in_session and time[low_start_bar]>=first_bar_time and f_low==l_line_val[1] and lon_on lonhighest_s1 :=high_l last_l := f_low[1] lon_l_alert := 0 lon_s_alert := lon_s_alert + 1 l_line := line.new(time[low_start_bar],low[low_start_bar],time,low[low_start_bar],xloc = xloc.bar_time,extend = extend.none,color=lon_re) l_label := label.new(time[low_start_bar],low[low_start_bar],"●",xloc.bar_time,yloc.belowbar,color=trans,style = label.style_none,textcolor=lon_re) if first_bar lon_l_alert := 0 lon_s_alert := 0 if ta.change(f_low) what_brl := 0 if ta.change(f_high) what_brh := 0 low_ = ta.lowest(high_start_bar>0?high_start_bar:1) high_ = ta.highest(low_start_bar>0?low_start_bar:1) // lon_b_rev = lon_l_alert==1 and lon_l_alert[1]==0 and lon_s_alert==0 and lon_s_alert[1]>0 // lon_s_rev = lon_s_alert==1 and lon_s_alert[1]==0 and lon_l_alert==0 and lon_l_alert[1]>0 // plotshape(lon_b_rev, title='R.B', text='R.B', textcolor=color.new(color.white, 0), size=size.auto, style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0)) // plotshape(lon_s_rev, title='R.S', text='R.S', textcolor=color.new(color.white, 0), size=size.auto, style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0)) // alertcondition(lon_b_rev,"R.Buy","R.Buy") // alertcondition(lon_s_rev,"R.Buy","R.Buy") // plot(ny_l_alert) lonc_b1 = lon_l_alert==1 and lon_l_alert[1]==0 lonc_b2 = lon_l_alert==2 and lon_l_alert[1]==1 // var float lonc_b1_h = 0 // var float lonc_b1_l = 0 var int lonfr_b1 = 1 var int pre_b_ = 1 if lonc_b1 var int pre_b = 0 for i=1 to 50 if close[i]lon_lo_at_1 and lonlowest_b1high[i+1] pre_s := i break pre_s_ := pre_s lonfr_s1 := 1 else if lon_s_alert==1 lonfr_s1 := lonfr_s1 +1 // lonhighest_s1 = ta.highest(lonfr_s1) lon_hi_1 = ta.highest(pre_s_) var float lon_lo_at_1s = 0 var float lon_hi_at_1s = 0 if lonc_s1 lon_hi_at_1s := lon_hi_1 lon_lo_at_1s := low[pre_s_] bear_ob_u := line.new(bar_index-pre_s_,lon_hi_at_1s,bar_index+2,lon_hi_at_1s,xloc.bar_index,extend.none,color.red) bear_ob_l := line.new(bar_index-pre_s_,lon_lo_at_1s,bar_index+2,lon_lo_at_1s,xloc.bar_index,extend.none,color.red) lon_c_s = lonc_s2 and lonhighest_s1lon_lo_at_1s plotshape(lon_c_s, title='C.S', text='C.S', textcolor=color.new(color.white, 0), size=size.auto, style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0)) alertcondition(lon_c_s,"C.Sell","C.Sell") // // nydon session ny_on = input.bool(true,"",inline = "ny") ny_tx = input.string("New York","",inline = "ny") nydon = input.session("1400-1800:1234567", "",inline = "ny") ny_col1 = input(title='NY box border', defval=#ff5252) ny_col2 = input(title='NY box color', defval=color.new(#ff5252, 85)) ny_gr = input.color(color.yellow,"Bullish",inline = "sdd") ny_re = input.color(color.yellow,"Bearish",inline = "sdd") session(ny_on,nydon,ny_col2,ny_col1,ny_tx) // first_barn = (is_newbar(nydon)) first_barn_time = ta.valuewhen(is_newbar(nydon),time,0) last_barn = (is_lastbar(nydon)) in_sessionn = is_session(nydon) var int fh_n = 0 var int fl_n = 0 var int start_t_hn = 0 var int start_t_ln = 0 if first_barn fh_n := 0 fl_n := 0 start_t_hn := 0 start_t_ln := 0 if 1>0 start_t_ln := start_t_ln+1 start_t_hn := start_t_hn+1 first_hnighn()=> first_hnighn = 0 if close=high[i+1] and high[i]>=high[i+2] and high[i]>=high[i+3] first_hnighn := i break [first_hnighn] [first_hnighn] = first_hnighn() // plot(first_hnighn) first_lnown()=> first_lnown = 0 if close>high[1] for i=0 to start_t_ln if low[i]<=low[i+1] and low[i]<=low[i+2] and low[i]<=low[i+3] first_lnown := i break [first_lnown] [first_lnown] = first_lnown() // plot(first_lnown) highest_n3n = (ta.highest(3))[first_hnighn] lowest_n3n = (ta.lowest(3))[first_lnown] // plot(highest_n3n) if close=highest_n3n and time[first_hnighn]>=first_barn_time and in_sessionn and not(first_barn) //and high[1]>(ta.highest(3))[2] fh_n := 1 if close>high[1] and low[first_lnown]<=lowest_n3n and time[first_lnown]>=first_barn_time and in_sessionn and not(first_barn)//and low[1]<(ta.lowest(3))[2] fl_n := 1 first_hn = close=highest_n3n and time[first_hnighn]>=first_barn_time and in_sessionn and fh_n[1]==0 first_ln = close>high[1] and low[first_lnown]<=lowest_n3n and time[first_lnown]>=first_barn_time and in_sessionn and fl_n[1]==0 var float f_highn = 0 var float f_lown = 0 var int first_hn_done = 0 var int first_ln_done = 0 if first_barn f_highn := 99999999 f_lown := 0 first_hn_done := 0 first_ln_done := 0 if first_hn and first_hn_done==0 f_highn := high[first_hnighn] if first_ln and first_ln_done==0 f_lown := low[first_lnown] // low[1] // plot(f_highn) // plot(f_lown) var int from_lbrn = 1 if close bars_from_lown = 1 if ta.crossover(max,f_highn) for i=from_lbrn to 1 if low[i]<=low[i+1] and low[i]<=low[i-1] bars_from_lown := i break [bars_from_lown] [bars_from_lown] = new_lnn() lowest_n = ta.lowest(bars_from_lown>0?bars_from_lown+1:1) new_lnn1()=> bars_from_lown1 = 0 for i=1 to bars_from_lown if low[i]==lowest_n bars_from_lown1 := i break [bars_from_lown1] [bars_from_lown1] = new_lnn1() // plot(bars_from_lown1) // var int from_hbrn = 1 if close>high[1] from_hbrn := 1 else from_hbrn := from_hbrn +1 // plot(from_hbrn) new_hnn()=> bars_from_highn = 1 if ta.crossunder(min,f_lown) for i=from_hbrn to 1 if high[i]>=high[i+1] and high[i]>=high[i-1] bars_from_highn := i break [bars_from_highn] [bars_from_highn] = new_hnn() highest_n = ta.highest(bars_from_highn>0?bars_from_highn+1:1) // plot(bars_from_highn) // plot(highest_n) new_hnn1()=> bars_from_highn1 = 0 for i=1 to bars_from_highn if high[i]==highest_n bars_from_highn1 := i break [bars_from_highn1] [bars_from_highn1] = new_hnn1() // plot(bars_from_highn1) // plot(bars_from_highn) var float h_linen_valn = 0.00 if max>f_highn // ta.crossover(max,f_highn) h_linen_valn := 9999999 if ta.crossover(max,h_linen_valn[1]) f_lown := low[bars_from_lown1] first_ln_done := 1 var float l_linen_valn = 0 if min0 from_h_brn := from_h_brn+1 highest_nfrom_h_brn = ta.highest(from_h_brn) var int what_brhn = 0 var int what_brln = 0 if max>f_highn// ta.crossover(max,f_highn) what_brhn := 1 what_brln := 0 if minf_highn and close0 from_l_brn := from_l_brn+1 lowest_nfrom_l_brn = ta.lowest(from_l_brn) if close>high[1] and what_brln==-1//math.min(close,open,low)[1]high[1] and what_brln==-1//and low_broken[1]==0 f_lown := lowest_nfrom_l_brn // math.min(last_low,low)//low[1] first_ln_done := 1 // h_ch_samen = (first_hn and first_hn_done==0 ) or (ta.crossunder(min,l_linen_valn[1])) or (close high_start_barn = 0 for i=from_h_chn to from_h_chn+1000 if high[i]==f_highn high_start_barn := i break [high_start_barn] [high_start_barn] = high_linen_startn() // plot(high_start_barn) if ta.change(f_highn) h_linen_valn := f_highn // plot(f_highn) // -- // l_ch_samen = (first_ln and first_ln_done==0) or (ta.crossover(max,h_linen_valn[1])) or (close>high[1] and what_brln==-1) from_l_chn = ta.barssince(ta.change(f_lown) or l_ch_samen) low_line_startn()=> low_start_barn = 0 for i=from_l_chn to from_l_chn+1000 if low[i]==f_lown low_start_barn := i break [low_start_barn] [low_start_barn] = low_line_startn() if ta.change(f_lown) l_linen_valn := f_lown nhigh_linen_startnn()=> nhigh_start_barnn = 0 for i=0 to 1000 if high[i]==f_highn nhigh_start_barnn := i break [nhigh_start_barnn] [nhigh_start_barnn] = nhigh_linen_startnn() var line nh_linenn = na var label nh_labelnn = na var int new_hnn = 0 if (ta.change(f_highn) or h_ch_samen) and barstate.isconfirmed and in_sessionn and time[nhigh_start_barnn]>=first_barn_time and not(first_barn) and ny_on nh_linenn := line.new(time[nhigh_start_barnn],high[nhigh_start_barnn],time,high[nhigh_start_barnn],xloc = xloc.bar_time,extend = extend.none,color=ny_gr) nh_labelnn := label.new(time[nhigh_start_barnn],high[nhigh_start_barnn],"●",xloc.bar_time,yloc.abovebar,color=trans,style = label.style_none,textcolor=ny_gr) line.delete(nh_linenn[1]) label.delete(nh_labelnn[1]) new_hnn := 0 if ta.crossover(max,f_highn) and new_hnn[1]==0 new_hnn := 1 if in_sessionn and new_hnn==0 line.set_x2(nh_linenn,time) if not(in_sessionn) line.delete(nh_linenn[1]) label.delete(nh_labelnn[1]) nlow_line_startnn()=> nlow_start_barnn = 0 for i=0 to 1000 if low[i]==f_lown nlow_start_barnn := i break [nlow_start_barnn] [nlow_start_barnn] = nlow_line_startnn() var line nl_linenn = na var label nl_labelnn = na var int new_lnn = 0 if (ta.change(f_lown) or l_ch_samen) and barstate.isconfirmed and in_sessionn and time[nlow_start_barnn]>=first_barn_time and not(first_barn) and ny_on nl_linenn := line.new(time[nlow_start_barnn],low[nlow_start_barnn],time,low[nlow_start_barnn],xloc = xloc.bar_time,extend = extend.none,color=ny_re) nl_labelnn := label.new(time[nlow_start_barnn],low[nlow_start_barnn],"●",xloc.bar_time,yloc.belowbar,color=trans,style = label.style_none,textcolor=ny_re) line.delete(nl_linenn[1]) label.delete(nl_labelnn[1]) new_lnn := 0 if ta.crossunder(min,f_lown) and new_lnn[1]==0 new_lnn := 1 if in_sessionn and new_lnn==0 line.set_x2(nl_linenn,time) if not(in_sessionn) line.delete(nl_linenn[1]) label.delete(nl_labelnn[1]) // old high low // var float last_hn = 0 var float last_ln = 0 var int ny_l_alert = 0 var int ny_s_alert = 0 var line h_linen = na var label h_labeln = na var float lowest_b1 = 0 low_ny = ta.lowest(high_start_barn>0?high_start_barn:1) if ta.crossover(max,f_highn) and in_sessionn and time[high_start_barn]>=first_barn_time and f_highn==h_linen_valn[1] and ny_on lowest_b1 := low_ny last_hn := f_highn[1] h_linen := line.new(time[high_start_barn],high[high_start_barn],time,high[high_start_barn],xloc = xloc.bar_time,extend = extend.none,color=ny_gr) h_labeln := label.new(time[high_start_barn],high[high_start_barn],"●",xloc.bar_time,yloc.abovebar,color=trans,style = label.style_none,textcolor=ny_gr) ny_l_alert := ny_l_alert + 1 ny_s_alert := 0 var line l_linen = na var label l_labeln = na var float highest_s1 = 0 high_ny = ta.highest(low_start_barn>0?low_start_barn:1) if ta.crossunder(min,f_lown) and in_sessionn and time[low_start_barn]>=first_barn_time and f_lown==l_linen_valn[1] and ny_on highest_s1 := high_ny last_ln := f_lown[1] l_linen := line.new(time[low_start_barn],low[low_start_barn],time,low[low_start_barn],xloc = xloc.bar_time,extend = extend.none,color=ny_re) l_labeln := label.new(time[low_start_barn],low[low_start_barn],"●",xloc.bar_time,yloc.belowbar,color=trans,style = label.style_none,textcolor=ny_re) ny_s_alert := ny_s_alert + 1 ny_l_alert := 0 if first_bar ny_l_alert := 0 ny_s_alert := 0 if ta.change(f_lown) what_brln := 0 if ta.change(f_highn) what_brhn := 0 // plot(f_highn) // plot(f_lown) // Consecutive_ = input.int(2,"Consecutive Alert") low_n = ta.lowest(high_start_barn>0?high_start_barn:1) high_n = ta.highest(low_start_barn>0?low_start_barn:1) // ny_b_rev = ny_l_alert==1 and ny_l_alert[1]==0 and ny_s_alert==0 and ny_s_alert[1]>0 // ny_s_rev = ny_s_alert==1 and ny_s_alert[1]==0 and ny_l_alert==0 and ny_l_alert[1]>0 // plotshape(ny_b_rev, title='R.B', text='R.B', textcolor=color.new(color.white, 0), size=size.auto, style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0)) // plotshape(ny_s_rev, title='R.S', text='R.S', textcolor=color.new(color.white, 0), size=size.auto, style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0)) // alertcondition(ny_b_rev,"R.Buy","R.Buy") // alertcondition(ny_s_rev,"R.Buy","R.Buy") c_b1 = ny_l_alert==1 and ny_l_alert[1]==0 c_b2 = ny_l_alert==2 and ny_l_alert[1]==1 var float c_b1_h = 0 var float c_b1_l = 0 var int fr_b1 = 1 var int nypre_b_ = 1 if c_b1 var int nypre_b = 0 for i=1 to 50 if close[i]ny_lo_at_1 and lowest_b1high[i+1] nypre_s := i break nypre_s_ := nypre_s fr_s1 := 1 else if ny_s_alert==1 fr_s1 := fr_s1 +1 // highest_s1 = ta.highest(fr_s1) ny_hi_1 = ta.highest(nypre_s_) var float ny_lo_at_1s = 0 var float ny_hi_at_1s = 0 if c_s1 ny_hi_at_1s := ny_hi_1 ny_lo_at_1s := low[nypre_s_] bear_ob_u := line.new(bar_index-nypre_s_,ny_hi_at_1s,bar_index+2,ny_hi_at_1s,xloc.bar_index,extend.none,color.red) bear_ob_l := line.new(bar_index-nypre_s_,ny_lo_at_1s,bar_index+2,ny_lo_at_1s,xloc.bar_index,extend.none,color.red) ny_c_s = c_s2 and highest_s1ny_hi_at_1s plotshape(ny_c_s, title='C.S', text='C.S', textcolor=color.new(color.white, 0), size=size.auto, style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0)) alertcondition(ny_c_s,"C.Sell","C.Sell") // //@version=5 // indicator(title='AG FX - Watermark', overlay=true) //text inputs title = input.string('Your Title', 'Tittle', group='text') subtitle = input.string('Your Subtitle', '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.tostring(dayofmonth(time_close)) + '/' + str.tostring(month(time_close)) + '/' + str.tostring(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 width = input.int(0, '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') height = input.int(0, '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(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(color.new(color.black, 30), 'Subitle Color', group='subtitle settings') s_subtitle = input.string('normal', '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(color.new(color.black, 30), 'Subitle 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(color.new(color.blue, 100), 'Background', group='background') //text watermark creation textWatermark = table.new(textVPosition + '_' + textHPosition, 1, 3) table.cell(textWatermark, 0, 0, title, width, height, c_title, a_title, text_size=s_title, bgcolor=c_bg) table.cell(textWatermark, 0, 1, subtitle, width, height, c_subtitle, a_subtitle, text_size=s_subtitle, bgcolor=c_bg) //symbol info watermark creation symWatermark = table.new(symVPosition + '_' + symHPosition, 5, 5) if symInfoCheck == true table.cell(symWatermark, 0, 1, symInfo, width, height, c_symInfo, a_symInfo, text_size=s_symInfo, bgcolor=c_bg) table.cell(symWatermark, 0, 0, date, width, height, c_symInfo, a_symInfo, text_size=s_symInfo, bgcolor=c_bg)