Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to backtest a MTF strategy

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

    How to backtest a MTF strategy

    I have a strategy that runs on M2 as its main chart. My strategy uses some indicators, including my custom indicators, on M2 and M5 and M10. I use AddDataSeries to add a 1 tick series (for orders) and I also add M5 and M10 as additional data series.

    Now I would like to backtest the strategy. I do not need links to sample code, I believe my code is implemented properly. I just need to know what settings to select in Strategy Analyzer for backtesting my MTF strategy. Currently I am using these settings:

    Data Series:
    Instrument: (My instrument, currently m6e)
    Price Based on: Last
    Type: Minute
    Value: 2
    Time Frame:
    Start Date: 01/01/2020
    End Date: 01/23/2020
    Trading Hours: Use Instrument
    Break at EOD: checked
    Setup:
    Include commission: unchecked
    Maximum bars lookback: 256
    Bars required to trade: 20
    Historical fill processing:
    Order fill resolution: Standard: (fastest)
    Fill limit orders on touch: unchecked
    Slippage: 0
    Order Handling
    Entries Per Direction: 1
    Entry Handling: All entries
    Exit on Session Close: checked
    Order Properties:
    Set Order Quantity: Strategy
    Time in Force: GTC

    Are these settings correct? I am not getting the results I expected. Please advise.

    #2
    Originally posted by westofpluto View Post
    Are these settings correct?
    Well, unless you get an error, they are, strictly speaking, not wrong.

    But knowing if they are correct for your strategy is another issue.

    Originally posted by westofpluto View Post
    I believe my code is implemented properly.
    And just how do you know that?

    Originally posted by westofpluto View Post
    I am not getting the results I expected. Please advise.
    Have you added a ton Print statements to prove everything is correct?
    Have you stepped through every line of code in Visual Studio?

    What are the results you expect?
    What are the results you are getting?

    I advise you to go back into your code and add Print statements
    to prove everything is correct, that all values are as expected, and
    that all code paths for all BarsInProgress values are taken as expected.

    I have never seen an issue that couldn't be solved using some very well
    placed Print statements.

    Some additional thoughts:

    Do you have all the Tick & Minute historical data for M6E for the period,
    Start Date: 01/01/2020
    End Date: 01/23/2020
    already downloaded?

    Does your Strategy do its own AddDataSeries for every data series your
    indicators are adding under the hood?

    Comment


      #3
      Hello westofpluto,

      If the results are not what you expect, it is necessary to enable TraceOrders and use prints to understand the behavior.

      Enable TraceOrders, print all values used in the conditions that place orders along with the time of the bar, print the order object in OnOrderUpdate().

      Below is a link to a forum post that demonstrates how to use prints to understand behavior.
      https://ninjatrader.com/support/foru...121#post791121

      With the information the script is using, you can use this to understand why an order was or was not placed at a specific time you are expecting.

      Save the output from the output window (right-click, Save As) to a text file and include this with your next post.
      I would be happy to assist with analyzing the output.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Jorge.andres.o, Today, 08:05 PM
      0 responses
      1 view
      0 likes
      Last Post Jorge.andres.o  
      Started by SuperDriveGuy, 10-23-2019, 07:13 AM
      23 responses
      1,346 views
      0 likes
      Last Post wadams
      by wadams
       
      Started by lmatiukas, Today, 07:09 PM
      1 response
      6 views
      0 likes
      Last Post lmatiukas  
      Started by ComfyCouch, Today, 06:04 PM
      0 responses
      15 views
      0 likes
      Last Post ComfyCouch  
      Started by Ousher, Today, 04:35 PM
      0 responses
      4 views
      0 likes
      Last Post Ousher
      by Ousher
       
      Working...
      X