[pshaiCmd] SecondsTillCandleClose
stableDescription
A custom command to return the seconds until candle close.
HaasScript
DefineCommand('SecondsTillCandleClose', '')
local interval = DefineParameter(NumberType, 'interval', '', false, 0, 'CurrentInterval, InputInterval, Number')
interval = interval > 0 and interval or CurrentInterval()
local roundUp = function(x, a)
return x + (a - (x % a))
end
local next_candle_close_time = roundUp(Time(), interval * 60)
local seconds_till_close = next_candle_close_time - Time()
DefineOutput(NumberType, seconds_till_close, '')
0 Comments
Sign in to leave a comment.
No comments yet. Be the first!