Announcement

Collapse
No announcement yet.

Strategie definitions

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

  • Strategie definitions

    I have following question:

    Here is a part of my EFS trading system and the rules are:

    1) If L1 is true enter a long position
    2) If S1 is true close the long position
    3) If S1 and S2 is true a short shall be entered

    *********EFS system start************************
    PHP Code:
    //if long and S1 = true, exit long and if S2 = true, enter short
        
    if (Strategy.isLong()) {
            if (
    bCondS1) {
                
    exit_long(open());
                if (
    bCondS2enter_short(open());
            }
        }
        
    //if flat or short and L1 = true, enter long

        
    else if (bCondL1) {
            if (
    Strategy.isShort()) exit_short(open());
            
    enter_long(open());
        }
        
    //if flat and S1,S2 = true, enter short
        
    else  if (Strategy.isInTrade() == false) {
            if (
    bCondS1 && bCondS2) {       
            
    enter_short(open());
            }
        } 
    ****************EFS system end********************

    Somebody told me that this is logically incorrect. Would be great is you could take a look on this

    Best regards
    Achim

  • #2
    Hello Achim,

    As far as the code logic is concerned, the snippet of back testing code that you have posted should execute each of the three items you've listed, but only for back testing with the Strategy Analyzer. I'm assuming that your code logic that sets the values for your Boolean variables used in the conditions is also correct. I'm assuming also that the user-defined functions, enter_long(), enter_short(), exit_long() and exit_short() are properly coded. Strategy functions should not be used for real time analysis, which may be what that person was referring to.

    The best way for you to know if your back testing code logic is performing as you've intended is to run the back test and then analyze each reported trade in the Strategy Analyzer against the chart data the test was performed on.
    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