'Hour' - wrong parameters count - mql4
'Hour' - wrong parameters count - mql4
Loading saved threads...
user1582596 · External communityPost link
External question — Stack Overflow Stack Exchange
Author: user1582596
Original post: https://stackoverflow.com/questions/75705164
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am attempting to restrict the hours during which trading can occur, but I have not been successful with my attempts so far. I would appreciate any input or suggestions on how to accomplish this.
// Function to Check if Trade Time is Valid
bool IsTradeTime() {
datetime now = TimeCurrent();
int hour = Hour(now);
Error: 'Hour' - wrong parameters count
Quote
Report
Yasin İPEK · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: Yasin İPEK
Original post: https://stackoverflow.com/a/75755569
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
//Global Variable
input string baslangicZamani= "08:00";
input string bitisZamani="23:00";
//+------------------------------------------------------------------+
bool ZamanFiltresi()
{
datetime _mevcutZaman = TimeCurrent();
datetime _zamanIlk = StringToTime(TimeToString(_mevcutZaman,TIME_DATE) + " " + baslangicZamani);
datetime _zamanSon = StringToTime(TimeToString(_mevcutZaman,TIME_DATE) + " " + bitisZamani) + 60;
if(_zamanIlk>_zamanSon)
{
if(_mevcutZaman >= _zamanIlk || _mevcutZaman <= _zamanSon)
return (true);
else
return (false);
}
if(_zamanIlk<_zamanSon)
{
if(_mevcutZaman >= _zamanIlk && _mevcutZaman <= _zamanSon)
return (true);
else
return (false);
}
return (false);
}
Quote
Report
Post Reply
Checking account access…