Understanding the Backtest on MetaTrader
Understanding the Backtest on MetaTrader
Understanding the Backtest on MetaTrader
1. Net Profit
Definition: The total profit or loss generated by the strategy over the
testing period, considering all winning and losing trades.
Calculation:
Net Profit=Total Profit−Total Loss\text{Net Profit} = \text{Total Profit} - \
text{Total Loss}Net Profit=Total Profit−Total Loss
Relevance: A positive net profit is the ultimate goal of any trading
strategy. However, it alone doesn't tell you much about the risk involved
or consistency.
2. Profit Factor
Definition: The ratio of gross profit to gross loss, which gives an idea of
how many times the profit exceeds the loss.
Calculation:
Profit Factor=Gross ProfitGross Loss\text{Profit Factor} = \frac{\
text{Gross Profit}}{\text{Gross Loss}}Profit Factor=Gross LossGross Profit
Relevance:
o A Profit Factor > 1 means the strategy is profitable.
o A Profit Factor < 1 indicates a losing strategy.
o A Profit Factor of 2 means that for every dollar lost, two dollars
are gained.
Correlation: Higher profit factor generally correlates with a more
favorable risk/reward profile, but it does not account for how those
profits are achieved (e.g., frequency of winning trades).
3. Win Rate (Winning Trades %)
Definition: The percentage of trades that ended in profit.
Calculation:
Win Rate=Number of Winning TradesTotal Number of Trades×100\
text{Win Rate} = \frac{\text{Number of Winning Trades}}{\text{Total
Number of Trades}} \times
100Win Rate=Total Number of TradesNumber of Winning Trades×100
Relevance:
o A high win rate doesn’t necessarily mean high profitability, as the
size of winning trades compared to losing trades also matters.
Correlation: A higher win rate often correlates with a lower risk of
consecutive losing trades, but it may not always lead to a high net profit
if the losses outweigh the gains.
4. Expected Payoff
Definition: The average profit or loss per trade, factoring in both winning
and losing trades.
Calculation:
Expected Payoff=Net ProfitTotal Number of Trades\text{Expected Payoff}
= \frac{\text{Net Profit}}{\text{Total Number of
Trades}}Expected Payoff=Total Number of TradesNet Profit
Relevance:
o This metric shows the average value of each trade, regardless of
whether it's a win or loss. If positive, the strategy tends to be
profitable over time.
Correlation: Strategies with a high expected payoff may still have low
win rates, as a few large wins can outweigh many small losses.
5. Sharpe Ratio
Definition: The Sharpe Ratio measures the risk-adjusted return, i.e., how
much excess return (over a risk-free rate) the strategy generates per unit
of risk (volatility).
Calculation:
Sharpe Ratio=Average Return - Risk-Free RateStandard Deviation of Retur
ns\text{Sharpe Ratio} = \frac{\text{Average Return - Risk-Free Rate}}{\
text{Standard Deviation of
Returns}}Sharpe Ratio=Standard Deviation of ReturnsAverage Return - Ri
sk-Free Rate
Relevance:
o A higher Sharpe Ratio indicates a better risk-adjusted return,
meaning the strategy is more efficient in converting risk into
return.
o A Sharpe Ratio > 1 is typically considered good; >2 is very good,
and >3 is excellent.
Correlation: Strategies with a higher Sharpe Ratio tend to have lower
volatility (risk), meaning profits are achieved with less variance in
returns.
6. Drawdown
Definition: The largest peak-to-valley decline in the account balance
during the testing period, showing the maximum percentage or dollar
amount lost from the highest point.
Types:
o Absolute Drawdown: The difference between the initial deposit
and the lowest point in the balance.
o Relative Drawdown: The maximum percentage drop from the
highest point of the equity.
o Maximal Drawdown: The maximum observed loss from a peak to
a trough of a portfolio, before a new peak is achieved.
Relevance:
o Drawdown represents risk. A strategy with a high drawdown may
still be profitable, but it could require a larger account balance to
avoid margin calls or total losses.
Correlation: A lower drawdown typically correlates with less risk and
higher consistency, but some high-risk strategies with large drawdowns
may offer substantial profits as well.
7. Recovery Factor
Definition: The ratio of net profit to maximum drawdown, showing how
well the strategy recovers from losses.
Calculation:
Recovery Factor=Net ProfitMaximal Drawdown\text{Recovery Factor} = \
frac{\text{Net Profit}}{\text{Maximal
Drawdown}}Recovery Factor=Maximal DrawdownNet Profit
Relevance:
o A higher recovery factor means the strategy is able to recover
from drawdowns effectively.
Correlation: Strategies with a high recovery factor tend to have low
drawdowns or strong recoveries after losses.
8. R-Squared (R²)
Definition: A statistical measure that shows how close the data is to the
fitted regression line (used in equity curve analysis). It ranges from 0 to
1.
Relevance:
o An R² close to 1 indicates that the equity curve follows a linear
trend, meaning the strategy produces steady returns.
o An R² close to 0 indicates high variability in returns.
Correlation: High R² correlates with a smoother equity curve and
indicates less randomness in performance.
9. Z-Score
Definition: Z-Score measures the likelihood that the winning and losing
trades are random. It helps in determining if the strategy is based on
chance or has a statistical edge.
Relevance:
o A Z-Score close to 0 means that wins and losses are random.
o A positive or negative Z-Score indicates non-random patterns in
trade results, which could suggest consistency in strategy
performance.
Correlation: A non-random Z-Score can indicate that a strategy has an
edge or systematic pattern.
10. Trades (Total Trades Count)
Definition: The total number of trades executed during the backtesting
period.
Relevance:
o A higher number of trades offers more data points for
performance evaluation and statistical reliability.
o A small number of trades may not give an accurate picture of a
strategy’s long-term viability.
Correlation: More trades increase the reliability of other statistics like
win rate, Sharpe ratio, and profit factor.
11. Average Trade Duration
Definition: The average time a trade is held open, calculated across all
trades.
Relevance:
o Provides insight into whether the strategy is short-term (scalping)
or long-term (swing or position trading).
Correlation: This can affect your trading costs, slippage, and the overall
drawdown profile. Shorter trade durations might be correlated with
higher trade frequency and possibly higher trading costs.
12. Standard Deviation of Returns (Volatility)
Definition: The standard deviation of the daily returns of the strategy,
representing its volatility.
Relevance:
o Higher standard deviation indicates more risk and fluctuations in
performance.
Correlation: A lower standard deviation (volatility) typically leads to a
higher Sharpe Ratio, as returns are more consistent.
13. Expected Recovery Time
Definition: This is the expected time for the strategy to recover from a
drawdown.
Relevance:
o Shows the resilience of the strategy and its ability to bounce back
from losing streaks.
Correlation: It correlates with the drawdown and recovery factor,
indicating how long it may take to recover from the worst-case scenario.
14. Average Win / Average Loss
Definition: The average profit from winning trades compared to the
average loss from losing trades.
Relevance:
o Provides insight into the reward-to-risk ratio of individual trades.
Correlation: A higher average win-to-loss ratio, combined with a decent
win rate, generally results in profitability.
Trade Breakdown
23.Total Trades (125)
The total number of trades taken by the strategy during the backtest.
24.Short Trades (won %) (68 trades, 69.12%)
The number and percentage of short trades that were profitable. 68
short trades were taken, and 69.12% were winners.
25.Long Trades (won %) (57 trades, 50.88%)
The number and percentage of long trades that were profitable. 57 long
trades were taken, and 50.88% were winners.
26.Profit Trades (76 or 60.80%)
The total number and percentage of trades that were profitable. Out of
125 trades, 76 trades were profitable, giving a win rate of 60.80%.
27.Loss Trades (49 or 39.20%)
The total number and percentage of losing trades.
Graphical Representations
Entries by Hours (Asia, Europe, USA):
o This chart shows the number of trades entered based on the hour
of the day. It seems most entries occur during specific trading
hours (likely when the market is most active).
Entries by Weekdays:
o This chart shows the distribution of trades throughout the week,
with Tuesday and Wednesday seeing the highest number of
trades.
Entries by Months:
o This chart shows the distribution of trades by month, providing a
historical view of trade frequency across months.
Profits and Losses by Hours:
o A breakdown of profits and losses per hour, indicating which hours
of the day are most profitable.
Profits and Losses by Weekdays:
o A breakdown of profits and losses by weekday, showing which
days contribute most to the overall performance.
Profits and Losses by Months:
o A monthly breakdown of profits and losses, indicating which
months performed better or worse during the backtest period.