Announcement

Collapse
No announcement yet.

Newbie Question About Backtesting

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

  • Newbie Question About Backtesting

    I've reviewed the help and online files and still can't seem figure something out.

    I wrote a study successfully - works like it should. But, when i put in to part for the stops and the target i keep getting a syntax error.

    Once the study triggers I want to put a 2 point stop in AND then close my short position out 9 bars later.

    Would someone please help me word this in the formula wizard?

    I would assume that i would have to have this -

    {{EFSWizard_Actions
    //{{EFSWizard_Action_1
    function onAction1() {
    Strategy.doShort("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    Strategy.setStop(2);
    Strategy.doCover("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    vLastAlert = 1;
    }

    It's what variables to put in these sections that I'm not sure of

    Thanks
    Jphillips
    Last edited by jphillips9; 05-19-2008, 01:07 PM.

  • #2
    Re: Newbie Question - How to set Stop & Target

    Jphillips
    You will not be able to do what you want using the Formula Wizard alone as the logic would require the use of global variables that the Formula Wizard cannot create. You need to write the logic using the Editor.
    If you run a search in these forums you will find several code examples of the logic you are trying to implement or at least similar enough that you can adapt to your needs with relative ease. In this post for example you can find a script that sets a stop and a target price for use with a strategy. In this other thread you can find a script that will close a trade after a defined number of days/bars.
    Also you may want to review the Back Testing Tutorials 1-3 which are provided in the Help Guides and Tutorials-> Beginner Tutorials folder of the EFS KnowledgeBase. These tutorials will provide you with most of the information (including detailed code examples) required to set up a back testing strategy
    Alex


    Originally posted by jphillips9
    I've reviewed the help and online files and still can't seem figure something out.

    I wrote a study successfully - works like it should. But, when i put in to part for the stops and the target i keep getting a syntax error.

    Once the study triggers I want to put a 2 point stop in AND then close my short position out 9 bars later.

    Would someone please help me word this in the formula wizard?

    I would assume that i would have to have this -

    {{EFSWizard_Actions
    //{{EFSWizard_Action_1
    function onAction1() {
    Strategy.doShort("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    Strategy.setStop(2);
    Strategy.doCover("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    vLastAlert = 1;
    }

    It's what variables to put in these sections that I'm not sure of

    Thanks
    Jphillips

    Comment


    • #3
      Thank You Alex

      Comment


      • #4
        Jphillips
        You are most welcome
        Alex


        Originally posted by jphillips9
        Thank You Alex

        Comment

        Working...
        X