Announcement

Collapse
No announcement yet.

Need help creating an EFS. Never coded before in life.

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

  • Need help creating an EFS. Never coded before in life.

    I tried to do this for 4 hours last night but completely failed. Can anyone help me with what I want to do.

    Basiscally I want an alert to be issued when 3 criterias are met. The first criteria is that the MACD (2, 3, 1) be below -.001. The second criteria being is that the RSI (2) index should be below 15. And the last part is the hardest part it is a script I found on the forums that plots the linear regression in an osccilator-like
    manner. I would like that to be below -.01.

    I tried to do it with just the 2 basic studies (MACD and RSI) and couldn't even do that... let alone the 3rd study. ANY help would greatly be appreciated. The code for the linear study is attached. I forgot who created it so sorry for not giving credit.
    Attached Files
    Last edited by Aleehatami; 04-06-2009, 04:54 PM.

  • #2
    Hey I got the first 2 to work. I don't know why it wasn't working before. But it works now. My question now is how do you get a value from a study that is not included as a "built in" in the formula wizard? I want to add a 3rd condition that gives linear regression a value. How do I call upon that script? Here is what I have so far:

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


    //{{EFSWizard_Declarations
    var vMACD2_3 = new MACDStudy(2, 3, 1, "Close", false);
    var vRSI2 = new RSIStudy(2, "Close");
    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("ff");
    //}}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 (
    vRSI2.getValue(RSIStudy.RSI) < 10 &&
    vMACD2_3.getValue(MACDStudy.MACD) < -.003
    ) onAction1();
    //}}EFSWizard_Expression_1

    //}}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() {
    Alert.addToList(getSymbol(), "BUY!", Color.RGB(0,0,0), Color.RGB(195,0,0));
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //}}EFSWizard_Actions

    Comment

    Working...
    X