Hi,
Is it possible to give me a very, very simple example of an indicator that gives a green color when it's rising and red when it's going down: let's say on this buffer: ma[i]=iMA(0,0,10,0,2,0,i); I realize it will need at least 3 buffers: 1 for the value, 1 for the rising (that paints green) and 1 for the declining values (in red). but a simple if (ma[i]>ma[i+1]) {up[i]=ma[i];} else {dn[i]=ma[i];} doesn't seem to work...
thanks;
close?
close?
thanks, but this one has 3 colors (including yellow), and it shows empty gaps between pieces of red and green, so how would you code it with only 2 colors (red & green) and without the gaps between the pieces?
thanks, but this one has 3 colors (including yellow), and it shows empty gaps between pieces of red and green, so how would you code it with only 2 colors (red & green) and without the gaps between the pieces?
sorry, I only changed your code enough to show you the way... it was not intended to be the solution... from your intial post, I thought you were just stuck getting to the next step...
sorry, I only changed your code enough to show you the way... it was not intended to be the solution... from your intial post, I thought you were just stuck getting to the next step...
if(ma[i]==ma[i+1]) { up[i]=up[i+1]; dn[i]=dn[i+1]; }but that still leaves the gaps.
yup, no problem. see attached. this had me puzzled for a long time - you will see that we needed two calls to the ma to get this right...
I added a block to make the line gold when the last two ma values are equal - don't think it worked. take it out if you want.
sn
yup, no problem. see attached. this had me puzzled for a long time - you will see that we needed two calls to the ma to get this right...
I added a block to make the line gold when the last two ma values are equal - don't think it worked. take it out if you want.
sn
Yes that's it, thanks for helping me with this.
![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
Hi,
Is it possible to give me a very, very simple example of an indicator that gives a green color when it's rising and red when it's going down: let's say on this buffer: ma[i]=iMA(0,0,10,0,2,0,i); I realize it will need at least 3 buffers: 1 for the value, 1 for the rising (that paints green) and 1 for the declining values (in red). but a simple if (ma[i]>ma[i+1]) {up[i]=ma[i];} else {dn[i]=ma[i];} doesn't seem to work...
thanks;