TradeSgnl Logo
Docs
TradeSgnl Logo
Docs
Backtesting

Backtesting with TradeSgnl

Test and analyze your trading strategies with advanced risk management features.

Introduction

Backtesting is a critical process for evaluating trading strategies using historical data before risking real capital. The TradeSgnl EA offers powerful backtesting capabilities that allow you to:

Enhanced TradingView Strategies

Test TradingView strategies with advanced trade management features including trailing stops, pyramiding, and recovery systems

Versatile Signal Processing

Validate any CSV-based trading strategy from any source that can export to CSV format

Professional Performance Metrics

Gain insights through comprehensive statistics and interactive charts

Risk Management Optimization

Fine-tune stop loss, take profit, and position sizing settings for optimal performance

Unlike simple backtesting systems that only simulate basic entries and exits, the TradeSgnl backtesting system incorporates sophisticated trade management features that can significantly improve your strategy's performance.

Preparing Your CSV File

The TradeSgnl EA uses a CSV (Comma-Separated Values) file as input for backtesting. This file contains your trade signals, including entry and exit points. Here's how to create and format your file correctly.

Required columns:

  • Type — Values should be: ENTRY LONG, ENTRY SHORT, EXIT LONG, or EXIT SHORT (case-insensitive).
  • Date/Time — Preferred format: DD/MM/YYYY HH:MM:SS (e.g., 15/06/2023 10:00:00).

Optional column:

  • Comment — Use comments to categorize trades or differentiate between strategies.

The Comment field is extremely useful for:

  • Testing multiple variations of a strategy in a single backtest.
  • Separating data for different symbols or timeframes.
  • Filtering results in the analytics dashboard.

Sample CSV file format

Create a spreadsheet with the following columns and format:

TypeDate/TimeComment
ENTRY LONG15/06/2023 10:30:00MACD_Cross
EXIT LONG15/06/2023 14:45:00MACD_Cross
ENTRY SHORT16/06/2023 09:15:00MACD_Cross
EXIT SHORT16/06/2023 15:30:00MACD_Cross
ENTRY LONG17/06/2023 11:00:00RSI_Overbought
EXIT LONG17/06/2023 16:15:00RSI_Overbought

This example shows how the data would appear in spreadsheet software like Microsoft Excel or Google Sheets. We recommend using these tools to create and edit your files for simplicity, then saving them as CSV format when finished.

Exporting from TradingView

One of the most powerful features of the TradeSgnl backtesting system is the ability to take strategies developed in TradingView and enhance them with our advanced risk management features. Follow these steps to export your TradingView strategy results.

Create a strategy in TradingView

You have several options for creating your trading strategy:

  • Pine Script — Develop a custom strategy using TradingView's Pine Script language.
  • Built-in TradingView Strategies — Use TradingView's pre-built strategies and customize parameters.
  • TradeSgnl Strategy Builder — Use our intuitive strategy builder to create strategies without coding. Documentation.
TradingView Strategy Editor
TradingView Pine Script Editor with a simple strategy example

Run your strategy and export trade data

After creating your strategy, test it and export the results:

  • Add your strategy to the chart and adjust settings if needed.
  • Click on the Strategy Tester tab at the bottom of your chart.
  • In the Strategy Tester panel, click on the List of Trades tab.
  • Click on the strategy name dropdown on the top left of the panel.
  • Select Export data.
  • The file will be saved to your browser's default download location (typically the Downloads folder).
Exporting trades from TradingView
Exporting trade data from TradingView Strategy Tester

Format the exported file

The TradeSgnl EA is already optimized to work with TradingView's export format (as of May 25, 2024), so only minimal modifications are needed:

  • Open the downloaded file in Excel, Google Sheets, or another spreadsheet program.
  • Delete all sheets except for the List of Trades sheet.
  • In the List of Trades sheet, you can delete all columns except Type and Date/Time.
  • Optionally add a Comment column to categorize your trades. This is useful for identifying different strategies or testing variations.
  • Save the file as CSV format in your MetaTrader MQL5/Files folder (or specify a different location in the EA settings).
Converting TradingView Export to TradeSgnl Format
Example of minimal modifications needed for TradingView export
Saving as CSV format
Save the file in CSV format using the 'Save As' dialog

Testing multiple strategies together

To test how multiple strategies work together:

  • Export each strategy separately from TradingView.
  • Format each file as described above.
  • Add a Comment column to each file with a unique identifier for each strategy.
  • Combine all strategies into a single CSV file by copying and pasting the rows.
  • Make sure to maintain the column headers in the combined file.

Importing Your CSV File

The CSV file needs to be placed in a specific folder for the EA to find it. Follow these steps.

Open Data Folder from MT5

In MetaTrader 5, click on the File menu and select Open Data Folder.

Open Data Folder in MT5
Open Data Folder from the File menu in MT5

When the MQL5 folder opens, go up one directory level to the Terminal folder.

Navigate to Terminal Folder
Navigate up one level to the Terminal folder

Open Common/Files Folder and Place Your CSV

Inside the Terminal folder, open the Common folder, then open the Files folder. Copy your CSV files into this folder.

Common and Files Folders
Navigate to Common, then Files folder
Place CSV File in Files Folder
Place your CSV file in the Files folder

Setting Up MT5 Strategy Tester

After preparing your CSV file with trading signals and placing it in the correct folder, you're ready to set up and run your backtest with the TradeSgnl EA. Follow these steps to get actionable results.

Install and locate the TradeSgnl EA

If you haven't already installed the TradeSgnl EA, download it from your dashboard and install it in your MetaTrader 5 terminal. For detailed installation instructions, refer to our Setup Guide.

Open the Strategy Tester

In the Navigator panel on the left side of MT5, find the TradeSgnl EA under Expert Advisors. Right-click on it and select Test to open the Strategy Tester with the EA already selected.

Right-click on TradeSgnl EA and select Test
Right-click on TradeSgnl EA in Navigator and select 'Test'

Configure the Strategy Tester settings

In the Strategy Tester panel, configure the following settings:

  • Choose the symbol (currency pair) you want to test.
  • Set Model to Every tick for the most accurate results.
  • Select a date range that covers all trades in your CSV file.
MT5 Strategy Tester Configuration
Strategy Tester configuration with TradeSgnl EA selected

Go to the Inputs tab and enter your License ID

In the Strategy Tester panel, click on the Inputs tab. At the top, find the license_code parameter and enter your valid TradeSgnl license ID. This is required for backtesting to work.

Strategy Tester Inputs Tab with License ID
The Inputs tab where you enter your license ID

Configure backtesting parameters

Scroll down to the Backtesting Settings section and configure the following parameters:

  • CSV File Name — Enter the name of your CSV file without the extension (e.g., Trades for Trades.csv).
  • Exits from CSV — Set to true if you want to use exit signals from your CSV file, or false to use EA-managed exits.
  • Timezone Offset — Adjust the timezone offset if your CSV timestamps differ from your broker's server time.
Backtesting Parameters Configuration
Configure the backtesting parameters with your CSV file name

Run the backtest

Click Start to begin the backtest. The EA will validate your license, load your CSV file, and execute trades according to your signals. You'll see the equity curve forming in the Strategy Tester window.

When complete, the EA will automatically upload your results to the TradeSgnl portal for detailed analysis. You'll see a confirmation message in the MT5 journal.

Analyzing Results

Once your backtest is complete, TradeSgnl provides a comprehensive analytics dashboard where you can evaluate your strategy's performance. Access your results by logging into your TradeSgnl account and navigating to the Backtests section.

TradeSgnl Backtest Analytics Dashboard
The TradeSgnl backtest analytics dashboard with performance metrics and interactive charts

The dashboard provides powerful visualization tools to help you evaluate your strategy.

Key performance metrics:

  • Profitability metrics (net profit, profit factor).
  • Risk metrics (drawdown, Sharpe ratio).
  • Trade statistics (win rate, average trade).

Visual analysis tools:

  • Interactive equity and drawdown charts.
  • Trade distribution and performance by period.
  • Detailed trade-by-trade breakdown.

View Backtest Analytics

Best Practices and Tips

To get the most out of the TradeSgnl backtesting system, follow these best practices and tips.

Data quality:

  • Use high-quality historical data. Ensure your broker provides accurate tick data for best results.
  • Check CSV file format carefully. A single formatting error can affect the entire backtest.
  • Verify time zones. Ensure your CSV file time stamps match your MT5 data time zone.

Testing strategy:

  • Test across multiple time periods. Include bull, bear, and sideways markets.
  • Test multiple instruments. Verify your strategy works on different currency pairs or assets.
  • Use realistic settings. Avoid curve-fitting by using practical risk and money management settings.

Advanced optimization tips:

  • Risk Management Optimization. Test different combinations of stop loss and take profit levels to find the optimal risk-reward ratio for your strategy. The EA's advanced risk management features can dramatically improve a strategy's performance.
  • Trade Size Optimization. Experiment with different position sizing methods: fixed lot sizes vs. percentage-based risk. The latter often provides more consistent equity growth and better risk management.
  • Advanced Feature Combinations. Try different combinations of trailing stops, pyramiding, and recovery systems. Sometimes, the interaction between these features creates synergies that significantly enhance performance.

By combining TradingView's strategy building capabilities with the advanced trade management features of the TradeSgnl EA, you can create robust trading systems that would be impossible to implement in TradingView alone.

FAQ

Can I backtest multiple strategies in one CSV file?

Yes, you can use the "Comment" column in your CSV file to differentiate between strategies. Each trade entry can have a unique comment identifier, allowing you to filter and compare different strategies in the dashboard.

How accurate is the backtesting compared to live trading?

The backtesting system strives to be as realistic as possible, but there are inherent limitations. It uses historical data and assumes perfect execution of trades, which may differ from live market conditions. For the most accurate results, use "Every tick" mode in MT5's strategy tester and ensure your historical data is high quality.

What's the maximum number of trades I can backtest?

There is no hard limit on the number of trades, but extremely large datasets (tens of thousands of trades) may take longer to process and upload. For optimal performance, consider breaking very large backtests into smaller, manageable chunks.