Announcement

Collapse
No announcement yet.

Minor tweek to your formula needed Alex.

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Minor tweek to your formula needed Alex.

    Thanks for the EFS yesterday. The only minor thing is that the 3 add bands are BEHIND the red and green bars. Can you get them so they print on top of them. Many times the entire series is red or green and I only see the add bars on the right side where nothing is lit up.
    //{{EFSWizard_Description
    //
    // This formula was generated by the Alert Wizard
    //
    //}}EFSWizard_Description 7532


    //{{EFSWizard_Declarations

    var vMOM8 = new MOMStudy(6, "Close");
    var vLastAlert = -1;

    //}}EFSWizard_Declarations 7494


    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("Momentum 6");
    setCursorLabelName("MOM", 0);
    setDefaultBarFgColor(Color.white, 0);

    setDefaultBarThickness(2, 0);
    setPlotType(PLOTTYPE_INSTANTCOLORLINE);
    addBand(1,PS_SOLID,1,Color.purple,1);
    addBand(0,PS_SOLID,1,Color.purple,2);
    addBand(-1,PS_SOLID,1,Color.purple,3);
    //}}EFSWizard_PreMain 29214

    }

    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 (
    vMOM8.getValue(MOMStudy.MOM) < -1
    ) onAction1()
    //}}EFSWizard_Expression_1 7856

    //{{EFSWizard_Expression_2
    else if (
    vMOM8.getValue(MOMStudy.MOM) > 1
    ) onAction2();
    //}}EFSWizard_Expression_2 10619

    //}}EFSWizard_Expressions 36889


    //{{EFSWizard_Return
    return vMOM8.getValue(MOMStudy.MOM);
    //}}EFSWizard_Return 4929

    }

    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.maroon);
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1 10992

    //{{EFSWizard_Action_2
    function onAction2() {
    setBarBgColor(Color.green);
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2 9717

    //}}EFSWizard_Actions 39409

  • #2
    Re: Reply to post 'Minor tweek to your formula needed Alex.'

    Earl
    That is a known issue and a fix has already been requested.
    The only workaround I know is to return those values in the formula as opposed to creating bands.
    To return those values open the efs with the Editor and change Line 60 from this
    return vMOM8.getValue(MOMStudy.MOM);
    to this
    return new Array (vMOM8.getValue(MOMStudy.MOM),1,0,-1);
    The drawback of this solution is that you have three extra values in your Cursor Window that are showing a fixed 1, 0 and -1. The advantage is the lines show across the study and on top of the painted background.
    Alex
    Last edited by ACM; 06-06-2003, 02:55 PM.

    Comment

    Working...
    X