I am using Amibroker. I would like to make a plot of the array PCT_CLOSE
such that the color is red when PCT_CLOSE<=25
, yellow when between 25 and 50, Green when PCT_CLOSE>=50
.
Right now, due to the IIF
function constraint, I can only create a plot with 2 colors. Below is how I did it with 2 colors.
Plot( PCT_CLOSE , "CLOSE", IIf(PCT_CLOSE<=50, colorRed, colorYellow), styleNoTitle | styleLine | styleThick );
I will answer my own question.
Color criteria in question:
color is red when PCT_CLOSE<=25, yellow when between 25 and 50, Green when PCT_CLOSE>=50
The key is to have nested IIF statements. Put IIF inside IIF. Here is the corresponding code;
color = IIf(PCT_CLOSE<=25, colorRed, IIf(PCT_CLOSE>50, colorGreen, colorYellow) )