I’m using security function like below:
indicator("My script" , overlay = true)
mystate = close[0] >= open[0] and close[1] >= open[1] and close[2] >= open[2] and close[3] >= open[3] and close[4] >= open[4]
transtate = request.security(syminfo.tickerid, "30", mystate)
plotshape(transtate,
size=size.small,
style= shape.triangledown,
color=color.red,
text = 'this',
textcolor=color.red)
it means plot the candle when 5 green candle Continuous.
so it plot 1:30 in time frame 30
and when switch time frame to 15 the plots are on 1:45 and 2:00
and in time frame 5 the plots are on 1:55 , 2:00 , 2:05 , 2:10 , 2:15 , 2:20
how can I get plots immediately in right time( in example above in 1:30) in all time frame ?
picture below is in time frame 5 minute

picture below is in time frame 30 minute

I tried to plot candles on time frame 30 with security function and see the plot shape on lower time frames.
>Solution :
Use the barmerge.lookahead_on parameter of the security() function to match the start of the higher timeframe bar with the first one in the same period on lower tf
transtate = request.security(syminfo.tickerid, "30", mystate, lookahead = barmerge.lookahead_on)
Note that the security with lookahead leaks future data on historical bars.
If you would like to plot only on the first lower tf bar, replace the condition in plotshape to:
plotshape(transtate and not nz(transtate[1]), ...