cci_long=iCCI(ChartSymbol(),cci_timeframe[pos],cci_bars,6,0);
-
Don't hard code constants. Use the proper enumeration.
-
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 (2019)
Thanks William,
changing the 6 to PRICE_WEIGHTED (ie correct enumeration) did not change outcome
changing the chart to M5 did, as per PERIOD_M5 used in the indicator setting. The moment the CCI is using a different timeframe than PERIOD_M5 is when it starts returning "0"
I'm using Tickstory data (which i downloaded a while ago) so i'm NOT downloading history from my broker through MT4.
This EA is looking at different TimeFrames, subject to # positions -- hence the Array
What i've done is cleaned all tester history out (incl .ini files) and downloaded FRESH data from Tickstory, and now it is OK. It takes the correct CCI values using the correct (but changing) timeframes.
SOLVED
(but still a bit weird though)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Something is off...
I've tested my EA before successfully, but now it does not work. The value for the CCI is always "0".
When running the tester I get the values i get using the Print() command returns are:
CCI long = 0 0 <the correct price> 14 5
the first two values are puzzling, the last 3 are correct.
Can someone shine a light on this?