Have a look at the code:
input ENUM_TIMEFRAMES TimePeriod = PERIOD_M1; // Set the timeframe for the stochastic.
void OnInit()
{
int stochastic_output = iStochastic(_Symbol,TimePeriod,5,3,3,MODE_SMA,STO_LOWHIGH);//initialize the value for Stochastic calculator in Handle.
if(!ChartIndicatorAdd(0,(int)ChartGetInteger(0,CHART_WINDOWS_TOTAL),stochastic_output)) //Plot initial chart
{
Comment("Stochastic Cannot be plotted");
}
}
I am trying to run the expert that will display the stochastic graph for the particular timeframe as mentioned in the run time.
For 1 minute the graph is working fine but after changing the time to 2 minutes the graph is not displayed or if displayed then it is for the 1 minute. The same is the situation for 5 minutes and so on.