Announcement

Collapse
No announcement yet.

I need help created an EFS Back-test

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

  • I need help created an EFS Back-test

    Hi!

    I want to back test a certain price pattern based on bar formation alone and I need some help with that as I'm baffled as to how to do this by myself.

    Something of this nature for exampe (this is not my strategy) :

    IF 1st bar closes at least 10 ticks below open and 2nd bar goes below low of 1st bar by at least 1 tick and then closes at least 10 ticks above open, go Long.

    Can anyone help me do something of that sort?

    Much appreciated!

    Dana B.

  • #2
    Here is a basic way to do what you described in your example. I did not add any buy/sell code for entry/exit though.

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


    //{{EFSWizard_Declarations
    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(-1) < open(-1) - .10 &&
                
    low() < low(-1) &&
                
    close() > open() + .10
            
    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() {
            
    drawShapeRelative(0low(), Shape.CIRCLE""Color.RGB(0,255,255), Shape.BOTTOM);
            
    vLastAlert 1;
        }
        
    //}}EFSWizard_Action_1
        
    //}}EFSWizard_Actions 
    Attached Files
    Excellent book on JavaScript for beginners

    Comment


    • #3
      This would use your example to get you long at market for the open of the next bar once the strategy was true. Then is would use the exact opposite strategy to get you out.

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


      //{{EFSWizard_Declarations
      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(-1) < open(-1) - .10 &&
                  
      low() < low(-1) &&
                  
      close() > open() + .10
              
      onAction1()
          
      //}}EFSWizard_Expression_1
          
          //{{EFSWizard_Expression_2
              
      else if (
                  
      open(-1) < close(-1) + .10 &&
                  
      high() < high(-1) &&
                  
      close() < open() - .10
              
      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 != 1drawShapeRelative(0low(), Shape.UPARROW""Color.RGB(0,255,0), Shape.BOTTOM);
              if (
      vLastAlert != 1Strategy.doLong(""Strategy.MARKETStrategy.NEXTBARStrategy.DEFAULT, 0);
              
      vLastAlert 1;
          }
          
      //}}EFSWizard_Action_1
          
          //{{EFSWizard_Action_2
          
      function onAction2() {
              if (
      vLastAlert != 2drawShapeRelative(0high(), Shape.DOWNARROW""Color.RGB(255,0,0), Shape.TOP);
              if (
      vLastAlert != 2Strategy.doSell(""Strategy.MARKETStrategy.NEXTBARStrategy.DEFAULT, 0);
              
      vLastAlert 2;
          }
          
      //}}EFSWizard_Action_2
          
      //}}EFSWizard_Actions 
      Attached Files
      Excellent book on JavaScript for beginners

      Comment


      • #4
        FibbGann!

        Thank you so much for replying...

        well, you have proved to me that it is possible.. however, it hasn't really gotten me any closer by even a bit to being able to apply it by myself.

        I understand the concept, but my actual strategy is a bit different and it involves futures, so I'm not sure how to adjust tick value in the coding for that.
        If you can create me a complete EFS Code for that, I would be grateful for life (Only if it's not much of a hassle on your part)!

        What I need is this: First, I'm talking about AB #F (Russell 2000 Cont. Futures Contract):

        1st bar must close at least 6 ticks below open. 2nd bar must go below low of 1st bar (including tail, not just body of bar), and then close 4 ticks or less from open (doesn't matter whether above or below open). 3rd bar must go higher than 2nd bar (including tail, not just body of bar) and close 6 ticks at least above its open. that's basically the pattern for long. Vice versa on all accounts for short.

        Thank you!

        Dana B.
        Last edited by dberliner; 06-24-2007, 06:06 AM.

        Comment


        • #5
          dberliner,

          Do you have any knowledge of how the formula wizard works?
          Excellent book on JavaScript for beginners

          Comment


          • #6
            Just remeber when trying to apply ticks to futures you just change your numbers based on the tick differences.

            If your excluding the spread. This can be seen in 2 ways.

            A tick on stocks in basic terms would be one penny.

            .01

            A tick on the Russel E-mini would be

            .10

            .60 would be 6 ticks

            A tick on the E-mini Dow would be

            1.00

            6.00 would be 6 ticks

            A tick on the S&P 500 Emini would be

            .25

            1.50 would be 6 ticks

            and so on....

            NOTE: The YM, AB and stocks normally have wider spreads.
            So you would need to define wether your wanting actual ticks or actual price change.
            Excellent book on JavaScript for beginners

            Comment


            • #7
              Here is what you described.

              Although your basic concept is a great place to start, your specific criteria can cause some poor results. Using the exact opposite for exits of longs are show poor results. Depending on what your trying to accomplish on the trade time length and amount of trades I would maybe go with an exit of 2 consecutive lows.

              Here you go.

              Should work ok, but I could'nt test it on the futures for I do not have them on esignal. I did test it on the IWM though by modifying the tick adjustments.

              I would also suggest adding a stop below/above the low/high of the previous bar of entry. This would keep you out of big losses and improve you P/L outcome.
              Attached Files
              Last edited by FibbGann; 06-24-2007, 01:29 PM.
              Excellent book on JavaScript for beginners

              Comment


              • #8
                FibbGann,

                I don't have time to test this right now.. but I can not express in words how thankful I am. Really! looks like others have downloaded this too, so maybe you've managed to help some other people as well !


                Again, Thanks for your help.

                P.S.

                As to your question: no, I have no knowledge of using the formula wizard, I'm sorry if that was the impression.. that is why I needed the help!


                Another note: it seems like some valid patterns are not "arrowed" ... I'll check the code and see what I can do about it.
                Last edited by dberliner; 06-24-2007, 02:55 PM.

                Comment


                • #9
                  Your welcome and thanks.

                  The code provided should be exact to the guidlines you provided.

                  1st bar must close at least 6 ticks below open. 2nd bar must go below low of 1st bar (including tail, not just body of bar), and then close 4 ticks or less from open (doesn't matter whether above or below open). 3rd bar must go higher than 2nd bar (including tail, not just body of bar) and close 6 ticks at least above its open. that's basically the pattern for long. Vice versa on all accounts for short.
                  Excellent book on JavaScript for beginners

                  Comment

                  Working...
                  X