Simple loop to make a hour counter? MQL4

Simple loop to make a hour counter? MQL4

Manage alerts

Loading saved threads...

David Salem · External communityPost link
External question — Stack Overflow Stack Exchange Author: David Salem Original post: https://stackoverflow.com/questions/72375320 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Im trying to make a counter, simple counter, that add 1 every hour. Thanks!
Quote
Report
PaulB · External communityPost link
External answer — Stack Overflow Stack Exchange Author: PaulB Original post: https://stackoverflow.com/a/72390540 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. It's a very simple concept. The following code will increase the variable counter by one every new hour. static int counter; static datetime hour; if(hour!=iTime(NULL, PERIOD_H1,0)) {counter++; hour=iTime(NULL, PERIOD_H1,0);}
Quote
Report
GoldStreet VN · External communityPost link
External answer — Stack Overflow Stack Exchange Author: GoldStreet VN Original post: https://stackoverflow.com/a/73314333 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. You can using Timer: int count = 0; int OnInit() { EventSetTimer(60); //every 60s return(INIT_SUCCEEDED); } void OnTimer() { count++; }
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: David Salem Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/72375320 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Im trying to make a counter, simple counter, that add 1 every hour. Thanks!

Cancel quote

Checking account access…