int OnInit()
{
//--- Get handle for KD indicator
KDHandle1=iStochastic(NULL,0,K_Period,D_Period,3,MODE_SMA,STO_LOWHIGH);
...
We can set indicator _Period=0 as current time frame as bar chart, but how we can change the time frame of bar chart in our code? Thanks!
Please use SRC button when you post code. Thank you.
By the way, I don't understand your question.
When I set indicator parameter named "_Period"=0 it means set current time frame with bar chart, if i change the time frame of the bar chart such as changing 5 minutes to 1 hour by right click chart and change as below picutre, the EA will change the time frame from 5 minutes to 1 hour.
My question is how to write code to change the time frame of bar chart in my EA. Thanks!
Please take a look at the Docs: https://www.mql5.com/en/docs/constants/chartconstants/enum_timeframes
You could use something like
KDHandle1=iStochastic(NULL,PERIOD_M5,K_Period,D_Period,3,MODE_SMA,STO_LOWHIGH);
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
int OnInit()
{
//--- Get handle for KD indicator
KDHandle1=iStochastic(NULL,0,K_Period,D_Period,3,MODE_SMA,STO_LOWHIGH);
...
We can set indicator _Period=0 as current time frame as bar chart, but how we can change the time frame of bar chart in our code? Thanks!