iTime();
use a global variable datetime x;
then give a x value x=iTime(symbol,period,place) inside your code. It should be the place when you want to start looking at a active bar. If x doen't equal to iTime at the moment, new bar has been created.
hope it helps!
zolero
use a global variable datetime x;
then give a x value x=iTime(symbol,period,place) inside your code. It should be the place when you want to start looking at a active bar. If x doen't equal to iTime at the moment, new bar has been created.
datetime x if(x!=iTime(Symbol(), PERIOD_M30, 0) Alert("New bar!!!"); //...... buy moment x=iTime(Symbol(), PERIOD_M30, 0);This code looks at 30-minute period (it doesn't matter which timeframe your code is working!!). If you change PERIOD_M30 to 0 then it takes active timeframe, whatever it is at the moment.
hope it helps!
zolero
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
or is there a function that will show if the current candle on a certain time frame, if it is still open or has finished?
thanks