Backtesting Futures Strategy

Tyler

Last Update 20 วันที่แล้ว

Introduction

In this tutorial, we’ll walk through how to backtest a futures strategy by downloading it from the Prop Farming Leaderboard and importing it into NinjaTrader. This will help you assess the effectiveness of strategies before applying them to live trading or challenges.

Step 1: Navigate to the Prop Farming Leaderboard


  1. Go to the Prop Farming Leaderboard.
  2. Switch from the default Forex page to Futures by selecting the appropriate tab.
  3. Browse the strategies uploaded to the leaderboard. New strategies are uploaded frequently; in this example, we’ll test a strategy uploaded on August 2nd.

Step 2: Download the Strategy

  1. Once you’ve chosen a strategy from the leaderboard, click the file folder icon to download it.
  2. Copy the file by right-clicking on it and selecting Copy.
  3. Go to your VPS where NinjaTrader and Rhythmic are installed.
  4. Paste the strategy file into the Downloads folder on your VPS. This folder is accessible through the file explorer in your VPS setup.

Step 3: Import the Strategy into NinjaTrader

  1. Open NinjaTrader and ensure you are connected to the platform. The connection status is indicated by a green circle in the lower-left corner. If you are not connected, go to Connections in the NinjaTrader menu and select your connection (e.g., TopStep).
  2. Navigate to Tools in the NinjaTrader menu and select Import > NinjaScript Add-On.
  3. Scroll down to the downloaded strategy file, highlight it, and click Open.
  4. A confirmation message will appear once the strategy is successfully imported. Click OK to proceed.

Step 4: Set Up the Strategy Analyzer

  1. In NinjaTrader, go to the Accounts tab and click on New > Strategy Analyzer.
  2. In the Strategy Analyzer, select the strategy you imported by hovering over Blue Edge Financial and locating the strategy name (e.g., PrimRat Grow).
  3. You do not need to input your email address for backtesting purposes.

Step 5: Configure the Backtest Settings

  1. Target Account Balance: Set the target account balance to all 9s (999999) to ensure the backtest runs for the full year.
  2. Base Lot Size: The default base lot size may be set to 3, but reducing it to 1 often improves performance. You can experiment with base lot sizes of 2 and 1 to compare results.
  3. Instrument Selection: Choose the appropriate instrument for the strategy. In this example, the strategy is set for the NQ (Nasdaq futures) instrument.
  4. Time Frame: Select the time frame you want to test. In this case, we’re backtesting from the start of the year until today.
  5. Data Series: Set the time interval to 40 seconds since the strategy is designed for this time frame.

Step 6: Run the Backtest

  1. Once all settings are configured, click Run to start the backtest. The process will only take a few moments.
  2. After completion, you’ll be able to review the results.

Step 7: Review the Results

  1. Profit Factor: Look at the profit factor to evaluate the strategy’s effectiveness. A good profit factor is typically above 1.75. In this example, the initial profit factor is 1.28, which is acceptable but not outstanding.
  2. Percent Profitable: This shows how often the strategy generated a profit. A value of 57% was observed here.
  3. Profit Curve: Under the Analysis tab, you can view the profit curve to see how the strategy performed over time.

Step 8: Experiment with Base Lot Sizes

  1. Modify the base lot size and rerun the test to see if performance improves. Reducing the base lot size from 3 to 2 improved the results slightly.
  2. Testing with a base lot size of 1 often yields better results. In this case, it increased the profit factor to 1.51, and the percent profitable rose to 60.5%.

Additional Tips

  • Contract Selection: The results of backtesting can vary based on the contract being tested. For example, testing on the August contract may yield better results than the December contract if fewer traders are using the latter.
  • Regularly testing across different contracts and configurations can help optimize performance.

Conclusion

By following this tutorial, you can efficiently download, import, and backtest futures strategies in NinjaTrader using data from the Prop Farming Leaderboard. This method allows you to evaluate strategies before applying them to live trading, ensuring they align with your goals.


Backtesting is a valuable tool in identifying the most effective strategies, so be sure to test various configurations and settings to maximize performance!

Was this article helpful?

0 out of 0 liked this article

Still need help? Message Us