Don't use the CURRENT time, use the time of the BAR you are drawing.
int tHour=TimeHour(TimeCurrent()); | int tHour=TimeHour(Time[i]); |

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
I am trying to develop my first custom indicator. I only want the indicator to show on the charts during the overnight session. Therefore I added a simple IF clause to check for the hour of the day. The problem is that the indicator shows up for each hour of the day. I made a small change shown below from the standard indicator Bands.mq4. Any help would be greatly appreciated.
original code
new code