Consulting

Results 1 to 3 of 3

Thread: Backtesting futures using VBA

  1. #1

    Backtesting futures using VBA

    I'm brand new to using Excel VBA. I've been having trouble with finding a platform/service that allows me to have accurate backtesting results. I notice that the results for profit are skewed because the entry and exit prices are both incorrect. I've been importing historical data (Open, High, Low and Close) onto Excel and manually calculating profit for quite some time now. This is incredibly tedious and time consuming. I want a more efficient way to do this.

    The backtesting strategies I've developed aren't based on moving averages or crossovers. Just simple patterns that I've come up with. The strategy is pretty simple.

    • There must be a series of at least three rising 'low' values in consecutive order. (This would be in column D)
    • The last 'low' of the rising series must be greater than the proceeding low. (The following is a link is a picture to better illustrate what I'm talking about) https://ninjatrader.com/support/foru...tch?id=1079661


    In regards to price entry and exit. The price entry would be the 'low' of the last of the rising 'low' series and the price exit would be the 'close' value of the day that follows the end of the rising 'low' series. (The link above shows the entry and exits labeled in orange.)

    I've coded for the strategy before, but I'm having trouble achieving accurate profit results when it comes to backtesting.

    Any advice/help would be greatly appreciated!

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    How do you tell the 'close' value of the day from the end of the rising 'low' series. Your NinjaTrader image makes no sense to me.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    Quote Originally Posted by SamT View Post
    How do you tell the 'close' value of the day from the end of the rising 'low' series. Your NinjaTrader image makes no sense to me.
    I thought it was a diagram of where to moor your boat at the docks


    @whitekodak -- Can you attach a sample workbook with some (just a little) data, and the results of manually calculating to help validate the VBA results?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •