So I got this script layout from a youtube video. I finally got it to send alerts, however it isn't triggering properly. The first plot function (yellow triangleup) is not working as intended. The second plot function (orange diamonds) seems to work correctly. I want them to print together. When I set this up for 'COINBASE:BTCUSD' it works perfectly, but for some reason on stocks, it gets out of wack. It almost seems like the time periods are offset by half an hour or something. I've been trying to figure this out for days now. If you have any ideas I'd love to hear them. Thank you!!
//@version=5
indicator('Test Script', overlay=true)
Timeframe = input.timeframe('60')
i_T26 = input.symbol('NYSE:DINO')
f_strategy() =>
test = close > open*1.001 and barstate.isconfirmed ? 1 : close < open*0.999 and barstate.isconfirmed ? -1 : 0
f_screener(_ticker) =>
message = ''
[signal, _tickerClose] = request.security(_ticker, Timeframe, [f_strategy(), close])
if signal == 1
message := 'Go Long ' + _ticker + '@' + str.tostring(_tickerClose)
else if signal == -1
message := 'Go Short ' + _ticker + '@' + str.tostring(_tickerClose)
if signal == 1 or signal == -1
alert(message, alert.freq_once_per_bar_close)
signal
t26_signal = f_screener(i_T26)
plotshape(t26_signal, title='Alert', style=shape.triangleup, location=location.belowbar,
color=color.yellow, size=size.large)
plotshape(f_strategy()==-1 or f_strategy()==1, title='debug', style=shape.diamond,
location=location.belowbar, color=color.orange, size=size.large)