在 Amibroker 中绘制具有 3 种颜色的数组

Plot array with 3 colors in Amibroker

我正在使用 Amibroker。我想绘制数组 PCT_CLOSE 的图,这样 PCT_CLOSE<=25 时颜色为红色,25 到 50 之间时为黄色,PCT_CLOSE>=50 时为绿色。

现在,由于 IIF 函数限制,我只能创建一个具有 2 种颜色的绘图。下面是我用 2 种颜色做的。

Plot( PCT_CLOSE , "CLOSE", IIf(PCT_CLOSE<=50, colorRed, colorYellow), styleNoTitle | styleLine | styleThick );

我会回答我自己的问题。

有问题的颜色标准:

color is red when PCT_CLOSE<=25, yellow when between 25 and 50, Green when PCT_CLOSE>=50

关键是要有嵌套的 IIF 语句。将 IIF 放在 IIF 中。 下面是对应的代码;

color = IIf(PCT_CLOSE<=25, colorRed, IIf(PCT_CLOSE>50, colorGreen, colorYellow)  )