Is it possible to change the color of an indicator based on a condition?
for example:
for example:
if (momentum1>0) { SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Lime); } if (momentum1<0) { SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Red); } Plot0[shift]=momentum1;
I know some coders are using 2 indicator buffers, but would be great if we can change the color of an indicator as i explained (The above example doesnt work, may be iam missing something).
color is set for whole line only. you need for 2 buffers - first for momemntum1>0, second for momentum1<0 (and what about momentum1==0?)
Thanks Slawa.
Regards
Alejandro Galindo
Regards
Alejandro Galindo
Oh Slawa, i didnt responded your question about momentum1==0, if its cero then doesnt matter, i prefer to dont plot at cero value because i only want to see above or bellow cero level (on this case of course).
Regards
Alejandro Galindo
Regards
Alejandro Galindo
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
for example:
I know some coders are using 2 indicator buffers, but would be great if we can change the color of an indicator as i explained (The above example doesnt work, may be iam missing something).
Thanks in advance for any help.
Regards
Alejandro Galindo