Hello nina32,
The iMAOnArray() function it's not working since 890 build.
Stop using it.
I tried more than 2 months to figure out hat is wrong with the returned prices of the iAMOnArray() function, i scratched my code, i wrote on metaqoutes help desk and the conclusion was that the function isn't working any more.
Read those two links ( https://www.mql5.com/en/forum/157331, https://www.mql5.com/en/forum/68159 ), before continue your searching ,
or use Alain Verleyen
2015.12.04 11:20 # , recommendation.( Yes it can. iMAOnArray() is obsolete and ineffective, replace it with
calls to functions from MovingAverages.mqh library (standard with MT4,
provided in Include folder)).
// The iMAOnArray() function it's not working since 890 build. ///--- buffers double main[100000], signal[100000], dif[1000]; ///--- counting from 0 to rates_total ArraySetAsSeries(main,true); ArraySetAsSeries(signal,true); ArraySetAsSeries(dif,true);
i answered your question, sorry haven't seen this before... you're using static arrays != series array
ArraySetAsSeries() does not work with static arrays!
iMAOnArray() works, why you think it does not? i use it? but one has to care about the input data. my new version of the indi has arrays that are exactly sized (one time at init) to the needed count. it is running very fast and without problems.
i can use WHOLE_ARRAY because my array only has valid values, no EMPTY_VALUE or other wrong content.
and i got only for example 500 bars to calculate - this version is much faster, because iMAOnArray() has not so much data to calculate. i have to do the shifting of the values (new bar) on my own, but its still faster...
i got 2 last questions:
- why RsiOnArray() gives me 1 wrong result even if i start at the exact count...? i do now start 1 bar later - but i want to understand it all...
- and it would be great to see a working example of the "total" parameter with values != 0 (WHOLE_ARRAY), i never had correct results with other values...?
wrong output
2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: limit 490 | --------- end -------------- | gtc 2 ms 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[481] 158.46 | rsi0[481] -3.951261689885971 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[482] 158.746 | rsi0[482] -3.579596894373009 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[483] 159.012 | rsi0[483] -2.980521190575073 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[484] 159.064 | rsi0[484] -2.818653984421504 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[485] 159.061 | rsi0[485] -2.851329556356602 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[486] 159.17 | rsi0[486] -2.511213985853288 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[487] 159.126 | rsi0[487] -2.969522240527172 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[488] 159.084 | rsi0[488] -3.410384068278808 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[489] 159.204 | rsi0[489] -3.146766169154222 2016.02.24 18:55:23.325 rsi-onarray-test GBPJPY,M5: inp0[490] 159.169 | rsi0[490] -5 // i start at pos 490, why does this happen, i got 10 values for my calculation, do i need 11? 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: ArraySize(rsi0) 491 | RsiPeriod 10 | limit 490 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[490] 159.169 <<<< here i got 10 valid entrys? 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[491] 159.209 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[492] 159.347 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[493] 159.261 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[494] 159.359 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[495] 159.517 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[496] 159.624 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[497] 159.619 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[498] 159.733 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: inp0[499] 159.71 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: ArraySize(inp0) 500 | limit 499 2016.02.24 18:55:23.324 rsi-onarray-test GBPJPY,M5: initialized
correct output
2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: limit 489 | --------- end -------------- | gtc 1 ms 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[480] 158.537 | rsi0[480] -3.318608088603618 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[481] 158.474 | rsi0[481] -3.888140296096562 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[482] 158.46 | rsi0[482] -4.011534963716705 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[483] 158.746 | rsi0[483] -3.6727556504674 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[484] 159.012 | rsi0[484] -3.138797342731836 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[485] 159.064 | rsi0[485] -2.99702335162086 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[486] 159.061 | rsi0[486] -3.028778401070293 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[487] 159.17 | rsi0[487] -2.734626236739448 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[488] 159.126 | rsi0[488] -3.177981005979554 2016.02.24 19:00:39.770 rsi-onarray-test GBPJPY,M5: inp0[489] 159.084 | rsi0[489] -3.601553829078765 // now i start 1 bar later, result is correct but why i need 11 bars for rsi(10)?! 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: ArraySize(rsi0) 490 | RsiPeriod 10 | limit 489 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[490] 159.204 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[491] 159.169 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[492] 159.209 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[493] 159.347 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[494] 159.261 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[495] 159.359 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[496] 159.517 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[497] 159.624 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[498] 159.619 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: inp0[499] 159.733 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: ArraySize(inp0) 500 | limit 499 2016.02.24 19:00:39.769 rsi-onarray-test GBPJPY,M5: initialized
any idea? sry for my "own coding style" ;)
by the way, you're one of only a few guys were i have seen that :
for(i=0; i<rates_total-main_period; i--) { signal[i] = NormalizeDouble(iMAOnArray(main, 0, signal_period, 0, MODE_LWMA, i),6); }
and i think it is the correct way, i didn't checked your exact counting but you didn't start with the same limit, that's what i mean... but one problem left:
iMAOnArray(main, 0 = WHOLE_ARRAY, signal_period, 0, MODE_LWMA, i)
you have to be absolutely sure that main[] only contains valid entry's, if there is ie. only one EMPTY_VALUE = 2147483647 (EMPTY_VALUE is not 0.0 !!!!) included >>> all further calculations are maybe wrong?
to avoid this one can use the "total" parameter, but i didn't get this working, that's why i choose to use exact sized arrays, this way i can use WHOLE_ARRAY...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi guys