//{{EFSWizard_Description // // This formula was generated by the Alert Wizard // //}}EFSWizard_Description 7532 //{{EFSWizard_Declarations var vBollinger20 = new BollingerStudy(20, "Close", 2.5); var vLastAlert = -1; //}}EFSWizard_Declarations 10243 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(true); setStudyTitle("Test # 2 for Boll Bands"); //}}EFSWizard_PreMain 8253 } 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 ( Strategy.isLong() == false && close(-1) <= vBollinger20.getValue(BollingerStudy.LOWER) ) onAction1() //}}EFSWizard_Expression_1 15531 //{{EFSWizard_Expression_2 else if ( Strategy.isShort() == false && close(-1) >= vBollinger20.getValue(BollingerStudy.UPPER) ) onAction2(); //}}EFSWizard_Expression_2 18645 //}}EFSWizard_Expressions 55363 //{{EFSWizard_Return return null; //}}EFSWizard_Return 2256 } 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) Strategy.doLong("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0); vLastAlert = 1; } //}}EFSWizard_Action_1 18239 //{{EFSWizard_Action_2 function onAction2() { if (vLastAlert != 2) Strategy.doShort("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0); vLastAlert = 2; } //}}EFSWizard_Action_2 19339 //}}EFSWizard_Actions 53810