Market etiquette or good manners in a minefield - page 12

 
Neutron >> :

P.S. It's beautiful. I mean the picture. I'm enjoying it aesthetically!

Yes, it is beautiful! Our conversation clarified a lot of things for me.

By the way, I made a simple indicator that can be used to adjust the probability density distribution of the input signal.

Here is a picture of RSI probability density function before adjustment:

Here the purple line is the hypertangent of RSI with coefficient 1 (i.e. as is), and the green line is the probability density function of the probability density function the left edge is -1, the right one is +1.


And in the next picture th( RSI (i) * kf ), where kf is the "smearing" coefficient -:)


Here we go. Now I'm going to put your beautiful drawing into code.

 
HideYourRichess писал(а) >>

This is not so much a paradox as it is a property of MM with reinvestment. The efficiency of this MM depends on the number of trades, among other things. The profitability of this MM is the geometric average in degree of the number of trades. With a small number of trades the profitability loses to a simple MM, but if we manage to survive with a large number of trades (play long) then the return can be larger. But as always, nothing is given for free. You will have to pay with asymmetric leverage and its consequence - a long period of low profits compared to a simple MM.

I would like to talk about the optimal MM in terms of recent results.

Above (from the beginning of this topic) I received analytical expression, which connects such parameters, that characterize trading, as: current rate of a chosen symbol - S, used leverage - L, probability of the correct prediction of anticipated price movement - p, typical size of payoff in points - H, commission of DC - Sp and initial deposit - Ko.

Let me remind you that possible variants of deposit variations at reinvestment of funds under condition of constancy of the size of bribes Н, can be numerically modelled with the help of the obvious expression:

where sigma is random value, which takes values +/-1 with small preponderance to +1 (we have TS with positive ÌÎ).

Actually, I set the problem as a search of optimal values of H and L, given the known ratio of true price change signs to the full doubled number of transactions - p. Of course, we can substitute all possible values of these parameters in the iteration expression and try to find the best option (which is what Vince does in his work when he calculates the optimal f). It turned out that it is not very difficult to obtain an analytical expression that is adequate to the iterated form. We need to prologarithm both parts of the equation and divide the loss-making and profitable trades by different angles:

The beauty of the analytical expression is that we do not need to solve parametric problems to find optimal trading parameters, we just need to use formulas that are ready to use.

Above I got expressions for optimal H and L values, but I found out when trading that we cannot combine optimal H and existing p. These parameters exist independently. That is why, after we have determined the optimal trade H in some way or another, we need to find p on the history of transactions, and only after that we need to search for the optimal trading leverage. In this case, the maximum possible rate of return in Nature will be if L equals:

All we need to know for the most successful trading in the world is the current exchange rate and spread, and, well, the TS with positive MO!

But first let's make sure that our analytical expression for the rate of return really reflects reality. For this purpose let's carry out 1000 numerical experiments (for more statistics) on artificial quotes with a distribution that is close to the real one (for example EURUSD and the market has a rollback or counter-trend with p=0.2), and see how the logarithm of our account behaves in 500 transactions:

The red squares show the average value of the logarithm of our account after 500 trades, the whiskers show the characteristic scatter of this value by 1/e, and the solid red line is the analytical solution. You can see a remarkable overlap within the statistical scatter.

Tired of writing... I'm off for a beer!

The blue one is the one that's not Bernoulli's.

 

As for Vince's Fopt, this is really just the name, in fact it is not the optimal value in terms of capital growth rate. The correct formula to determine the capital share is the so-called Kelly test: Fopt=p-q or Fopt=2p-1, where p is the probability of winning and q is the probability of losing. This formula is valid for equal amounts of wins or losses. It means the following, if p=0.51 for example, Fopt=0.02. That is 0.02 of deposit should be used. Of course winnings and losses should be equal to this value. In other words, to determine the optimal share, in terms of equity growth rate, one simply needs to know the probability. Then if you know the lot size, number of lots, deposit size, commission, etc. you can calculate the leverage. Or vice versa, knowing the leverage you can calculate the number of lots. By the way, why don't you have the concept of lot in your formulas?

Look at conclusion of Kelly's criterion in Thorpe's book, it is very concise and to the point. By the way, for the case of unequal wins and losses, a slightly different formula, generalised. In addition, and this was the reason for Vince's introduction of his Fopt calculation, - MM with reinvestment allows large drawdowns, it is again the influence of asymmetric leverage. Not everyone is ready to tolerate such drawdown, that's why Vince's Fopt is artificially low. Thorpe has formulas and conclusions about it. I wrote an article on this MM, it has been lying on the review of megaquotes for a month now.


By the way, I probably didn't calculate everything correctly, correct me. Here's the raw data and the results obtained from it, using formulas 1 and 3:


characteristic bribe size in points - H


50
current price of the chosen instrument - S


1.3500
probability of correct forecast of the expected price movement - p
0.01
commission of brokerage company - Sp





2
initial deposit - Ko




1000
sigma is a random value, which has the value +/-1
1









used leverage - L



-0.00054
Ki =






980.7692
 

I'm under the impression that I messed up somewhere in putting the numbers into the formulas. here's the result:


characteristic size of the bribe in points - H


10
current rate of selected instrument - S


1.3500
probability of correct forecast of expected price movement - p
0.1
commission of brokerage company - Sp





2
initial deposit - Ko




1000
sigma is random value, which takes on values +/-1
1









used leverage - L



0
Ki =






1000
 

What I have derived is a repetition of the result obtained in the 50s by Kelly. The only thing is that I have added the DC commission to the formula and instead of the capital fraction f I use the notion of leverage L. I thought the formula looks better if I operate with leverage instead of lots. If necessary, it's easy to switch from it to the lot size:

Lot=MathFloor(L*AccountFreeMargin()/MarketInfo(Symbol(),MODE_MARGINREQUIRED)/AccountLeverage()/LotStep)*LotStep;
if(Lot<MarketInfo(Symbol(),MODE_MINLOT))Lot=MarketInfo(Symbol(),MODE_MINLOT);
if(Lot>MarketInfo(Symbol(),MODE_MAXLOT))Lot=MarketInfo(Symbol(),MODE_MAXLOT);

As far as I can tell, there is no way (MM) to build up a deposit more efficiently (for equal gains and losses) than using optimal leverage size.

I don't understand what kind of data you cited at the end of your post... Is it an example of calculation of something by my formulas, or an attempt to reconstruct the data I use in numerical simulation? I took S=10000 points, H=10 points, Lopt turned out to be something like 210, p=0.2, Sp=2 points. The market is rolling.

Returning to my last post, I want to note that the analytical expression I obtained is correct only for bribes with equal winning and losing values. Unfortunately, in real trading this is probably not the case. For example, if in trading we follow the strategy "to limit losses and allow profits to grow" (corresponds to the trend market on the selected trading horizon), the probability density function for the deposit increment is exponential and far from Bernoulli. If we simulate this case in a numerical experiment, we can see that the dependence has a different character and the maximum in the general case does not coincide with the maximum in Bernoulli distribution of bribes. This is very bad and explains why Vince used numerical methods to find the extremum for the general case. I tried to solve the problem analytically in the general case for the exponential distribution and encountered serious mathematical difficulties, which I could not overcome.

HideYourRichess, are you saying that Tharp's paper gives a general case for Kelly? Would you be so kind as to provide a link to his book. I'd appreciate it.

What's interesting. You can show that on historical data, the optimal TS is a Zig-Zag breakdown of the price series with H=2Sp. When working without looking into the future (on the right side of BP), what we encounter in our work as traders, the optimal is Kagi BP breakdown H+ when the market is trending and H- when it is counter-trending (Pastukhov's thesis). In the nature there is no strategy, which in the long run will give more profitability than this (all sorts of Fibs-Mibs are not taken into account). These two strategies are the essence of the well-known "limit losses and allow profits to grow" and "limit profits and allow losses to grow" if the market is rolling. This in turn comes down to a trailing stop loss or stop loss! Like this.

However, everything changes if we start reinvesting. In this case it is the Bernoulli trading patterns that become optimal. Look at the last chart, all else being equal, the strategy with equal payoffs and profit taking on each, statistically outperforms the optimal simple one (blue) i.e. without reinvesting TC funds.

This is an important point! In other words: there is no more profitable TS with reinvested capital than some abstract TS, but with equal size of bribes, i.e. TP=SL.

Super.

 

Sorry, my mistake, it's not Tharp, it's Thorpe. "Kelly criterion in blackjack, sports betting and the stock market." by Edward O. Thorpe, p.5.


Now to the point. I took your formulas, substituted my own data and got results like this. The results are not so surprising to me. That's why I think there's something wrong with these formulas. I'm not claiming it, just trying to understand the reason of negative leverage. Then, if you don't use lots in calculations, it is not clear to me how capitals are calculated. And that is the cornerstone of the Kelly criterion. Or am I missing something, it is also possible.


In fact, the analytical form for MM with reinvestment, taking all factors into account, is not very simple. I do not have it, so I solve this problem numerically.


On the reinvestment strategy, it's a very ambiguous point as to whether it's always good. I can say that my data shows that different combinations of trading conditions lead to exactly the opposite results. I.e. every time you need to determine the most suitable MM, you will have to consider these specific conditions. There are few general rules. With the exception of probably very common, typical for all MMs.


"In other words: there is no more profitable TS in Nature when reinvesting capital than some abstract TS but with equal payoffs, i.e. TP=SL" - I have been coming to realise this fact for several years. Until I read Pastukhov's dissertation.
 

Downloaded. Thank you!

I looked it up diagonally. I may have overlooked something, but Thorpe is talking about the case of fixed inequality of bribes:

Agree, this case is not suitable to describe an exponential distribution of takings ratios or any other discrete (e.g. Gaussian), something we tend to deal with when trading. We do not have this ratio fixed (equal to a constant).

 
Neutron >> :

Downloaded. Thank you!

I looked it up diagonally. I may have overlooked something, but Thorpe is talking about the case of fixed inequality of bribes:

Agree, this case is not suitable to describe an exponential distribution of takings ratios or any other discrete (e.g. Gaussian), something we tend to deal with when trading. We do not have this ratio fixed (equal to a constant).

I have a fixed size. Also, if your winnings\losses are distributed according to a normal law, then it is suspected that this corresponds to a fixed size.

 

Game theory has been dragged into the mix as well.)

 
HideYourRichess писал(а) >>

Sorry, my mistake, it's not Thorpe, it's Thorpe. "The Kelly Criterion in blackjack, sports betting and the stock market." Edward O. Thorpe, p.5.

Now on the merits. I took your formulas, plugged in my data and got results like this. The results are not so much surprising to me. So I think there's something wrong with those formulas. I'm not claiming it, just trying to understand the reason of negative leverage. Then, if you don't use lots in calculations, it is not clear to me how capitals are calculated. And that is the cornerstone of the Kelly criterion. Or am I missing something, it is also possible.

In fact, the analytical form for MM with reinvestment, taking all factors into account, is not very simple. I do not have it, so I solve this problem numerically.

Regarding the reinvestment strategy - it is very ambiguous whether it is always good or not. I can say that my data shows that different combinations of trading conditions lead to completely opposite results. I.e. every time you need to determine the most suitable MM, you will have to consider these specific conditions. There are few general rules. Probably with the exception of very common ones typical of all MMs.

Using my formulas we may indeed get a negative value for optimal leverage size. There is no paradox here and it corresponds to the case when from the point of view of maximizing the rate of capital growth the winning funds must not be invested, but withdrawn as soon as possible :-) Well, why? Imagine a situation where we're blowing and blowing... Just kidding of course! You just need to put an if block on comparing the value of Lopt for positivity and if it is negative do not enter the market. In general, such situations must not be misleading. Often when solving physics problems, you may get a non-physics result, you just need to choose the right answer. For example, if we obtain in analytical form the equation for the motion of a thrown stone, we get two solutions, one of which gives an imaginary unit. Nothing, we just discard that solution.

I have given above the values of quantities used in numerical modelling.

P.S. p takes values from 0 to 1/2 and is found as ratio of number of winning transactions without taking into account spread to double number of all transactions.

Reason: