Criterion for automatic selection of optimisation results.

 

We struggle, we write strategies, and virtually any expert is capable of generating profits with certain parameters on the final trading interval. Meanwhile, relatively little attention is paid to the selection of parameters.

Frankly speaking, I got interested in this topic at because of another reason, namely because of searching for the optimization criterion in my own optimizer using my own GA as I understood that the optimization criteria of MT4 do not give the desirable result. However, you should start dancing from the source code. That is why "Search of Selection Criteria of Optimization Results".

Of course, I haven't got acquainted with the articles available on the website (thanks to the authors), looked through the available discussions as well, even thumbed through some books), but I haven't found there what I would like to see. Maybe there is something, but in the bird's language, I'm not very good at it, all the same practitioner primitivist (maybe someone will translate into "human"), but maybe just did not see. As a result of this thread and hopefully constructive discussion, would like to get a specific formula, some function of test results, the maximum of which with high probability would indicate a viable set of parameters.

Without false modesty), I will note that I have achieved some success in selecting the optimization result by hand. However, I can't automate this process in any way. Perhaps it is just poorly formalizable experience.

Of course, there is a simple and efficient way of parameter selection - the OOS test. But unfortunately it is not always acceptable. For example, to my rams, if we make a criterion of OOS result, some criterion of selection of specimens in GA, it will not be OOSany more .

So, initial data in terms of MT4:

-GrossProfit ,

-GrossLoss,

-MaxDrawdown (Drawdown) ,

-Number of profitable trades, losing trades, -Total number of trades,

-Number of bars (ticks) of testing,

Max Profit trade, max loss trade

-series of profitable trades, series of losing trades

There seems to be nothing missing (correct if I missed something), all sorts of MO, RFP, etc. are omitted intentionally, as they are calculated and can be obtained from the above.

Shall we do some magic?

 
Figar0 писал(а) >>

We struggle, we write strategies, and virtually any expert is capable of generating profits with certain parameters on the final trading interval. Meanwhile, relatively little attention has been paid to the topic of parameter selection.

Shall we do some magic?

The subject seems to be always actual. So we can begin.

 
Vinin писал(а) >>

The topic seems to have always been a hot topic. So we can begin.

Let's start, and let's start with the fact that it's time to debunk a few theses which partly render this thread meaningless.

1) "Profit is built into the system at the build stage, not at the optimisation stage". Which, in general, makes the optimization stage unimportant. I myself thought so for a long time. How wrong I was... There are a number of systems for which it is not so, or rather not quite so. Various NS and simply very complex systems (recently saw a pipswitch with about 100! parameters that need "tuning", by the way, quite profitable, strangely enough), which, whatever you put in them at the design stage, without optimization/training can easily go to trash...

2) "Too many external parameters - expert is rubbish". I've heard it often. Practice shows that there is no such a correlation. Such EAs are difficult to train and therefore difficult to use, but it is because nobody can clearly say what should be taught. Therefore the most probable result of optimization will be "bad fit" and, as a result, a failure.

 
My 5 cents of experience - for me there is a formula = the number of trades is directly proportional to stability and inversely proportional to profitability.
 
xeon писал(а) >>
My 5 cents of experience - for myself I have deduced some formula = number of deals is directly proportional to stability and inversely proportional to profitability.

It's very good that you noticed this topic. I think that by working with and on the auto-optimiser, you have gained more than a lot of roubles' worth of experience, and you will still be able to share it).

In this particular case, I have a twofold view of the number of trades:

The first option - coincides with your observations, but I gradually abandon it, I have to narrow down the search.

The second is the case when the number of trades is set at the design stage, i.e. for each system there is its activity, and there is what it was "forced" to learn at the cost of mutation into another system. And lately I use the number of deals approximately as follows: Suppose, for example, estimated (looking at a chart) number of deals is 5 per day (you can use 1 for 20 bars, 2 per hour, or whatever), respectively, the average number of deals (ACS) should fall within a range of about 5, i.e. 3<=ACS<=7. What is beyond the range - is ruthlessly discarded, allowing not to lose the sense of the system, but at the same time crossing out the possibility to accidentally find a related variant of using TS, or just another pattern.

 
Figar0 >>:

Очень хорошо, что Вы заметили эту тему. Я думаю, работая с автооптимизатором и над ним, опыта Вы набрали более чем на много рублей, и еще сможете им поделиться)

В этом конкретном случае, с колличеством сделок, у меня двоякое видение:

Первый вариант - совпадает с Вашими наблюдениями, но постепенно от него отказываюсь, приходится сжимать круг поиска.

Второй - это тот случай когда колличество сделок закладывается на этапе проектирования, т.е. для каждой системы есть ее активность, а есть то, чему ее "заставили" научиться ценой мутации в другую систему. И последнее время я использую колличество сделок примерно так: Допустим, расчетно-визуальное (глядя на график) колличество сделок 5 в день (можно 1 на 20 баров, 2 в час или что угодно), соответственно среднее колличество сделок (СКС) должно укладываться в диапазон около 5, т.е. например 3<=CКC<=7. То что за диапазоном - безжалостно отбрасывается, позволяя не потерять смысл системы, правда заодно перечеркивая возможность случайно найти сопутствующий вариант использования ТС, или просто другую закономерность.


It certainly depends on the type of vehicle.

Another interesting parameter in my opinion (calculated) is the "Sharp's coefficient", but I haven't worked with it yet :-)

 
xeon писал(а) >>

Of course, it all depends on the type of TS.

Another interesting parameter in my opinion (calculated) is "Sharpe Ratio", but I haven't worked with it yet :-)

Sharps, Sortino and others - it's almost a bird's tongue :) Everyone says cool, but I haven't tried it either, if anyone knows how to calculate it from raw data for practical use, I'll try it and tell you the result. We need to re-define the raw data for formulaic language.

-GrossProfit = GP ,

-GrossLoss = GL,

-MaxDrawdown (Drawdown) = MD ,

-Number of profitable trades = PD, losing trades = LD, Total number of trades = AD,

-Number of bars (ticks) of testing = TIME,

Max Profit trade = MPD, max loss trade = MLD

-Series of profitable trades = SPD (in units), = SPD$ (in deposit currency), series of losing trades =SLD, =SLD$

Did I miss anything? It is possible to draw formulas?

Z.U. I'll take a couple of hours to reflect, and morally support our Olympians, skiing) And without my support) they are not so far....(

Who's with me?:)

 

Methodology for calculating the Sharpe Ratio


Help for the Sharpe Ratio:

The Sharp Ratio, also known as the reward-to-variability ratio, characterises management performance. It measures the return relative to the overall risk of the portfolio. Where overall risk is the standard deviation of portfolio returns.
The Sharpe Ratio at a given depth and time frame is calculated using the following formula:

where
-average portfolio return (average portfolio return);
-average risk free rate;
-Standard deviation of the portfolio returns, detailed calculation can be found in the documentation of the volatility calculation service.
Geometric return is used, defined as the natural logarithm of the price ratio (logarithmic return):

where
- prices measured as of the end of the previous period;
-prices measured at the end of the current period;

The higher the Sharpe Ratio is, the more efficient the investment will be. A small Sharpe Ratio value indicates that the investment returns do not justify the level of risk taken. A negative Sharpe Ratio will indicate that investments in risk-free assets would yield higher returns.


Sortino and Modified Sortino coefficient help:

The Sortino Ratio is another measure of the return and risk of an investment instrument. Mathematically, it is calculated similarly to the Sharpe Ratio, however, instead of portfolio volatility, the so-called "downside volatility" is used. In this case, volatility, is calculated on returns below the minimum acceptable portfolio return (MAR).

The Sortino's coefficient at the given depth and timeframe is calculated using the following formula
where
- average portfolio return (average portfolio return);
MAR- Minimum Acceptable Return of the portfolio
-standard deviation of the portfolio returns, calculated for the returns below the minimum acceptable portfolio return. The detailed calculation can be found in the documentation of the volatility calculation service.

The Modified Sortino coefficient at the given depth and timeframe is calculated using the following formula
where
-average portfolio return (average portfolio return);
-average risk free rate;
-standard deviation of the portfolio returns calculated for the returns below the minimum acceptable portfolio return. The detailed calculation can be found in the documentation of the volatility calculation service.

Yield is geometric and is defined as the natural logarithm of the price ratio (logarithmic yield):

where
- prices measured as of the end of the previous period;
-prices measured by the end of the current period;
 

Alpha and beta coefficient reference:

The alpha and beta coefficients are designed to reveal the statistical relationship between the instrument and the index. In graphical representation this will be a point chart of instrument's return versus index return. (see drawing of an ellipse). Through the obtained set of points let's draw a straight line, as close as possible to the point chart. The statistical procedure of drawing such a line is known - it is called "simplelinear regression or the least squares method". According to this method, the equation of the straight line minimizing the sum of squares of distances from each point of the graph to the straight line is found. The resulting straight line (regression) equation will have the form:
,
where is the yield of the instrument;
-coefficient of vertical shift of the straight line;
-coefficient of slope of the straight line;
-index return
According to the method of least squares the coefficients and are found by formulas:

,
where Cov(,)-covariance of instrument return and index return
-standard deviation of index return
where
-average return of an instrument
-Index average return

When the market index is chosen as the index
"Beta-coefficient - determines the influence of the general market situation on the fate of the particular instrument. If >0, the instrument's efficiency is similar to that of the market. If < 0, the efficiency of the instrument in question will decrease as the market efficiency increases. The ratio is also commonly thought of as a measure of the risk of investing in these securities. At >1, the risk of investment is higher than the market average, while at < 1 it is the other way round.

"Alpha"-coefficient characterizes the correlation of the market growth rate and the growth rate of the specific instrument. If any instrument is positive, it means that its growth rate is higher than the market average, i.e. we can say that it is "undervalued" by the market at the moment.


Coefficient reference

The accuracy of the description of yield fluctuations by the regression equation is characterised by the dispersion (spread) of yield values. In order to estimate the explanatory power of the regression equation we introduce the coefficient showing to what extent the change in the instrument price is explained by the specified ratio with the change in the index value and it is defined according to the formula
R = ,
where is beta-coefficient
-standard deviation of index return
-standard deviation of instrument return

In the case when market index is selected as the index:

The coefficient "" or coefficient of determination- characterizes the share of risk of investing in a given instrument contributed by the uncertainty of the market as a whole. The closer is to zero, the more independent the instrument's behaviour is in relation to the general market trend. When an arbitrary instrument or a user's portfolio is selected as an index: The coefficient "" characterises the tightness of the relationship between the instrument and the index. The closer this value is to 1, the stronger the relationship.


Value of t-test by Student's t-criterion

The calculation of Student's t-test is applied to test the significance of regression coefficients, i.e. alpha and beta coefficients. The value of Student's t-test for the beta coefficient is calculated using the formula:
,
where is beta coefficient
-is standard error, which is calculated by formula:
,
where -profitability of the instrument;
-profitability of the instrument, calculated according to the formula: ;
-index return; -index return calculated by formula: ;;
-Average return of the index
n-number of return values participating in the calculation.

Value of Student's t-test for the coefficient alpha is calculated by the formula: ,
where - coefficient alpha;
-is the value of the standard error, which is calculated by the formula
,
where - instrument return;
-profitability of the instrument, calculated by the formula: ;
-index return; -index return calculated by formula: ;;
-index average return

n-number of yield values involved in the calculation.


Fisher criterion value

Fisher criterion value is calculated according to the formula:

Similarly to Student's t-criterion, the calculated value of Fisher's criterion is compared with the table value (see Table values). If the calculated value of Fisher's criterion exceeds the tabulated value, the null hypothesis of no relation between the instrument and the index is rejected and the conclusion about the existence of the relation and the statistical significance of the regression equation is made. But if the calculated value of the Fisher criterion is lower than the table value, then the probability of the null hypothesis is higher than the specified level and it can not be rejected without serious risk of making an incorrect conclusion about the relation. In this case, the regression equation is considered statistically insignificant.
 
Whether the descriptions and formulas are useful for research I don't know, but I have copied them here, maybe there will be some thoughts on how to apply....
 

Yay, the session is over!!!!

I wonder what all these sharps and students amount to when the market is down by leaps and bounds?

Reason: