Posting this led me to this thread which describes a better method for timing:
Reading that thread led me to use code which does have the correct data. I also learned that a full day of ticks is needed to match the chart data (which makes alot of sense :-).
datetime barTime; // global variable if( barTime < Time[0] ) { // we have a new bar opened barTime = Time[0]; // keep the new bar open time wR_Current = iWPR(NULL,0,14,1); ATR_Current = iATR(NULL,0,14,1); Print(wR_Current, " ", ATR_Current); }
Thanks fbj for the explanation.
TTC
> EA to make a decision once per day at midnight
extern int StartHour=0; // Relevant on H1 charts - allows for different broker timezones if (Hour()==StartHour && Volume[0]==1) // First tick of new hourly bar { // Do stuff here }
Good Luck
-BB-
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Thank you for the mql4 platform. It is fascinating but right now I am stuck.
I am Testing and cannot get the iWPR and iATR data from an EA to equal D1 %R(14) and ATR(14) charts. I want the EA to make a decision once per day at midnight.
This does fire once a day as intended but the data in the Journal tab output does not match the data on the %R and ATR indicator charts. Any advice?
Thanks,
tuxisthecat