I am using the formula wizard and want the background to be green whenever RSI21 drops below lowest bollinger20band.
What is wrong here?
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description 7532
//{{EFSWizard_Declarations
var vRSI21 = new RSIStudy(21, "Close");
var vBollinger20_of_vRSI14 = new BollingerStudy(20, vRSI21, RSIStudy.RSI, 2);
var vLastAlert = -1;
//}}EFSWizard_Declarations 16086
function preMain() {
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setPriceStudy(false);
setStudyTitle("");
setCursorLabelName("rsi", 0);
setCursorLabelName("bol_u", 1);
setCursorLabelName("bol_m", 2);
setCursorLabelName("bol_l", 3);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarStyle(PS_SOLID, 2);
setDefaultBarStyle(PS_SOLID, 3);
setDefaultBarFgColor(Color.lime, 0);
setDefaultBarFgColor(Color.cyan, 1);
setDefaultBarFgColor(Color.blue, 2);
setDefaultBarFgColor(Color.cyan, 3);
setDefaultBarThickness(2, 0);
setDefaultBarThickness(1, 1);
setDefaultBarThickness(1, 2);
setDefaultBarThickness(1, 3);
setPlotType(PLOTTYPE_LINE, 0);
setPlotType(PLOTTYPE_LINE, 1);
setPlotType(PLOTTYPE_LINE, 2);
setPlotType(PLOTTYPE_LINE, 3);
//}}EFSWizard_PreMain 96831
}
function main() {
/**
* The main() function is called once per bar on all previous bars, once per
* each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
* in your preMain(), it is also called on every tick.
*/
//{{EFSWizard_Expressions
//{{EFSWizard_Expression_1
if (
vRSI21.getValue(RSIStudy.RSI) < vBollinger20_of_vRSI14.getValue(BollingerStudy.LOW ER)
) onAction1();
//}}EFSWizard_Expression_1 15679
//}}EFSWizard_Expressions 26196
//{{EFSWizard_Return
return new Array(
vRSI21.getValue(RSIStudy.RSI),
vBollinger20_of_vRSI14.getValue(BollingerStudy.UPP ER),
vBollinger20_of_vRSI14.getValue(BollingerStudy.BAS IS),
vBollinger20_of_vRSI14.getValue(BollingerStudy.LOW ER)
);
//}}EFSWizard_Return 32876
}
function postMain() {
/**
* The postMain() function is called only once, when the EFS is no longer used for
* the current symbol (ie, symbol change, chart closing, or application shutdown).
*/
}
//{{EFSWizard_Actions
//{{EFSWizard_Action_1
function onAction1() {
setBarBgColor(Color.RGB(0,255,0));
vLastAlert = 1;
}
//}}EFSWizard_Action_1 10114
//}}EFSWizard_Actions 19933
What is wrong here?
//{{EFSWizard_Description
//
// This formula was generated by the Alert Wizard
//
//}}EFSWizard_Description 7532
//{{EFSWizard_Declarations
var vRSI21 = new RSIStudy(21, "Close");
var vBollinger20_of_vRSI14 = new BollingerStudy(20, vRSI21, RSIStudy.RSI, 2);
var vLastAlert = -1;
//}}EFSWizard_Declarations 16086
function preMain() {
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setPriceStudy(false);
setStudyTitle("");
setCursorLabelName("rsi", 0);
setCursorLabelName("bol_u", 1);
setCursorLabelName("bol_m", 2);
setCursorLabelName("bol_l", 3);
setDefaultBarStyle(PS_SOLID, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarStyle(PS_SOLID, 2);
setDefaultBarStyle(PS_SOLID, 3);
setDefaultBarFgColor(Color.lime, 0);
setDefaultBarFgColor(Color.cyan, 1);
setDefaultBarFgColor(Color.blue, 2);
setDefaultBarFgColor(Color.cyan, 3);
setDefaultBarThickness(2, 0);
setDefaultBarThickness(1, 1);
setDefaultBarThickness(1, 2);
setDefaultBarThickness(1, 3);
setPlotType(PLOTTYPE_LINE, 0);
setPlotType(PLOTTYPE_LINE, 1);
setPlotType(PLOTTYPE_LINE, 2);
setPlotType(PLOTTYPE_LINE, 3);
//}}EFSWizard_PreMain 96831
}
function main() {
/**
* The main() function is called once per bar on all previous bars, once per
* each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
* in your preMain(), it is also called on every tick.
*/
//{{EFSWizard_Expressions
//{{EFSWizard_Expression_1
if (
vRSI21.getValue(RSIStudy.RSI) < vBollinger20_of_vRSI14.getValue(BollingerStudy.LOW ER)
) onAction1();
//}}EFSWizard_Expression_1 15679
//}}EFSWizard_Expressions 26196
//{{EFSWizard_Return
return new Array(
vRSI21.getValue(RSIStudy.RSI),
vBollinger20_of_vRSI14.getValue(BollingerStudy.UPP ER),
vBollinger20_of_vRSI14.getValue(BollingerStudy.BAS IS),
vBollinger20_of_vRSI14.getValue(BollingerStudy.LOW ER)
);
//}}EFSWizard_Return 32876
}
function postMain() {
/**
* The postMain() function is called only once, when the EFS is no longer used for
* the current symbol (ie, symbol change, chart closing, or application shutdown).
*/
}
//{{EFSWizard_Actions
//{{EFSWizard_Action_1
function onAction1() {
setBarBgColor(Color.RGB(0,255,0));
vLastAlert = 1;
}
//}}EFSWizard_Action_1 10114
//}}EFSWizard_Actions 19933
Comment