Understanding the Backtest on MetaTrader

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Understanding the Backtest on Meta Trader

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.

How Metrics Correlate


1. Net Profit vs Profit Factor vs Win Rate:
o A strategy can have a low win rate but still be profitable if the
profit factor is high (i.e., large wins and small losses).
o Conversely, a high win rate might not be profitable if the losses are
larger than the wins.
2. Sharpe Ratio vs Drawdown:
o A strategy with a high Sharpe Ratio typically has lower drawdowns
because it generates returns with less volatility.
3. Profit Factor vs Expected Payoff:
o A higher profit factor often correlates with a higher expected
payoff, but a low number of trades can skew the profit factor,
making it unreliable for strategies with few trades.
4. Drawdown vs Recovery Factor:
o Strategies with low drawdown and a high recovery factor are
considered robust because they can generate profits while
recovering quickly from any losses.
5. Z-Score vs Win Rate:
o A non-random Z-Score suggests that the win rate is consistent and
not due to chance.
Upper Section: Performance Metrics
1. History Quality (100%)
o This shows the quality of the historical data used for the backtest.
100% indicates the highest accuracy of the data, meaning the
results are reliable based on the historical price feed.
2. Bars (9758)
o The total number of bars (candlesticks) used in the backtest.
3. Ticks (23020935)
o The total number of ticks (price changes) processed during the
backtest.
4. Initial Deposit (1,000)
o The starting balance of the account in the backtest.
5. Total Net Profit (1,939.20)
o The net profit earned from the trading strategy, which is the
difference between the total profit and total loss.
6. Gross Profit (4,117.05)
o The sum of all the profits generated from winning trades.
7. Gross Loss (-2,177.85)
o The sum of all the losses from losing trades.
8. Balance Drawdown Absolute (0.00)
o The difference between the initial deposit and the lowest balance
during the backtest.
9. Balance Drawdown Max (259.03 or 9.71%)
o The maximum loss in terms of balance during the backtest in both
absolute value (259.03) and percentage (9.71%).
10.Balance Drawdown Relative (11.43% or 153.8)
 The maximum percentage drawdown relative to the highest point of the
balance.
11.Equity Drawdown Absolute (44.75)
 The absolute amount by which equity fell from its highest value during
the backtest.
12.Equity Drawdown Max (329.09 or 12.17%)
 The largest equity drop in absolute (329.09) and percentage (12.17%)
terms during the backtest.
13.Equity Drawdown Relative (17.08% or 242.60)
 The relative drop in equity from the peak in percentage and absolute
terms.

Profitability and Risk Metrics


14.Profit Factor (1.89)
 The ratio of gross profit to gross loss, indicating the profitability of the
strategy. A value of 1.89 means the profit is 1.89 times larger than the
losses.
15.Expected Payoff (15.51)
 The average profit or loss per trade. Each trade is expected to earn 15.51
units of currency.
16.Recovery Factor (5.89)
 The ratio of net profit to the maximum drawdown. A recovery factor of
5.89 indicates a solid ability of the strategy to recover from drawdowns.
17.Sharpe Ratio (25.18)
 This is the risk-adjusted return, showing that the strategy provides
significant returns per unit of risk. A Sharpe Ratio above 1 is good, and
25.18 is very high, suggesting excellent performance with low risk.
18.Z-Score (-0.02 or 1.60%)
 A Z-Score close to zero indicates that the winning and losing trades are
fairly random. The percentage here suggests a small edge in the strategy
but not substantial.
19.AHPR (1.0091 or 0.91%)
 Annualized Holding Period Return. A value of 1.0091 means the strategy
grows at about 0.91% annually on average.
20.GHPR (1.0087 or 0.87%)
 Geometric Holding Period Return. It measures the compound growth
rate of the strategy, showing an average annual growth of about 0.87%.
21.LR Correlation (0.92)
 Linear regression correlation indicates how closely the equity curve
follows a linear trend. A value of 0.92 means a strong linear relationship,
implying smooth equity growth.
22.LR Standard Error (222.55)
 This measures the deviation from the regression line. A lower value
would indicate a more consistent strategy.

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.

Profit and Loss Metrics


28.Largest Profit Trade (84.19)
 The most profitable trade earned 84.19 units of currency.
29.Largest Loss Trade (-62.68)
 The largest loss incurred on a single trade was -62.68 units.
30.Average Profit Trade (54.17)
 The average profit per winning trade was 54.17 units.
31.Average Loss Trade (-44.45)
 The average loss per losing trade was -44.45 units.
32.Maximum Consecutive Wins (8, 385.96)
 The highest number of consecutive winning trades was 8, with a total
profit of 385.96.
33.Maximum Consecutive Losses (4, -249.59)
 The highest number of consecutive losing trades was 4, with a total loss
of -249.59.
34.Maximal Consecutive Profit ($) (8, 385.96)
 The maximum consecutive profit over 8 trades was 385.96 units.
35.Maximal Consecutive Loss (Count) (-249.59)
 The maximal loss over consecutive losing trades amounted to -249.59
units.
36.Average Consecutive Wins (3)
 On average, the strategy had 3 consecutive wins.
37.Average Consecutive Losses (2)
 On average, the strategy had 2 consecutive losses.

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.

Summary of Key Insights:


 Profitability: The strategy is profitable with a Net Profit of 1,939.20 and a
Profit Factor of 1.89, indicating more profits than losses.
 Risk-Adjusted Performance: The Sharpe Ratio of 25.18 is exceptional,
showing that the returns far outweigh the risk taken.
 Risk: The maximum drawdown is 12.17%, which is relatively moderate
compared to the profits.
 Consistency: The strategy has a win rate of 60.80%, with solid
performance on short trades (69.12% win rate).
 Recovery: The high Recovery Factor of 5.89 indicates that the strategy
can recover well from drawdowns.

You might also like