I want to plot ahead of time pivot points. If today is Friday, it should plot on Monday and keep its location till the Market opens.
Similarly, If today is Weekday, should plot on Next Day and keep its location till the Market opens.
There are no errors in the code, what is the issue and solution?
I want a solution for all markets, not just time specific for a particular market.
//@version=5
indicator("Plot Ahead of Time", overlay=true)
//TIME
//*******************************************************************
var int time_tomorrow_start_line = na
var int time_tomorrow_end_line = na
time_check_2 = timestamp(year(timenow), month(timenow), dayofmonth(timenow) , hour(00), minute(00), second(00))
Time_one_day = 86400000
if time_check_2 == dayofweek.friday // TODAY IS FRIDAY PLOT ON MONDAY friday saturday sunday monday
time_tomorrow_start_line := timestamp(year(timenow), month(timenow), dayofmonth(timenow + Time_one_day + Time_one_day + Time_one_day ) , hour(00), minute(00))
time_tomorrow_end_line := time_tomorrow_start_line + Time_one_day
//LOCATION
//*******************************************************************
// Get series
get_security(e, timeFrame) => request.security(syminfo.tickerid, timeFrame, e, barmerge.gaps_off, barmerge.lookahead_on)
//Get High, Low and Close
H_d_Tomorrow = get_security(high , 'D')
L_d_Tomorrow = get_security(low , 'D')
C_d_Tomorrow = get_security(close , 'D')
//cenral pivot range
DayPivot_Tomorrow = ((H_d_Tomorrow + L_d_Tomorrow + C_d_Tomorrow) / 3)
//PLOT
//*******************************************************************
var line DayPivot_Tomorrow_line = na
DayPivot_Tomorrow_line := line.new(x1 = time_tomorrow_start_line , y1 = DayPivot_Tomorrow , x2 = time_tomorrow_end_line , y2 = DayPivot_Tomorrow , xloc=xloc.bar_time, style=line.style_solid, width = 1, color = color.new(#E040FB,0) )//
line.delete(DayPivot_Tomorrow_line[1])