Announcement

Collapse
No announcement yet.

Open orders during back testing

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

  • Open orders during back testing

    I'm writing a back test study which uses the EFS broker functions to enter limit orders upon certain conditions which all works well. I'd like to add a time in force variable to the system that does something like if the limit order has not been filled within 3 bars then cancel. From looking at the EFS functions it doesn't seem like i can do this & might have to either code my own broker DLL or use something like DynaOrder(?)

    It's important to my strategy as otherwise the back test results are incorrect.

    Thanks in advance.

  • #2
    Hello eminitrader,

    The Strategy functions simply pass the trade information to the Strategy Analyzer. The logic that determines when a trade is sent to the Analyzer and at what price is determined by the code you create in your formula. The Strategy Analyzer does not maintain open orders and fills them at a later bar once a limit price has been reached for you. You need create this logic in your formula by using some global variables that track the current state of your trade signals. As each bar is processed you would look at a global flag that tells your formula you are looking to see that a specific limit price as been reached on that current bar being processed. You'll first check to see if the open of the bar has passed the limit price. If so, submit the trade using the open price for the limit parameter of the strategy function and reset your global flags. If not, then you need to look at the high or low of the bar to see if it has passed your limit price. If so, submit the trade using your limit price for the limit parameter of the strategy function. If not, do nothing and move to the next bar and test these conditions again. Hope this helps.
    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
      Ok thanks Jason.

      After reading a bit more last night i gathered that something like the method you described below would be needed.

      Originally posted by JasonK
      Hello eminitrader,

      The Strategy functions simply pass the trade information to the Strategy Analyzer. The logic that determines when a trade is sent to the Analyzer and at what price is determined by the code you create in your formula. The Strategy Analyzer does not maintain open orders and fills them at a later bar once a limit price has been reached for you. You need create this logic in your formula by using some global variables that track the current state of your trade signals. As each bar is processed you would look at a global flag that tells your formula you are looking to see that a specific limit price as been reached on that current bar being processed. You'll first check to see if the open of the bar has passed the limit price. If so, submit the trade using the open price for the limit parameter of the strategy function and reset your global flags. If not, then you need to look at the high or low of the bar to see if it has passed your limit price. If so, submit the trade using your limit price for the limit parameter of the strategy function. If not, do nothing and move to the next bar and test these conditions again. Hope this helps.

      Comment

      Working...
      X