FWguideMAandPrice.efs

ICE Data Services -


FWguideMAandPrice.efs 
  

File Name: FWguideMAandPrice.efs


Description:
Formula Wizard study based on the introductory example found in the Formula Wizard Guide. The study colors the price bars green when the price crosses above a 10 period moving average and red when the price crosses below.


Formula Parameters:
NA

Notes:
NA

Download File:
FWguideMAandPrice.efs




EFS Code:
//{{EFSWizard_Description////    This formula was generated by the Alert Wizard////}}EFSWizard_Description 7532//{{EFSWizard_Declarationsvar vEMA10 = new MAStudy(10, 0, "Close", MAStudy.EXPONENTIAL);var vLastAlert = -1;//}}EFSWizard_Declarations 9951function 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("FWguide1");    setCursorLabelName("myData", 0);    setDefaultBarStyle(PS_SOLID, 0);    setDefaultBarFgColor(Color.red, 0);    setDefaultBarThickness(1, 0);    setPlotType(PLOTTYPE_LINE, 0);//}}EFSWizard_PreMain 30109}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 (            close() < vEMA10.getValue(MAStudy.MA)        ) onAction1()    //}}EFSWizard_Expression_1 8977        //{{EFSWizard_Expression_2        else if (            close() >= vEMA10.getValue(MAStudy.MA)        ) onAction2();    //}}EFSWizard_Expression_2 10569    //}}EFSWizard_Expressions 41214//{{EFSWizard_Return    return vEMA10.getValue(MAStudy.MA);//}}EFSWizard_Return 4922}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() {        setPriceBarColor(Color.RGB(155,0,0));        vLastAlert = 1;    }    //}}EFSWizard_Action_1 10013        //{{EFSWizard_Action_2    function onAction2() {        setPriceBarColor(Color.RGB(0,255,0));        vLastAlert = 2;    }    //}}EFSWizard_Action_2 10379    //}}EFSWizard_Actions 40497