Announcement

Collapse
No announcement yet.

EFS study help

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

  • EFS study help

    I managed to get an efs study to show stochastic crossovers over the 80,below 20 threshold with an alert sound and circle on top/bottom on the chart, but for some reason, it doesn't draw a circle over the overbought crossovers(over 80). Would like to somehow put in a code to reset once it goes below the 80, above 20 threshold. Alerts should be left the same.

    Thanks in advance
    Here's the study, any help would be appreciated. Im gonna put both the file and the language up

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


    //{{EFSWizard_Declarations
    var vStoch14_3 = new StochStudy(14, 3, 3);
    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("Stochastic Crossover");
    //}}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 (
    vStoch14_3.getValue(StochStudy.FAST) > 80 &&
    vStoch14_3.getValue(StochStudy.SLOW) > 80 &&
    vStoch14_3.getValue(StochStudy.FAST) < vStoch14_3.getValue(StochStudy.SLOW)
    ) onAction1()
    //}}EFSWizard_Expression_1

    //{{EFSWizard_Expression_2
    else if (
    vStoch14_3.getValue(StochStudy.FAST) < 20 &&
    vStoch14_3.getValue(StochStudy.SLOW) < 20 &&
    vStoch14_3.getValue(StochStudy.FAST) > vStoch14_3.getValue(StochStudy.SLOW)
    ) 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() {
    if (vLastAlert != 1) Alert.addToList(getSymbol(), "Overbought Crossover", Color.RGB(0,0,0), Color.RGB(195,0,0));
    if (vLastAlert != 1) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Ding.wav");
    if (vLastAlert != 1) drawShapeRelative(0, high(), Shape.CIRCLE, "", Color.RGB(255,255,0), Shape.LEFT);
    ;
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //{{EFSWizard_Action_2
    function onAction2() {
    if (vLastAlert != 2) Alert.addToList(getSymbol(), "Oversold Crossover", Color.RGB(0,0,0), Color.RGB(0,255,0));
    if (vLastAlert != 2) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Ding.wav");
    if (vLastAlert != 2) drawShapeRelative(0, low(), Shape.CIRCLE, "", Color.RGB(0,255,0), Shape.BOTTOM);
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2

    //}}EFSWizard_Actions
    Attached Files
    Last edited by franky; 03-09-2007, 11:01 AM.

  • #2
    Hello franky,

    There are two things you need to add to accomplish your task.

    1. In Set 1 and Set 2 edit the drawShapeRelative() calls and add a tagName parameter by typing in rawtime(0). This gives each bar's shape that gets drawn a unique ID so that it can be removed later if need be.



    2. Add a new condition in Set 3 that looks for the .FAST to be below 80 and above 20. When this condition is true remove the shape with the removeShape(rawtime(0)) function, which you will also need to type in.

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      thanks. Its picking up on alot of signals that it was missing before. I was wandering if i could add another extra feature to this study as an enhancement. It basically looks for a divergence. The parameters are the same as before, but this alert looks for a buy crossover(crossover below 20), goes above the 20 line, crossover back below the 50 line(but must be above the 30 line), and this time another crossover below the 20 line. the difference here is that the buy signal would only occur if it gives aq crossover signal that occurs above the previous crossover signal. All of this would be one alert. The same for overbought conditions(crossover above 80 goes back down to 50, returns and does another crossover below the previous one)
      i'm going to attach a chart to show what i mean. The blue line is the 50 line, the yellow lines shows the divergence.
      Attached Files

      Comment


      • #4
        Hello franky,

        You're most welcome.

        The new formula you are describing should be possible, but I don't think the formula wizard can be used for this one. You will need to code this one through the EFS Editor. If you are not familiar with programming in JavaScript, which is the foundation for EFS, and would like to start learning, please visit the resources below my signature.

        After you start coding your study and you run into specific programming issues that you need help with, post your code and details to the EFS Studies forum.
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment


        • #5
          Will definitely do that. I have one last simple question till i figure it out. I wanted to add one last small detail to this trigger, which should easily be done even with the formula wizrad, but it doesn't give this indicator as an option from the list of builtin indicators. Just wanted to add, look for volume to be above 50MA average volume with this crossover trigger(the volume ma did come with esignal, in the library folder) .

          Thanks again

          Comment


          • #6
            Hello franky,

            To add that condition you first need to set up the vSMA50_of_Volume study using the built-in MAStudy(). Set the price source for the MAStudy to "Volume."



            Then in the condition you use the volume() function under the "Globals" list. Click on "Edit" to bring up your choices. Then compare it to the ma of volume study like below.

            Jason K.
            Project Manager
            eSignal - an Interactive Data company

            EFS KnowledgeBase
            JavaScript for EFS Video Series
            EFS Beginner Tutorial Series
            EFS Glossary
            Custom EFS Development Policy

            New User Orientation

            Comment

            Working...
            X