0

I have some code and a variable buy inside, when buy=true then I send alert("Buy"). But during 1 hour it may trigger 5-10 times and it's really annoying. Don't you know how to send indicator's alert once per 1hr or selected time frame?

buy = true // some code for calculation    
if(buy)
  alert("Buy")
BorHunter
  • 893
  • 3
  • 18
  • 44

1 Answers1

0

You can use a boolean in order to check if you need to send an alert when an hour has past (if you've received a buy signal), and then check if an hour has past by checking if the minutes are equal to 0 :

var send_alert = false
buy = true   

if(buy)
    send_alert := true

if minute == 0
    alert("Buy")
    send_alert := false
mr_statler
  • 1,913
  • 2
  • 3
  • 14