I have created an EA which uses various indicators where I pass a static timeframe PERIOD_D1.
i.e. iATR with static timeframe PERIOD_D1 but it is applicable for other indicator as well iMA
Print("******ATR val:" +iATR(NULL, PERIOD_D1, 14, 1));
While running the above statement in EA in Strategy Tester, I have found the following:
1. When running the above statement in Strategy Tester specifying Period in drop down 'M1, M5, M15, M30, H1, H4', I receive same value i.e.
0.008443333333333358
2. When running the above statement in Strategy Tester specifying Period in drop down 'Daily', I receive a different value i.e.
0.005713333333333311
3. However, if I specify a timeframe PERIOD_H4 i.e. iATR(NULL, PERIOD_H4, 14, 1)), the value is consistent across all drop downs 'M1, M5,
M15, M30, H1, H4, Daily'
Log entry:
2020.03.17 18:46:46.855 2017.01.17 21:01:01 Trade EURUSD,H4: ******ATR
val:0.008443333333333358
2020.03.17 18:47:19.358 2017.01.17 21:01:01 Trade EURUSD,Daily: ******ATR
val:0.005713333333333311
Expectations:
Since I'm specifying a static timeframe PERIOD_D1, the value should be consistent across all drop down periods.
I'm not sure if anyone has faced a similar issue or provide some insight why a drop down can cause a change in static timeframe PERIOD_D1.
Please let me know how I can sort it since I trade on Daily charts and it is using the wrong value.
Thanks in advance
- Real and Generated Ticks - Algorithmic Trading, Trading Robots
- Custom Financial Instruments - For Advanced Users - Trading Operations
- Parabolic SAR - Trend Indicators - Technical Indicators - Price Charts, Technical and Fundamental Analysis
- You post makes no sense. ATR of each timeframe will be different. You can't use one timeframe and get multiple values.
- On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073
errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4 - Post your code.
William Roeder:
- You post makes no sense. ATR of each timeframe will be different. You can't use one timeframe and get multiple values.
- On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073
errors before accessing candle/indicator values.
Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4 - Post your code.
Hi William,
Thanks for your response and time.
Below is the only line of code:
Print("******ATR val:" +iATR(NULL, PERIOD_D1, 14, 1));
Current findings:
1. I have tried using downloaded data from Metaquotes and you are right I'm getting the same values
2. However, I'm using data from TickStory where I'm getting different values hence there might be an issue in the underlying data
You can ignore the request for time being and I will try to investigate further. If I find anything obvious I will share with everyone.
Many thanks,
Amit
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