//{{EFSWizard_Description // // This formula was generated by the Alert Wizard // //}}EFSWizard_Description 7532 //{{EFSWizard_Declarations var vRSI60 = new RSIStudy(60, "Close"); var vRSI10 = new RSIStudy(10, "Close"); var vLastAlert = -1; var vRSIAlert = 0; var gID = 0; //}}EFSWizard_Declarations 14025 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("RSI(10)=Blue, RSI(60)=Black"); setCursorLabelName("60 RSI", 0); setCursorLabelName("10 RSI", 1); setDefaultBarStyle(PS_SOLID, 0); setDefaultBarStyle(PS_SOLID, 1); setDefaultBarFgColor(Color.black, 0); setDefaultBarFgColor(Color.blue, 1); setDefaultBarThickness(2, 0); setDefaultBarThickness(2, 1); setPlotType(PLOTTYPE_LINE, 0); setPlotType(PLOTTYPE_LINE, 1); addBand(80, PS_SOLID, 1, Color.blue, gID()); addBand(20, PS_SOLID, 1, Color.blue, gID()); setStudyMin(0); setStudyMax(100); //}}EFSWizard_PreMain 50861 } 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 ( vRSI10.getValue(RSIStudy.RSI) > vRSI60.getValue(RSIStudy.RSI) ) onAction1() //}}EFSWizard_Expression_1 11722 //{{EFSWizard_Expression_2 else if ( vRSI10.getValue(RSIStudy.RSI) < vRSI60.getValue(RSIStudy.RSI) ) onAction2(); //}}EFSWizard_Expression_2 13949 if (vRSI10.getValue(RSIStudy.RSI) >= 80 && vRSIAlert != 1){ vRSIAlert = 1 Alert.addToList(getSymbol(), "RSI 10>=80", Color.black, Color.green); } else if (vRSI10.getValue(RSIStudy.RSI) <= 20 && vRSIAlert != 2){ vRSIAlert = 2 Alert.addToList(getSymbol(), "RSI 10<=20", Color.black, Color.red); } else if (vRSI10.getValue(RSIStudy.RSI) < 80 && vRSI10.getValue(RSIStudy.RSI) > 20){ vRSIAlert = 0; } //}}EFSWizard_Expressions 43863 //{{EFSWizard_Return return new Array( vRSI60.getValue(RSIStudy.RSI), vRSI10.getValue(RSIStudy.RSI) ); //}}EFSWizard_Return 12047 } 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() { if (vLastAlert != 1) Alert.addToList(getSymbol(), "RSI 10X60", Color.black, Color.green); // if (vLastAlert != 1) setBarBgColor(Color.RGB(0,255,0)); vLastAlert = 1; } //}}EFSWizard_Action_1 27737 //{{EFSWizard_Action_2 function onAction2() { if (vLastAlert != 2) Alert.addToList(getSymbol(), "RSI 60X10", Color.black, Color.red); // if (vLastAlert != 2) setBarBgColor(Color.RGB(255,0,0)); vLastAlert = 2; } //}}EFSWizard_Action_2 29441 //}}EFSWizard_Actions 80896 if (vRSIAlert == 1) Alert.addToList(getSymbol(),"RSI(10) >= 80", Color.black, Color.yellow) else if (vRSIAlert == 2) Alert.addToList(getSymbol(), "RSI(10) <= 20", Color.black, Color.yellow);