The Quality Trading Coefficient. General Formula to Qualify a Trade and a Trading Methodology

Trading the financial markets is a wide activity nowadays. There are several indicators to measure this activity. The drawdown, the profit factor and the trading efficiency are some of them. This paper will present a different one: the quality trading coefficient. The new formula will indicate several particular aspects originating from the human psychological emotions and fears during transactions on the way to make profit. If the trade was fast and the price moved continuous to the profit target level, the quality trading coefficient will have a positive value close to one. When most of the time the trading position was on loss and the profit was made on the last part of the trade time, the coefficient will have a positive value more close to zero. If the trade is closed on losses, the coefficient will have a negative value tends to minus one if the market goes against the direction of the trade on the entire interval. Measuring this coefficient for all trades made with a trading strategy we can compare and categorize the strategies for any market and for any time interval. The quality trading coefficient became a new optimization criterion for the trading strategies used in automated trading systems.


Introduction
Trading and investing on financial markets is a common activity today. In the context when "enterprises grow or change to meet market demands and competitive situations, new business requirements drive the expansion of IT resources in the computing environment" [1]. After the electronic trading was globally implemented, the number of the market participants is increasing day by day. Traders, investors, private or public funds are buying and selling every day on different markets using different trading strategies to make profit. The fast evolution in the price volatility involves computers to be the main part of all trading systems today. "The existence of important price differences makes possible the profit when an automated system buy cheaper and sell more expensive" [2]. The price evolution is automatically analyzed in real-time and the trading decisions are made almost instantly by servers using different trading strategies and algorithms. The interest for this research field is growing. "Data mining has become an increasingly powerful technology, being applied in a variety of areas, from investment management to astronomy" [3]. The trading strategies involved in the financial trading systems use data mining procedures adapted to find particular patterns in the time price series in order to initiate good trades. A trade is the process to buy, to keep and to sell different equities in order to make profit. But what means a good trade is a relative question. What some consider is good enough, others are not. An exact criterion is needed. In the trading activity there are several indicators to measure different aspects involved. The drawdown describes the maximum capital exposure of a trade, the profit factor indicates how much is the realized profit compared with the capital exposure and the trading efficiency will indicate the profit rate in the time unit. We use all of these in order to compare different trades. These classical coefficients are well known and they are not the subject of this paper "The continuous growth of the challenges and the complexity of projects, lead to the development of new approaches to model and support uncertainties and risks" [4]. This article will present a different factor in order to qualify the trade: the quality trading coefficient (QTC). Starting from the psychological part of the 1 trading activity and counting the emotions and fears of the trader and investor during a trade, this paper will open a new direction to compare and categorize a trade and a trading methodology. It will be developed a coefficient that will indicate if a trade is on the right direction or not, if the price has reversed and goes against the trade direction on the main period of time. The indicator will have a positive value more close to one when the trade took place more close to the ideal transaction. The notion of the perfect trade will be introduces as base for this model. The perfect trade is that trade in which the price goes higher and higher every time unit until the profit target is touched. If in a significant time period of the real trade the position was on loss and the profit was made in the last small part of the trade, the QTC will have a positive value but more close to zero. For negative trades the QTC will have a negative value. A very close value to minus one is possible when the trade was never on profit and the price moved against the trade. The QTC can be used in order to qualify a trade and a trading strategy. With QTC the price behavior during the trade can be easily quantified by a single number. Measuring the QTC for all trades made by a trading methodology we can categorize that model for a specified market in a given time unit. With this method more types of trading strategies can be found. In addition this model can be a good filter in order to optimize the trading model and to initiate only that trades that satisfy the investor expectancy. If a trade is making the profit in the last part of the trading time, as most of the investment strategies are doing, the beneficiary of that trading system can be informed priori about the methodology specificity and the expectancy of the investor can be adapted and prepared for the reality in the trading activity.

The necessity for a quality trading coefficient
There are several aspects in the trading activity that ask for a quality trading coefficient. A part of these are related with the psychology in the trading activity. The main fear of a trader is to open a trade that will go against the direction of the trade and will record a loss. Even stop loss procedures are used in the trading strategies in order to limit the losses, the psychology of fear is always the same. A manual investor or an algorithmic trader wants to know any time how the trade goes. The main financial indicator is of course the profit or loss value. During the trade this will indicate if the trade is close to be finished or if the price is far away to the profit target and it is approaching to the stop loss level. But the information about the price history is not covered looking only on the profit level. We don't know what the price behavior is. Is the price in a continuous growth or is far away the predicted trajectory? In order to underline the necessity for a quality indicator in the trading activity, this paper will include some dialogue from a trading floor in a private financial investment company. The capital manager is asking the trading assistant "how that trade is going on?" In this situation the answer is usual a long explanation even the manager wants a short one. To describe the situation the answer is usual a story about the movement of the price during the time after the trade was opened. Something like "we was on loss with about 0.33% for thirty hours but the price reversed after the yesterday news and now we are on profit with about 0.12% and the price is going up". The manager must have patience to hear the entire explanation in order to know the situation of any trade, especially when it is about longer trades. After the QTC methodology was implemented in the trading system the dialog became very efficient. After the question "what we got?" the answer of the trading assistant about the current trade is only a number "0.65". "Great!" The value of the QTC indicates the state of the trade and the main information about the price history is condensed in the QTC value. For someone who knows the specificity of the trade, the target level and the time period predicted for that trade, the QTC value will indicate how the price evolved during the transaction. The QTC is not giving the profit level or the distance until the target. As we will see, the QTC is giving an indication about how close is the current trade to the perfect imaginary trade.
The QTC is a good measure to qualify the price evolution during the trade. The QTC can be computed anytime during the trade to tell us the state of the price evolution. After the trade is closed, the QTC has a final value which will remain unchanged. Having the QTC final values for all trades made with a specified trading strategy we can classify that method and we can compare more models to find the better one. Each trading strategy has its own data mining methodology. The better strategy will open trades with QTC higher and close to one. If the main trades of a trading algorithm obtain positive values closed to zero that means the most of the profit is made in the last part of the trade. This will be an important aspect for the trader in order to make a realistic expectation about that trade methodology.
More, if a strategy will generate more trades with QTC closed to the one value that strategy can be categorized to be more accurate when it is about the entry point and it will be preferred instead of others. The necessity for QTC derives also from the necessity to categorize and compare the trading strategies used and to find an optimization factor in order to improve the trading system.

The perfect trade
In order to build the QTC the current trade will be compared with a perfect imaginary trade. This kind of trade is hypothetical and rarely exists in the current practice. However, this trade exists in the mind of traders and investors as to be the wish of anyone. In the perfect trade, once the transaction was opened, the price goes continuous up and evolves with the same speed in each time interval until the profit target is reached. The perfect trade is sketched in the fig. 1. We will note with qe the entry price and with qt the target price of the perfect trade. In the perfect trade the price makes the same Δ movement in each time unit. We have qe=pe and qt=pt, where pe is the entry price or the real trade and pt is the target price. The trade step of the perfect trade is given by: where n is the number of the time intervals spent on that trade. The main property of the perfect trade is that we can generalize the term formula as an arithmetic progression with: In the fig. 1. was drawn the Frankfurt Stock Exchange Deutscher Aktienindex DAX30 [5] time price series on a hourly timeframe between 2 nd and 3 rd July 2018. As we can see in this sample, the real trade is far away from the perfect trade even in the case when the price range is close to the perfect evolution.
Because of the market volatility, the price goes up and down and rarely makes movements only in the up direction. The perfect trade is only a model. It represents the ideal price movement between the open and target price.

The correlation coefficient
To build QTC we want to find a math formula to measure how far away is the real time price series from the price levels of the perfect trade. We will note here the price variable from the real trade with P=(p1, p2, … , pn) and the hypothetical price levels from the perfect trade with Q=(q1, q2, … , qn), where n is the number of the time intervals spend on the current trade.
In order to measure how correlated are these two variables, both measured on the same moments of time, we will start from the correlation coefficient of Galton-Paerson [6] which is given by: where   Q P, cov is the covariance between P and Q series, P  and Q  are the standard mean deviations of the P respectively Q variables. The covariance is the coefficient "to measure the intensity of linear dependency between two variables" [7] and is given by formula: where P and Q are the simple means of the P and Q variables given by: The standard deviation for the P and Q can be computed using the known relations:   With all of these, the correlation coefficient will be given by: An important observation regarding the (7) formula is about the term (n-1)/n. Usual, for series with large number of observations, these term can be considered tends to one, but for small numbers of observations, this hypothesis is not true. With this presupposition the correlation coefficient is given without the term (n-1)/n in many statistical books or papers. In our case it was found important to keep the term (n-1)/n in the correlation coefficient formula because we want to measure the correlation factor even for small number of time intervals.

The quality trading coefficient
The QTC is in fact the correlation coefficient of the actual trade price series with the perfect hypothetical trade price levels described in chapter 3. The QTC will measure how far away is the price evolution on the current trade from the perfect price wanted. Using the properties of the perfect trade price series, the formula (7) will suffer some changes as we will see. First of all, the simple mean of the perfect trade price series can be expressed by: is the open price level and t t p q  s the profit target level of the current trade. In order to simplify the formula (7) we will consider (2) and (8): With all of these, the quality trading coefficient will be given by formula: As we can see, the QTC depends only on the i p price levels and it is not depending at all on the target price t p . The QTC is referring about the past price movement, not about the future. The formula (11) can be applied for any number n of intervals higher or equal with 2. For those trades which are closed in the same time interval in they were opened, the formula cannot be applied. For n=1 the QTC=0. For this case it must to be used a shorter time interval in order to have a higher n and more price observations to apply formula (11). If the trade is closed immediately after it was opened, as many cases in high-frequency trading exists, that trade will be considered a perfect trade and the QTC will be assimilated with the value of one.

Different trading cases
As we proposed, the QTC scope is to qualify the price evolution during a trade. The evolution is due to the price behavior, but using a data mining applied to the time price series, the QTC values will qualify also the trading model. A methodology with higher values obtained for QTC will be more adapted to find those price patterns which assure opening trades for better price evolution cases. In order to see differences between some trades, three examples will be considered in this chapter. The first case is the case of a trade made on DAX30 market between 2 nd and 3 rd July 2018 by TheDaxInvestor [8], an automated investment software. The trade was opened on 2 nd July at 17:06 at 12,220 price level with an initial target established at 12.346 and moved during the trade at 12,398. On the entire period of the trade the QTC has positive values. The minimum value for the QTC was 0.57 and the maximum values was 0.92. As it can be seen in the fig. 2, the price levels were close to the perfect trajectory, there were no substantial retracements and the price trend was continuously up approaching the target in any time interval. This is a good example for a trade very close to the perfect trade.

Fig. 2. Profitable trade close to the perfect trade
In the next example we will see a profitable trade with a lower QTC value. This is the case for a trade opened with TheDaxDealer [9], an automated trading software for DAX30 market which makes short term trades with variable targets. The entry trade was initiated at 12 th June 2018 at 13:00 at 12,850 price level with an initial target at 12,900. The price evolution during this trade can be seen in the fig. 3. It can be observed that after the opening of the trade, the price has fallen continuously and it was under the perfect trade price levels almost all period of the trade time. This trade was closed on profit due to a price recovery on the last period of the trade. The final QTC of this trade was 0,16 after its minimal value was -0.68 in the middle of the trade. Looking on the QTC value during the trade, anyone can qualify that trade.

Fig. 3. Profitable trade far away the perfect trade
The third example is for a trade closed on loss. We present the example of a trade initiated by TheDaxTrader [10], an automated trading system which makes short time trades on the DAX30 market. The trade was opened on 28 June at 9:38 at 12,330 price level with an initial target at 12,368. After opening the trade the price goes well for about two hours. Due to some unexpected economical news released, the price turned down and described a short strong trend. An automated stop loss procedure closed the trade at 12.098 in order to limit the losses. The QTC of this trade has negative values immediately after the first two hours. The trade was closed with the final value for the QTC at -0.96. This value describes a trade far away the wish trade in an inverse correlation with the perfect trade, close enough to the worst trade. An interesting observation is that the final value of the QTC for a closed trade depends on the decisions during the trade. As we can see in the fig. 4, if a larger stop loss would have been used, the automated stop loss procedure would not have closed that trade. After a short time the price recovered all loses and the trade could be closed on profit. In this case the QTC would have a small but positive value as in the second example. This consideration tell us that QTC is defining a trading strategy including the data-mining methodology in order to find those price patterns proper to open a trade and also the decisions regarding exits for the current trade. In this example the stop loss procedure was also automated but in some trading systems this is the case when the human can intervene. The capital protection and the risk management for all trades presented were made automatically using the methodology of the "Global stop loss" [11]. The third example is the typical case when a stop loss rule must to be respected. Using this kind of functional limits, the capital is protected and the exposure of the trading capital is kept in the limits established by the investor. "Loss are part of trading" [12] and the risk management is the key for capital protection. In trading large losses must be avoided, any small loss can be recovered in the next period of time with a proper capital exposure management.

A new design criterion
As we have seen in the chapter above, the QTC can indicate the state of the current price evolution compared with the perfect desired trade. The final value of the QTC can also indicate the quality for the entire trade. In the algorithmic trading environment, when an automated trading system is designed and tested, several aspects about the trades made by that system are taken into considerations. First is the obtained profit level. The second as importance is the maximal drawdown, which is the maximum capital exposure obtained in that trade. This factor describes the real capital risk involved in that trade. The trading efficiency is also important and will indicate the profit obtained per each time unit, as a measure for the trading system. Another indicator used in the design process of the automated trading strategies is the longest time trade. This is an important measure and an optimization parameter as it was presented in [11].
Analyzing the values for all these indicators, the functional parameters can be optimize to obtain a better trading strategy. Even so, it was found that using only these indicators, a trading strategy can make a lot of profitable trades with QTC close to zero. This means that trades become profitable in the last part of the trade and on the major time during the trade the positions are on loss. This is not a desired case. In these cases the entry price level is too high. For this reason the QTC become an additional optimization criteria. Using QTC methodology we can filter those data mining procedures that make better trades. In this way the efficiency of the entire trading system is improved. In addition, using QTC as optimization criterion, the trading system can be adapted for some particular requests. For example if an investor will ask for a trading system with a specified efficiency level, the QTC will be a very powerful factor in order to optimize all the functional parameters. More, after the design process of a trading system, the measure of QTC minimal and maximal values obtained for all trades permits an enlightening presentation of the trading system capabilities.

Conclusions
The QTC is a measure of the price behavior during the trade. For a closed trade, the QTC is a measure for the quality of the trading strategy used, including the quality for the data mining process used to open the trades together with the capital and risk management decisions during the trade and with the exit strategy precision used by the trading system in order to close the trades. All of these together can categorize an entire trading methodology. In this way the QTC becomes an important optimization factor in the design, testing and optimization process of any trading system. The general conclusion is that the QTC is a good measure in order to qualify a trade, a trading strategy and a trading system.