Will get you started.From
To
bool up=false; current=MAATRMain[i]; prev=MAATRMain[i+1]; if(current>prev) up=true; if(current<prev) up=false; if(!up) { MAATRDown[i]=current; MAATRUp[i]=0.0; } else { MAATRUp[i]=current; MAATRDown[i]=0.0; }
current=MAATRMain[i]; prev=MAATRMain[i+1]; if(current>prev) { MAATRUp[i]=current+0.001; MAATRDown[i]=current; } else { MAATRDown[i]=current-0.001; MAATRUp[i]=current; }
- And if you change
You can see the values in the data window (control-D)From
To
SetIndexLabel(1,NULL); SetIndexLabel(2,NULL);
SetIndexLabel(1,"hu"); SetIndexLabel(2,"hd");
Hi WHRoeder,
Thanks for your reply, but … ;)
1. 1. Of course I checked your code, but it changes nothing. Still the Indicator counts just two bars back and nothing more. Besides, I’m pretty sure this part of the code is correct. I have coded other indicator using the same logic and it runs smoothly. This part of the code is designed just to change the color of the histogram depending on the bar height compared to the previous. And so we get to point no.
2. 2. I see the Value of the indicator in data window, but only from MAATRMain Buffer. Buffers MAATRUp and MAATRDown and just for coloring histogram. MAATRUp has the same value as MAATRMain if its higher then previous (and the histogram bar is green), if its lower the value of Main Buffer is given to Down Buffer (and the histogram turns red).
Actually I’ve “borrowed” this solution from Awesome Oscillator ;)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello again,
Once again I’ve come to ask for your help. I’ve spent several hours on this indicator and still can’t get it to work. It counts only two bars back and … and nothing. Could any of more experienced coders (that would probably mean most of the readers;) ) tell me what I’ve done wrong?? That is probably some small and stupid mistake, but I can’t figure it out.
Once again thanx for all the help.