Announcement

Collapse
No announcement yet.

Parabolic and MACD Alerts efs wizard

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parabolic and MACD Alerts efs wizard

    I wanted to make sure that my thinking is correct in this efs study. I want to make sure that when both conditions are met at separate times that the alert will trigger and that the alert is not set up to only go off when both conditions are met at the same time.
    Also can anyone explain the difference between "first time" and "everytime" and the efs wizard?

    Thanks

    //{{EFSWizard_Description
    //
    // This formula was generated by the Alert Wizard
    //
    //}}EFSWizard_Description


    //{{EFSWizard_Declarations
    var vParSAR = new ParabolicStudy(0.02, 0.02, 0.2);
    var vMACD7_18 = new MACDStudy(7, 18, 9, "Close", false);
    var vLastAlert = -1;
    //}}EFSWizard_Declarations


    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("");
    //}}EFSWizard_PreMain

    }

    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() > vParSAR.getValue(ParabolicStudy.STOP) &&
    vMACD7_18.getValue(MACDStudy.MACD) > vMACD7_18.getValue(MACDStudy.SIGNAL)
    ) onAction1()
    //}}EFSWizard_Expression_1

    //{{EFSWizard_Expression_2
    else if (
    vParSAR.getValue(ParabolicStudy.STOP) > close() &&
    vMACD7_18.getValue(MACDStudy.MACD) < vMACD7_18.getValue(MACDStudy.SIGNAL)
    ) onAction2();
    //}}EFSWizard_Expression_2

    //}}EFSWizard_Expressions


    //{{EFSWizard_Return
    return null;
    //}}EFSWizard_Return

    }

    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() {
    Strategy.doLong("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    Strategy.doCover("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    if (vLastAlert != 1) Alert.addToList(getSymbol(), "GO LONG COVER SHORT", Color.RGB(0,0,0), Color.RGB(0,255,0));
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //{{EFSWizard_Action_2
    function onAction2() {
    Strategy.doShort("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    Strategy.doSell("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    if (vLastAlert != 2) Alert.addToList(getSymbol(), "SELL SHORT SELL LONG", Color.RGB(0,0,0), Color.RGB(195,0,0));
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2

    //}}EFSWizard_Actions

  • #2
    Re: Parabolic and MACD Alerts efs wizard

    GoBucks8866
    The alert will trigger when both conditions are true regardless of the fact that one condition may have been true for a while and the other just evaluated to true
    "everytime" means that a command will be executed each time a condition evaluates to true.
    "first time" instead means that a command will be executed only each first time a condition evaluates to true ie it will not be executed again until some other condition evaluates to true
    Alex


    Originally posted by GoBucks8866
    I wanted to make sure that my thinking is correct in this efs study. I want to make sure that when both conditions are met at separate times that the alert will trigger and that the alert is not set up to only go off when both conditions are met at the same time.
    Also can anyone explain the difference between "first time" and "everytime" and the efs wizard?

    Thanks

    //{{EFSWizard_Description
    //
    // This formula was generated by the Alert Wizard
    //
    //}}EFSWizard_Description


    //{{EFSWizard_Declarations
    var vParSAR = new ParabolicStudy(0.02, 0.02, 0.2);
    var vMACD7_18 = new MACDStudy(7, 18, 9, "Close", false);
    var vLastAlert = -1;
    //}}EFSWizard_Declarations


    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("");
    //}}EFSWizard_PreMain

    }

    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() > vParSAR.getValue(ParabolicStudy.STOP) &&
    vMACD7_18.getValue(MACDStudy.MACD) > vMACD7_18.getValue(MACDStudy.SIGNAL)
    ) onAction1()
    //}}EFSWizard_Expression_1

    //{{EFSWizard_Expression_2
    else if (
    vParSAR.getValue(ParabolicStudy.STOP) > close() &&
    vMACD7_18.getValue(MACDStudy.MACD) < vMACD7_18.getValue(MACDStudy.SIGNAL)
    ) onAction2();
    //}}EFSWizard_Expression_2

    //}}EFSWizard_Expressions


    //{{EFSWizard_Return
    return null;
    //}}EFSWizard_Return

    }

    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() {
    Strategy.doLong("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    Strategy.doCover("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    if (vLastAlert != 1) Alert.addToList(getSymbol(), "GO LONG COVER SHORT", Color.RGB(0,0,0), Color.RGB(0,255,0));
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //{{EFSWizard_Action_2
    function onAction2() {
    Strategy.doShort("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    Strategy.doSell("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    if (vLastAlert != 2) Alert.addToList(getSymbol(), "SELL SHORT SELL LONG", Color.RGB(0,0,0), Color.RGB(195,0,0));
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2

    //}}EFSWizard_Actions

    Comment


    • #3
      EFS code writing

      Hello Alex could you please email me [email protected]
      about your coding services for EFX Scripts

      Thanks
      Brad

      Comment


      • #4
        Re: EFS code writing

        Brad
        Please see my reply to the same question you posted here
        Alex


        Originally posted by bradbrown
        Hello Alex could you please email me [email protected]
        about your coding services for EFX Scripts

        Thanks
        Brad

        Comment

        Working...
        X