Optimal values of SL and TP orders for an arbitrary TS. - page 16

 
Neutron >>:


Думаю, HideYourRichess, имел в виду работу ТС с фиксированными стопами, когда TP=k*SL, где k константа. Именно ММ для такого случая он рассматривал в своей статье. Напомню, что мы с вами изучаем ММ для наиболее общего случая, когда область на которой определены значения, которые принимают взятки ТС - натуральные числа от минус до плюс бесконечности.

The case TP=k*SL, where k is a constant, is extremely hard, in my opinion, if we talk about real distributions, not classical ones.


PS. I hope my remarks will not kill an interesting discussion. After all, we can deal with non-brunellicity later, when we have a solution on a simple case.

 

Let's leave for a moment the examination of the OTCF and turn our attention to the peculiarities of its work with a quotient.

Arbitrary TS divides the price series (see figure in green) into a set of segments without gaps, where each of the segments can be characterized as "open position" and "out of the market" - "Out". The "open position", in its turn, is broken down into two states - "Sell" and "Bay":

In the figure, the red highlighted segments of the price series, which are responsible for "buy" positions, blue - "sell". We will call the act of opening/closing a position a "transaction" and agree that for each completed transaction, we give commission to brokerage companies in the form of a spread - Sp, regardless of the outcome of the transaction. The profit that we obtain from each transaction is h [i] equal to the difference between the prices of opening and closing the position multiplied by the sign (tr[i]) of the position opened - "-1" if it is Sell and "+1" if the position was opened as Bay. Then the return P for an arbitrary TS can be represented as follows:

Where the summation is carried out for all transactions that have taken place.

The logic of arbitrary TS operation is as follows: it opens a position if the probability of price movement in the selected direction exceeds some constant that differs from zero, and it closes the position if the probability of further price movement in the selected direction becomes lower than this constant. That's all.

The task of TS is to get the maximum possible profit on a given price series, which is equivalent to the maximization of the obtained functional P.

Let's start by adding and subtracting the same number from the functional, which obviously doesn't affect anything. Let this number be equal to the sum on the ordinate axis of all sections where the TS was in Out state and group (using the additivity property of the sum) all transactions by "Bay" and "Sell":

It is not difficult to understand that we will get new merged areas of unidirectional movement with the commission proportional to the number of transactions before the merger (thick line) in the areas where there were consecutive co-directed transactions (thin line in the figure below):

These merged unidirectional sections have become equivalent to transactions of a new "hypothetical" TS which saves on spread because it gives it only once per new transaction. Profitability functionality for it looks like this:

In the right part of the expression we have the term responsible for those intervals of the price series, which the TS defined as Out. From the viewpoint of TC logic, these parts are characterized as marting and it is useless to predict the price movement on them, that's why TC prefers not to "play". But, from the point of view of statistics, martingality of a section implies inevitable martingality of the sum of such sections, which in its turn guarantees zero MO of their sum. Thus we can get rid of this term with certainty by reducing it to zero, given a sufficiently large number of completed transactions (see the formula, the triangular brackets around the sum mean the averaging procedure). As a result, we have an expression for a "flip" TS, which is always in the market (the right side of the last expression). For such a TS it makes no sense to determine exit points, because they coincide with entry points into the opposite position.

We obtained two more basic properties, which the OTC will necessarily have:

1. Constant presence in the market.

2. All the transactions are sign-variable.

It remains to determine the optimal breakdown of the price series into pivot points (entry/exit points), such that maximizes the functional:


Where N is the full number of quotes, h[i] is the size of the payoff in points, the summation is performed for all completed transactions from 1 to n. Recall that we maximize the number of points per unit time. The time measure is units of price series. Therefore the term 1/N appears in the expression.

 
Neutron писал(а) >>

The logic of arbitrary TS is as follows: it opens a position if the probability of price movement in the chosen direction exceeds some constant that is different from zero, and it closes the position if the probability of price movement in the chosen direction becomes lower than this constant. That is all.

The task of OTS is to get the maximum possible profit on the specified price series, which is equivalent to the maximization of the obtained P-functional.

Sergey, imho, the task, including OTS, sounds more complete:

get the maximal possible profit on the given price series under the condition of limited knowledge about the probability of price movement in the chosen direction, which is equivalent to the maximization of the obtained functional P.

As only at some points of CR we will have the prediction with a reliability exceeding the threshold value.

Which from "philosophical" point of view reflects our place in relation to the market - in a neighbouring branch it is called a pilot fish - i.e. strongly bounded and of collateral nature.

In the formula decomposition, imho, the signs should be changed, because the profit of seyl trades is already positive due to the sign, and the spread is always in the cost.

Neutron wrote >>

The objective of OTS is to get the maximum possible profit on a given price series, which is equivalent to the maximization of the resulting P-functional.

Yes, but given the constraints of our pilot fish position relative to the shark market

It is not difficult to understand what we will get in the areas where there were previously consecutive unidirectional transactions (the thin line in fig. below) - the new combined areas of the unidirectional movement with the commission proportional to the number of transactions before the combined (the thick line):

For us this is only possible on history due to the limitations of our position, and we need it on the open right border.

If this is not the case, then, imho, we either need to change the definition of OUR TS or prove why we can perform this merge NOT on history.

We've got two more basic properties that the OTS is bound to have:

1. Constant presence in the market.

2. All transactions are variable.

This is where the problem is formulated from the point of view ofmarket-shark-God.The validity of exactly this problem statement imho requires proof.

Recall that we maximize the number of points per unit time. The time measure is the price series counts.

In this formulation it reads as our attempt to manage the price movement. Maybe there is another wording.

Such comments were born under the influence of the solar eclipse :)

But it's quite possible that the general assumptions you made won't affect the result of solving the math problem, then they're valid.

 
M1kha1l >>:

Сергей, имхо, более полно задача и ОТС в том числе звучит так:

получать максимально возможный профит на заданном ценовом ряде при условии ограниченности наших знаний о вероятности движения цены в выбраном направлении...

In fact, I assumed as much, considering the work of "not the ideal" TS - which knows for sure the most profitable pivot points, but any other one trading on the right side of BP. Therefore, your addition is accepted as a clarification.

In the expansion of the formula, imho, we should change the signs, because the profit of seals trades is already positive due to the sign accounting, and the spread is always in the cost.

Right! Thank you Michael for such an attentive approach to the material. Wrong sign.

I didn't quite understand about the pilot fish. In what thread are fishermen judging the factors affecting the catch?

For us it's only possible on history due to the limitations of our position, and we need it on the open right border.
If this is not the case, then, imho, we need to either change the definition of OUR TS or prove why we can produce this aggregation NOT on history.

And what would alert an attentive mind here? We are looking at the history of an arbitrary TS. Which in one way or another has already split BP into sections. We analyze and make sure that the TS does not need to exit the market, but waits for the signal to reverse the position. That's it. We are not violating the principle of causality in a single place. Yes, we are on the right side of BP and having received a signal to exit - we ignore it and continue holding the position, having received a signal to open the opposite one - we reverse. What are the doubts? That the signal may be inaccurate? Well, that's what we are trying to develop the optimal algorithm of TS operation.


 
Neutron писал(а) >>

I don't quite understand about the pilot fish. In which thread are fishermen judging the factors affecting the catch?

The notion of a subject-object relationship model has been introduced in science. It is logical to determine the trader's or TS's place in relation to the market or CR.
Imho, it is the object, i.e. the slave, dependent part of the model or in another way - reacting on the actions of the subject. And this is the primary assumption.

It needs to be kept in mind for ALL further reasoning and assumptions.

The image of the pilot fish, may my memory not fail me, is introduced in the "In the follow-up" thread.

Neutron wrote >>

What is there to alert an attentive mind? We are looking at the working history of an arbitrary TS. Which in one way or another has already split BP into sections.

No, it hasn't, but it is constantly in the state of need to make a trading decision, because it is not analyzing the history, but it is on the right side and knows only the current state:

- are there any open positions?

- what is the forecast?

That is all it knows.

Neutron wrote(a) >>

We analyze and verify that the TS does not need to exit the market, but we need to wait for the signal to reverse the position. Everything. We are not violating the principle of causality in a single place. Yes, we are on the right side of BP and having received a signal to exit - we ignore it and continue holding the position, having received a signal to open the opposite one - we reverse. What are the doubts? That the signal may be inaccurate? Well, that is what we are focusing on: developing the optimal algorithm of TS operation.

A very simple example:

even if the forecast for some time is below the threshold of reliability for deciding to close the current position and the opposite entry

nothing prevents the CD from withdrawing the TS from the open trade by breaking through the SL or TP, if the assumption of the primacy of the CD in relation to the TS is valid.

Hence there is a dilemma - where is the bigger loss:

- from the number of spreads when not continuously in the market or

- from "bad" exits when ignoring the prediction credibility threshold of a directional open trade.
Imho, you made a choice but didn't provide a proof.



But frankly, I'm more interested in your reaction to my comment in the previous post about the purpose of optimization.

 
M1kha1l >>:

в разложении формулы, имхо, следует поменять знаки, т.к. профит сейловых сделок уже положиетелен за счет учета знака, а спред всегда в затратах.

This correction has one more consequence, we have to change the signs in the Out sum for the sections following the sells. That is, instead of one pair (Out, -Out) write two (Out buy, -Out buy) and (Out sell, -Out sell) and take the member with plus from one pair, from another with minus. Then there seems to be no need for an exceptionally strong assumption - that the TS correctly determines martingale, it is enough to assume symmetry of the system with respect to buy-sell.

 
Neutron >>:

В правой части выражения у нас остался член ответственный за те промежутки ценового ряда, которые ТС определила как Out. Эти участки характеризуются с точки зрения логики ТС, как мартингальные и заниматься предсказанием движения котира на них бесперспективно, поэтому ТС предпочитает не "играть". Но, с точки зрения статистики, мартингальность участка подразумевает и неизбежную мартингальность суммы таких участков, что в свою очередь гарантирует нулевое МО их суммы. Таким образом, мы можем с полной уверенностью избавится от этого члена функционала устремив его к нулю, при достаточно большом количестве совершённых транзакций (см. формулу, треугольные скобки вокруг суммы означают процедуру усреднения). В итоге, мы получили выражение для "переворотной" ТС, которая всегда находится в рынке (правая часть последнего выражения). Для такой ТС не имеет смысла определять точки выхода, т.к. они совпадают с точками входа в противоположную позицию.

But if an arbitrary TS is considered, it may "prefer not to play" not only in unpredictable areas, but also in areas where profit/loss, although not known, may be quite high. We are talking, for example, about sharp price movements at the time of news. I don't think that such price movements can be neglected, and you can sit through them thinking that they should average out to zero.

 
M1kha1l >>:

В наукообразии введено понятие модели субъектно-объектных отношений. Логично определить место трейдера или ТС по отношению к рынку или ЦР.
Имхо, это объект, т.е. ведомая, зависимая часть модели или по другому - реагирующая на действия субъекта. И это первичное предположение.

Это нуНА помнить при ВСЕХ дальнейших рассуждениях и предположениях.

It's difficult for me to understand. Perhaps, for now.

No, it hasn't, but it is in a constant state of need to make a trading decision, because it is on the right side and knows only the current state:- is there an open position? and- what is the forecast?that's all it knows .A very simple example: even if the forecast for some time is below the credibility threshold for deciding to close the current position and opposite entry ,nothing prevents the CA to withdraw the TS from the state of open trade, breaking through the SL or TP, if the assumption of primacy of the CA in relation to the TS is valid .

Let me remind you that at the moment we consider the trade without any protective orders. And secondly, we consider the post factum operation of an arbitrary TS that has already broken the CA according to some (not interesting for us) algorithm. And looking at it we do not ask the question of profitability of trading, we offer the way to increase the existing profitability - to refuse from the "OUT" condition. It allows us to save on spread in any case.

Hence the dilemma - where is the greater loss:
- from the number of spreads when not continuously in the market or
- from "bad" exits when ignoring the prediction credibility threshold of a directional open trade.
Imho, you've made a choice, but you haven't provided proof.

Mikhail, we can say more and longer than just expressing the core of the problem in the form of a formula. And I have done it. From the formula it follows unambiguously that for any TS (even loss-making one) the only way to increase MO of deals is to refuse exits in favor of flips. The only point that can be considered as pulled "by the ears" is, as Candid absolutely correctly pointed out, the requirement of martingale at "OUT" areas. But again, as Nikolay suggested above, this requirement can be replaced with a less strict one - the requirement of symmetric distribution of price increments at these segments (I mean FR increments). The latter option is obvious by virtue of the equality of the RRR MO to the CRs being zero. By the way, my involvement of martingality in the proof, appealed more to such a property of the series in terms of the TS itself. To clarify. I did not argue that BP must have this property strictly, it is enough that the TC did not know on these plots about where BP will move on them. Or, come to think of it, it may even guess (labile prediction), but this prediction should chaotically change the sign for different sections. Then we logically come back to what Nikolay has already voiced. In short, it's the same eggs - side view! And I consider the choice I made to be reasoned and proven sufficiently.

But frankly, I'm more interested in your reaction to my comment in the previous post about the purpose of optimisation.

What are you talking about?

Candid >>:

This amendment has another consequence, we have to make a change in the Out signs for the plots following the sells

.

That is, instead of one pair (Out, -Out) write two (Out buy, -Out buy) and (Out sell, -Out sell) and take a plus sign from one pair and a minus sign from the other. Then there seems to be no need for an exceptionally strong assumption - that the TS correctly defines martingale, it is enough to assume that the system is symmetric with respect to buy-sell.

Thank you, Nikolay, for your attentiveness. It really is more convenient. I've already noted the merits of your approach above.

aZtec wrote >>
But if we consider an arbitrary TS, it may "prefer not to play" not only in unpredictable areas, but also in areas where the profit/loss though is not known, but can be quite high. We are talking, for example, about sharp price movements at the time of news. I do not think that such price movements can be neglected and we can sit on them, believing that they should give zero on average.

Yes, aZtec, you are correct in pointing out the crux of the problem. But within TA, we don't consider news as such. However, we can observe the increased volatility of a traded instrument during news releases. Unfortunately, I can't cover all the problems related to the adequate description of ATS. In my format, we consider the stationary processes on the market. And at the beginning of the topic I mentioned the limitations of such approach. In particular, one can argue that attracting the non-ergodicity of the quoting process, will affect the emergence of a strong dependence of the share of f capital per point on the volatility (another parameter). Obviously, with increasing volatility (during news releases) f should decrease. But all this belongs to small second order, though I don't exclude, that exactly they will manage the life of OTCF on real instruments and only on it, it will be possible to earn stable profit (as it is paradoxical as it sounds). It is from solving the latter problem that such interesting directions as dynamic parameters can emerge.
In short, this question is still waiting to be solved systematically. For the time being, we are trying to obtain an analytical description of the optimal trading process from the viewpoint of ergodicity of the Market.

Continuing the topic of OTS.

None of you have ever wondered: how many tunable parameters should a TS have? Indeed, the answer "none" is not accepted - we need to tweak the TS somehow, otherwise it will predict solar eclipses, the weather in Africa and oil prices with equal success. How about "the more the better"? Doesn't seem to go either. Otherwise, we'll never tune in. So, where does the golden mean lie? It turns out it's as much an optimization problem as the ones we're amusing ourselves with here. I don't have a rigorous proof yet, but the gist of the result is that the number of tunable parameters can grow when dealing with a well predictable environment and the prediction deliverability tends to 1. But in the case of unpredictable or not predictable environment the optimal number of adjustable parameters tends to 1 and accuracy of forecasting tends to zero. Isn't it a paradox (I mean the optimal number of parameters)? The result is amazing! It turns out that the less we know about something, the fewer parameters are available for analysis... unusual, isn't it? And vice versa, the more familiar we are with the environment we must make decisions in, the more parameters we should use. How about that! Up to now I thought it was the other way round. It would seem that if we are in an environment about which we know next to nothing, we should open our ears and eyes and pay attention, ask the opinion of others like us and make a difficult decision... But no, it is better to take one thing that is right and not hesitate to make a decision. Probably for this reason, in war, the commander's orders are not discussed.

So, according to this unproven statement, the OTS should have only one adjustable parameter (no one will argue with the fact that price series are very poorly predictable).


So we considered many properties that OTS should have. Knowing the shadows cast by the reflections of fire on the cave walls, we will try to reconstruct the images of people dancing around the fire from their variety. Let us reconstruct the OTS itself from its images. Let us enumerate its basic properties:

1. FR of bribes has the form of a rectangular triangle (in first approximation), the direction of the latter depends on the properties of the Market - trendiness / rollback.

2. The OTC has only one adjustable parameter which allows it to adapt to the CD.

3. The OTC is always in the market.

4. All the transactions are variable.

5. The dimension of the only configurable parameter is points.

6. If protective stopper is needed for OTC operation, only one of them is used (the second one is not relevant, due to sharp FR boundary).

It seems I haven't forgotten anything. Please correct, colleagues, if you have any comments or additions.



 
Neutron >>:

Да, aZtec, вы верно подметили суть проблеммы. Но в рамках ТА, мы не рассматриваем новости как таковые. Однако, мы можем констатировать увеличение волатильности торгуемого инструмента во время выхода новостей. К сожалению, я не способен охватить сразу всё многообразие проблем связанных с адекватным описанием ОТС. В принятом мной формате, мы рассматриваем в этой ветке стационарные процессы на рынке. И в начале топика я оговаривался относительно ограничений такого подхода. В частности, можно утверждать, что привлечение неэргодичности процесса котирования, скажется на возникновении сильной зависимости доли капитала f приходящегося на один пункт от волатильности (ещё один параметр). Очевидно, что с ростом волатильности (во время выхода новостей) f долженa уменьшаться. Но всё это относится к малым второго порядка, хотя я не исключаю, что именно они будут управлять жизнью ОТС на реальных инструментах и только на этом, окажется возможным стабильно зарабатывать (как это и не парадоксально звучит). Именно из решения последней проблемы, могут появиться такие интересные направления, как динамические параметры.
Одним словом, этот вопрос ещё ждёт своего систематического решения. Пока же мы пытаемся получить аналитическое описание процесса оптимальной торговли с позиций эргодичности Рынка.

But it's not just about the news. It is about any predictably unpredictable movement. Can we argue that by applying, for example, a trend strategy and assuming (having statistically reliable information) about the end of such a predictable (trending) period, we should still stay in the market (ignore this information), because it will allow us to save on spread and due to this get a statistical advantage? Or the presence of trend/flat periods in the market is not stationary and you do not consider such a market yet? And, besides, shouldn't it depend on the ratio of spread to the average value of price fluctuations on the timeframe in question? I.e. does it really make sense to sit out fluctuations of the order of the spread, but fluctuations of tens/hundreds of spreads?


Well, besides, now, when developing an optimal strategy, the only parameter you are considering is its total return. Of course, this approach has the right to life. But it should be noted that in the transition from trading with a fixed lot to trading with a fixed fraction, out of two strategies showing the same profit in fixed lot trading, the greater profit will be shown by the one having the greater amount of positive trades. And you can increase the share of such trades just by careful selection of the time of entering the market.


I understand that at the first stage you are trying to simplify the task, and as a result you get the condition of being in the market all the time. However, this condition is hardly optimal for a real trading system.

 

There :) By the way - a cumulative tool for your research. SL and TP.


https://www.mql5.com/ru/forum/113106

Reason: