I have a simple EFS I am working on, and I am attempting to set multiple colors in it, so if the MACD.Signal line goes below 0 it will be a darker color, and if above 0 a lighter color. So basically the question is how or are you able to set multiple colors from EFS:
Here is my simple EFS:
function main() {
var vMACD_15 =macd(12, 26, 9);
var vMACD_S_15 =macdSignal(12, 26, 9);
var vMACD_60 =macd(12, 26, 9);
var vMACD_S_60 =macdSignal(12, 26, 9);
if (
vMACD_15.getValue(macd) > vMACD_S_15.getValue(macdSignal)
) onAction1()
else if (
vMACD_15.getValue(macd) < vMACD_S_15.getValue(macdSignal)
) onAction2()
function onAction1() {
setBarBgColor(Color.RGB(178,255,178));
vLastAlert = 1;
}
function onAction2() {
setBarBgColor(Color.RGB(255,192,160));
vLastAlert = 2;
Here is my simple EFS:
function main() {
var vMACD_15 =macd(12, 26, 9);
var vMACD_S_15 =macdSignal(12, 26, 9);
var vMACD_60 =macd(12, 26, 9);
var vMACD_S_60 =macdSignal(12, 26, 9);
if (
vMACD_15.getValue(macd) > vMACD_S_15.getValue(macdSignal)
) onAction1()
else if (
vMACD_15.getValue(macd) < vMACD_S_15.getValue(macdSignal)
) onAction2()
function onAction1() {
setBarBgColor(Color.RGB(178,255,178));
vLastAlert = 1;
}
function onAction2() {
setBarBgColor(Color.RGB(255,192,160));
vLastAlert = 2;
Comment