Trading a portfolio of currency pairs - page 8

 
kharko:

By which characteristic do you optimise your indicator? Profit, drawdown or deviation? Do you use a genetic algorithm?
 
EvgeTrofi:
By what characteristic do you optimize your indicator? Profit, drawdown or deviation? Do you use a genetic algorithm?

By optimising the indicator we mean determining the positive difference between the closing candle price at the end of the time interval and the opening candle price at the beginning of the time interval for each instrument in the portfolio.

In the future there is a desire to change the optimization algorithm: to search for combinations of directions for the portfolio instruments to get the absolute minimum profit value and the minimum drawdown, i.e. the variant of hedging of the portfolio instruments on the selected time interval.

The implementation requires enumeration of all variants. The total number of variants is 2 to the power of N, where N - the number of instruments in the portfolio. Maybe someone can help - a ready code. I would be very grateful.

 

kharko:

By optimising the indicator we mean determining the positive difference between the close candle price at the end of the time interval and the open candle price at the beginning of the time interval for each instrument in the portfolio.

And what is there to optimize? We take value:

double profit = Close[0] - Open[i];

if (profit > 0.0) {

// Long pose.

} else {

//short pose.

}

Let's look at the instruments that have higher profit values and add them to the portfolio.

As this approach ignores drawdown, we can obtain the maximal profit in only one way: we can keep in our portfolio only the instrument with the highest profit value.


kharko:


In the future there is a desire to change the optimization algorithm: searching for combinations of directions for the portfolio instruments to get the absolute minimum profit value and the minimum drawdown, i.e. the variant of hedging of the portfolio instruments at the selected time interval.

The implementation requires enumeration of all variants. The total number of variants is 2 to the power of N, where N is the number of instruments in the portfolio. Maybe someone can help - ready code. I would be very grateful.

Trying all variants when there are ready algorithms with higher performance is a deliberately stupid thing to do. The wheel was invented a long time ago and it is in the open source, since the project is open-source:

http://r-portfolio.sourceforge.net/

You feed the algorithm with quotes, you get an optimally diversified portfolio without leverage.

The algorithm used is the Brown-Robinson algorithm, which is based on the Von Neumann-Morgenshtern Minimax theorem. That is, according to the above theorem, it minimises the loss - drawdown on the portfolio at a given section of history (any other portfolio will give a smaller MiniMax value, and therefore a larger drawdown). It can also be mathematically proved that Brown-Robinson algorithm finds the best arbitrage situations, which took place at the historical period of history processed by the algorithm.

 

Т.е., согласно вышеуказанной теореме он минимизирует убыток - просадку по портфелю на заданном участке истории (любой другой портфель даст меньшее значение МиниМакса, а следовательно и большую просадку).

It is not entirely clear. The E-V theory is that the least profitable portfolio, or the one with the smallest variance, will have the smallest loss. It will of course not be diversified. Against this background, the idea of searching for the least risky portfolio is at least bizarre. Besides, there are not a few questions to the r-portfolio itself:

1. What is meant by the notion of "optimally diversified" portfolio?

2. Where will the r-portfolio lie relative to the effective E-V front?

3. How does the r-portfolio behave on the OOS and how robust is it to tail risks?

4. Actually, how is it better than a classic E-V portfolio?

And just using something just because it's open, while not understanding how it works no one in their right mind would.

 

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

What is there to look for? Take the dollar index and eurusd, open in one direction, and you will be lucky - their correlations are close to -1, and it means that you will have neither profit nor loss, which you need. And what side of the balance you will be on will depend on the direction in which the spread between these instruments will go.

 
C-4:

3. How does r-portfolio behave on OOS and how resilient is it to tail risks?

In a prosperous case it may be for example like this:


This is an autoclave of forwards (three day cycle between optimisations). Each optimisation on a period of 3x88=264 days.

But this is NOT a multicurrency. Here we optimise a portfolio of 864 Expert Advisors trading on one symbol (in this case EURUSD, M30).

 

Honestly, the picture is not impressive. On the whole, it is no better than a portfolio based on dart throwing. Against this background it seems absurd the statements of the author who claims, and I quote:

1. Портфели R-Portfolio относятся к отдельному множеству портфелей, состоящих из ценных бумаг, и представляют из себя синтетические финансовые инструменты, которые выгодно отличаются от остальных финансовых инструментов строго восходящим ступенчатым трендом без провалов (просадок). Если временной ряд котировок отдельных ценных бумаг, входящих в портфель, представляет из себя случайное блуждание по схеме Бернулли, т.е. состоит из множества японских свечей различных цветов, с различными максимумами и минимумами, исходящими из этих самых тел, то R-Portfolio - это синтетический инструмент, который состоит только из свечей тела которых всегда окрашены в белый цвет - растущие. Минимумы свечей в R-Portfolio отсутствуют. Случайное блуждание Бернулли этого самого портфеля применимо только к максимумам доходности, т.к. они непредсказуемы и ничем не ограничены. Тело свечи для R-Portfolio не может быть меньше некоего определенного значения.
2. Потенциальный риск для любого R-Portfolio, всегда отрицателен, даже когда в этих самых портфелях отсутствуют безрисковые ценные бумаги.
3. Понятие потенциального риска для R-Portfolio отсутствует, поскольку этот самый риск всегда отрицателен...

(another portion of absurdity follows)

Obviously, the author is not aware of the fact that the variance itself is the risk. Hence the statement "The potential risk for any R-Portfolio is always negative, even if there are no risk-free securitiesin these very portfolios" is at least untrue, and suggests the author's inclination to demagogy.

In addition, the r-portfolio or any other "genius portfolio theory" of the dart-throwing type will always be on the VaR plane, and hence obey its laws, including the non-linear risk-return relationship.

Z.I. Reshetov, where on the chart shown by MetaDriver is "a strictly upward stepped trend without dips"?!!! Where on the chart are "candles painted only in white"?

 
C-4:

P.S. Reshetov, where on the chart shown by MetaDriver is "a strictly upward stepped trend without dips"?!!! Where on the chart is "candles coloured only in white"?

They are there on the history. (Really all white, which is fully consistent with the advertising, I confirm.) And the picture shows glued forwards... :)

Strictly speaking, Reshetov is not to blame. He tried his best. Here the complaints to the administration forex. Why don't they watch the analysis, those assholes? I'm against it!

 
Reshetov:

What is there to optimise?

Yes, there really is nothing. A simple operation, determining the positive direction for all instruments in the portfolio over a given time horizon, is called the buzzword "OPTIMISATION".
Let's see which instruments have the highest profit value and put them into the portfolio.

It is easy to prove, because this approach does not take into account drawdown, there is only one way to maximise profit: to keep in the portfolio only the instrument with the highest profit value.

The task is different. Instruments for the portfolio are selected. The selection criterion is the minimum spread.


Trying all of the options when there are ready algorithms with higher performance is a deliberate stupidity. The wheel was invented a long time ago and it is in open source, since the project is open source:

http://r-portfolio.sourceforge.net/

You feed the algorithm with quotes and get an optimally diversified portfolio that does not include leverage.

We use the Brown-Robinson algorithm, which is based on the Von Neumann-Morgenshtern Mini-Max theorem. I.e. according to the above theorem it minimizes losses - drawdown of the portfolio at the given part of history (any other portfolio will give a smaller value of the miniMax, and hence a larger drawdown). It can also be mathematically proved that Brown-Robinson algorithm finds the best arbitrage situations, which took place at the historical period of history processed by the algorithm.

Again. The objective is different. Not selecting instruments for the portfolio, but finding a direction for all instruments in the portfolio so that they hedge each other. An example of such a hedge is a portfolio of instruments for the T101 system.

14 tools. Over the past week, the portfolio balance curve has varied in the 118p range.

 
kharko:

I'll say it again. The objective is different. Not the selection of instruments for the portfolio, but finding the direction for all instruments in the portfolio so that they hedge each other.

Well, R-Portfolio does just that, i.e. it selects the instruments which were hedged (had the best arbitrage over the entire period of historical data) + volumes of investment in these very instruments as a percentage + directions of the instruments.

But not for all instruments, as you set the task, but only for those that are best hedged. The rest of the instruments are cut off by R-Portfolio, as their correlation relations are most likely unstable - not very hedged. That is, R-Portfolio needs to feed the quotes of the instruments to be placed in the portfolio. And it will do the rest on its own.

Just be warned right away that a small number of instruments, and a small number of historical data points (bars) will knowingly lead to a fit.

Reason: