Quote:
Originally Posted by Dave137
What is the code to find out what time period the graph is running at? So I can change variable settings for each time period.
if(?????) . . .
Dave
|
PHP Code:
if(Period() == PERIOD_M15) ...
or:
PHP Code:
switch(Period())
{
case PERIOD_M1:
...
break;
case PERIOD_M5:
...
break;
...
}
Sometime it maybe easier to work with indices:
PHP Code:
int tfIndex = ArrayBsearch({PERIOD_M1, PERIOD_M5, PERIOD_M15, ...}, Period());
Example : how to display the period by the string you want:
PHP Code:
int Periods[] = {PERIOD_M1, PERIOD_M5, PERIOD_M15, ...};
string sPeriods[] = {" M1", " M5", " M15", " M30", " Hourly", " 4 hours", " Daily", " Weekly"...};
int tfIndex = ArrayBsearch(Periods, Period());
comment(Symbol() + sPeriods[tfIndex]);