Categories
Forex Daily Topic Forex System Design

Building a Trading System: Why do you need a trading plan?

The necessity of a trading system has been discussed many times. Still,  new traders don’t consider it important when, in fact, it is a crucial element.  Could you conceive building a bridge without a project, playing tennis, or chess, with no strategy?

 

 

 

 

 

The trading profession is alike. If you take this business seriously, you’ll need to have a plan. Else, you’ll be in the loser team, in which are 90 percent of traders.

Reasons for a trading plan

1.- The financial markets are not deterministic

A market is a strange place where you cannot predict an outcome. An engineer can design a bridge, knowing that he can predict the bridge’s strength and behavior under heavy loads with proper calculations.  In the financial markets, you don’t have the benefit of an analytical formula to success. All you can expect is a small edge. Not following your plan is comparable to random trading; thus, losing the edge.

2.- Not following a plan weakens you psychologically

When you buy a lottery ticket or play roulette, you’re entering a bounded game. You know the cost of your ticket, the reward associated with a successful bet, and you don’t need to make any other decision. All parameters of the play, including the exit time, are fixed.

The financial markets are different. Everything there is unrestricted. The trader decides when, how much, exit time, stops, and target levels.  With so many parameters, a trader needs to define his rules and stick to them. Otherwise, he will be shattered by his emotions and lose money.

3.- The need to measure

Traders need to record and analyze their trades for many reasons.  The first is the need to analyze their performance and see if it has improved or not. Also, if the system performs as expected or lags its past performance. The most important reason is that traders need to know the strategy’s main parameters: percentage of winners, reward/risk ratio, the average profit and its standard deviation.

A trading plan that fits you

New traders don’t know much about statistics, and trading is about odds and their properties. One of them is streaks. There are winning streaks and losing streaks. The point is, streaks are mathematically linked to the ods of the system.

Let’s think of a system as a loaded coin, in which the odds of a winner can be different from 50 percent. Let’s say the odds of a system is 60 percent instead.  That means there is a 60 percent chance the next trade is a winner, and, consequently, a 40 percent chance it is a loser.

But what are the odds of a loser after a previous losing trade (a two-losing streak)? For the second trade to be a loser, the first one should also be a loser.  So the odds of two consecutive losing trades in a row is 0.4 x 0.4 = 16%. The odds of three successive losers would be 0.4×0.4×0.4 =6.4%, and so on.

The general formula for the probability of a losing streak is

n-losing-Streak = prob_lossn

which is the probability of one loss to the power of n, the size of the losing streak.

What we have shown here is that streaks are inherent to trading. In fact, inherent to any event with uncertainty. Golf pros, football players, and spot teams are subject to streaks, which are entirely expected. Trading systems are no different.

So, what’s the problem?

There are a variety of trading systems. Some, such as the well-established Turtles Trading System, which is trend-following, have less than 38 percent winners, although with average reward/risk ratios over 5. Other systems show over 70 percent success but reward/risk ratios of less than 1.

The odds of a 10-losing streak on the Turtles system, assuming 38% winners or 62% losers, is about 0.84%. That means we can expect ten losers in a row every 120 trades.

On a 70% winner system, the odds for ten losers in a row are one every 200 thousand trades.

The rationale behind the turtle is to lose small and profit big. When a Turtle trader sees they are right, they add to their position, and on and on, following the trend.

People who use the later system are scalpers that jump for the small profit and get our fast before the movement fades.

Nobody is wrong. They trade what best fits their psychology. You need to know your limits, as well. Many wannabe traders move from system to system after only a five-losing streak, discarding a sound strategy when its first perfectly normal streak occurs. Also, most traders use sizes inconsistent with the expected streaks and lose their entire account.

By now, you should have learned the importance of having a plan that fits your psychology and trading tastes.

In the coming article, we will discuss the components of a trading strategy or system. Stay tuned!

Categories
Forex Basic Strategies

How to Measure Your Trading Strategy with “R Square”

Chances are if this is the first time you’ve heard that square R, you have no idea what exactly I mean or where the thing is going. It is normal, there is much written about supports, resistances, chartist figures. but not so much about more objective indicators. The subject is a bit technical, based on mathematics and statistics, but I’m going to (try) explain it in a practical and straightforward way. In the end, everything is easier than it looks.

What is the R Square?

First, let’s start by defining and understanding the concept of R Square. R Square is a coefficient of statistical determination, also represented as R2, which allows us to predict some results or test a hypothesis. In other words, when we analyze a statistical model, the square coefficient R determines the efficacy of the model (which is so good) and also expresses the percentage or proportion of variation results that are explained by this model.

With this definition clear, in order to use this coefficient R square in practice, it is necessary to understand two important concepts:

Linear Regression: In statistics, a linear regression, also known as linear dependency, is a mathematical model used to approximate the dependency relationship between a dependent variable (for example Y), independent variables (X1,X2,X3,ǐ.Xn) and a random term ɛ (associated with any process whose outcome is only foreseeable in the intervention of chance).

Pearson correlation coefficient: Speaking of statistics, the Pearson correlation coefficient is a linear measure of the degree of relationship between two quantitative random variables, that is, two variables that can be measured or observed and also represented by numerical quantities.

Now, defined these concepts, you may be wondering: How to use this to evaluate my trading system? Step by step.

Each trading strategy or system needs an objective assessment of its effectiveness. In order to achieve this goal, we could get to use an extensive range of ratios, some more complex than others, both in their calculation process and in their interpretation. Despite all this variety, there are very few quality metrics to evaluate something very important: the regularity of the system’s balance line or trading strategy.

To do this, let’s manage the coefficient of determination, R square, to calculate the quantitative estimate of that ascending straight line that all traders want to see in our results.

Characteristics of an Assessment Criterion for Trading Systems

Each criterion or ratio used to evaluate the effectiveness or robustness of a trading system has its limitations in application. There are no ideal or pre-established criteria that allow us to determine with absolute certainty the robustness of a trading system. However, some properties or characteristics may be formulated that must have:

Independence in relation to the duration of the probationary period: Many parameters of the trading strategy or system depend on the duration of the trial period, for example: the longer the trial period for a profitable strategy, the greater your net profit. Independence from the time period is necessary and essential to compare the effectiveness of different strategies in different trial periods.

Independence of the end point of the test: For example, if the strategy «plays» with which simply exceeds the losses, the end point of the test can considerably change the final balance. The criterion or indicator should be immune to such machinations and provide a clear picture of the trading system’s work.

Simplicity of interpretation: All indicators of a trading system must be quantitative, that is, they must be represented by a certain number. It is important that this number is intuitively understandable. The simpler the interpretation of the value obtained, the easier the parameter to understand. It is also desirable that the value of the indicator is within a set range or a defined range, as it is more difficult to understand the meaning of extremely large numbers.

Representative results with few transactions: This is probably the most complicated requirement to meet in the list of features for a good metric because all statistical methods depend on the number of measurements. The higher the measurements, the more stable the statistics obtained. It is virtually impossible to fully solve this problem in a small sample, but you can soften the effects that arise due to a lack of data.

Linear Regression Application

To calculate the coefficient of determination R square, we must calculate or determine the linear regression. As explained above, there may be several independent variables, however, for a better understanding we will use the simplest case: A single independent variable.

In the case of an independent variable, the linear regression or dependence of a dependent variable (Y) on an independent variable (X) can be expressed by the formula Y=aX+b. This formula graphically represents a line in the XY plane, hence the name linear regression.

Now we will choose on our trading platform a chart of a currency pair, of our preference, with a clear upward trend in a given period of time. We download and save this data, then build a chart in Excel with closing prices. On the Y-axis we will have the closing prices and on the X-axis the dates that we will replace by order numbers (for convenience: 1, 2, 3, A). In doing so, we’re going to get a chart with a clearly bullish trend, but we’re interested in a quantitative interpretation of that trend.

The easiest way to reach the target is draw a line that will be more precisely adjusted to the trend obtained in the chart. This line is linear regression. If the graphic is fairly uniform one or more straight lines can be drawn that fit or describe our bullish graphic. Then a question arises: which of these lines is correct? The correct line shall be that straight line where the sum of the distance of the existing points to the line is the minimum distance.

It is also important to note that the regression line must always pass through the center of gravity of all the data that make up the point cloud. The coordinate of this point of gravity would be on the x-axis, the mean of the x-variable, and on the y-axis, the mean of the y-variable. Knowing a point of the line we can use the slope point equation to determine the line equation. By getting the correct line we can calculate the coefficients of the linear regression.

Pearson Correlation Coefficient

Once the linear regression is calculated, we have to calculate the correlation between the line obtained above and the data on which the line was calculated. Let us remember that correlation is the statistical relationship between two random variables. The correlation can take values ranging from -1 to +1. A value close to zero means that there is no relation between the measured values, a value of +1 (or very close to it) means a direct relation of the variables and a value of -1 (or very close to it) means an inverse relation of the variables.

The Pearson correlation coefficient could be calculated by means of the following formula:

Where: XY – is the covariance of (X, Y)

X: is the standard deviation of the variable X

Y: is the standard deviation of the variable Y

Covariance is a value that indicates the degree of joint variation of two random variables with respect to their means. In other words, it is the common variance between the variables and the standard deviation is the square root of the variance.

The Pearson correlation coefficient shows how far the line describes the data. If the data points are at a large distance from the line, the dispersion is high and the correlation is low and conversely, if the data points are at a small distance from the line, the dispersion is low and the correlation is high. A value of zero says there is no relationship between linear regression and data.

Importantly, in Metatrader there is a metric called LR Correlation and shows the correlation between the balance line and the linear regression found for that line. However, in the statistics, they do not usually directly compare the data and the regression that describes them.

Calculation of the Coefficient R Square

In the case of linear regression, to calculate the coefficient of determination R squared is sufficient by squaring the Pearson correlation coefficient that we calculated in the previous step.

This coefficient can take values ranging from 0 to +1, being a result equal to zero or very close to zero pure random unpredictable and a result equal to or very close to one a market in which all quotes are placed on the line. R square shows us what percentage of the price movement follows a definite trend, while the rest of the percentage will be due to random movements.

Limitations On Use

Each statistical metric has its advantages and disadvantages and the coefficient of determination is no exception. Some disadvantages are:

  • They depend on the number of trades. Exaggerate indices with few trades.
  • For calculation, complex mathematical computations are required.
  • It is applicable exclusively for the estimation of linear processes, or systems trading with a fixed lot.

Application in Trading Systems

In trading systems you can see this ratio represented in percentage, which the closer to 100% the better (in theory) is the quality of our system. In my experience, a system with a score above 65 usually has a fairly stable performance over time. It’s one of my favorite filters.

Conclusions

After analyzing and studying the process of calculation of the coefficient of determination R square I can tell you that this coefficient is one of the few measures that calculate the regularity of the curve both of the line of the balance sheet, and of the unrecorded benefit of the strategy (among others).

R² is easy to use because its range of values is fixed and is within the limits of -1 to +1. Values close to -1 alert us or warn us of the negative trend of the balance of the strategy. A value close to zero warns us of the lack of trend in the balance sheet of the strategy. Values close to +1 warn a positive trend.

As I have told you, the square R, like any other ratio, has its limitations that you must take into account. In my case I use it as a top 3 ratios to measure if I have a valid trading strategy or if instead it goes to the trash.