the result of doing iMAOnArray() of your indicator buffer is going to be another buffer array so you need to
do it like this ...
for(int pos = limit; pos >= start; pos--) //first indicator loop { buffer1[pos] = vals //fill an indicator buffer } for(int pos = limit; pos >= start; pos--) //second indicator loop { buffer2[pos] = iMAOnArray(buffer1,0,0,0,0,pos); //fill iMAOnArray buffer }
the result of doing iMAOnArray() of your indicator buffer is going to be another buffer array so you need to
do it like this ...
Hello SDC,
Thanks for answering. That is how I made it on the first place, but the values from past vars weren't available in the main loop :(
I think the problem is you miss these code ...
//+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+
I have no idea what donkey CI look like, hopefully not looks like me but looks like ... ehm ...
Basically for iMAOnArray we have to prepare the data first, then we can do something later - something else ... .
I think the problem is you miss these code ...
I have no idea what donkey CI look like, hopefully not looks like me but looks like ... ehm ...
Basically for iMAOnArray we have to prepare the data first, then we can do something later - something else ... .
Thank you! I'll test it tonight ;-) The donkey oscillator is supposed to be of help for short-term trading and detecting/trading flat markets.
I'll apply it to a MACD and release it as "Donkey MACD". Blue/red dots "predict" the short/term price action.
Hello SDC,
Thanks for answering. That is how I made it on the first place, but the values from past vars weren't available in the main loop :(
Try it like this then. Use buffers and separate loops for all of it, when you have it working you might merge some of the loops but for testing it is better to do separate loops. Replace your double flat with a buffer. Test each loop by setting all the buffers to draw lines so you will know if any of the calculations is creating unexpected values, and always do iMAOnArray() in a new loop.
Also check your iMAOnArray() parameters, in your full code you have pos as the forth (ma shift) parameter, when pos is limit the shift will be thousands of bars
for(pos = limit; pos >= start; pos--) //first indicator loop { buffer1[pos] = iMA(,,,,,,pos); buffer2[pos] = iMA(,,,,,,pos+1); } for(pos = limit; pos >= start; pos--) //second indicator loop { buffer3[pos] = buffer2[pos] - buffer1[pos]; } for(pos = limit; pos >= start; pos--) //third indicator loop { buffer4[pos] = MathAbs(buffer3[pos]); } for(pos = limit; pos >= start; pos--) //forth indicator loop { buffer5[pos] = iMAOnArray(buffer4,,,,,pos); //fill iMAOnArray buffer }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Good night ;-)
I am writing a little oscillator to test short-term trading even in range-bound markets. I am using IMAOnArray() to calculate two thresholds that point out when is the market flat.
My problem is that IMAOnArray does not work as I expected. I have read all the documentation and searched similar entries in this forum and so forth :P.
The following code does paint but Buffer3 and Buffer4 do not hold the value properly, and it is very slow to calculate.
The following modification causes flat to acquire the value of EMPTY_VALUE. (Unless it is recompiled with the indicator attached to a chart, weird)
Which would be the appropiate way to do it? Full source ahead, you might like the indicator though.
Thank you ;)