![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Tried to create my own share portfolio calculation programme. Optimisation by the minimax method (modified for quotes).
Two portfolios are taken for calculation: Long - only for long positions and Short - only for short positions. It is assumed that $100 needs to be allocated to the Long portfolio and $100 to the Short portfolio. Here are the results:
Note:
All calculations are based on net closing prices, excluding spreads, swaps and commissions.
The first column is the proportion in $ for equities (or by analogy, as a percentage investment).
Second column - profit
Third column - financial instrument (shares)
Total - total profit of the portfolio.
At first I could not understand why the optimization would include knowingly losing shares into the portfolio, i.e. expected payoff from which is negative. Then I found out that if these loss-making shares were removed, the final result would surely increase but it would lead to deep equity drawdowns.
to Neutron
Pulled up my archives, that's right, using such a linear model gives total bullshit. Nothing works. So, I don't share your "unhealthy" optimism.
to Reshetov
Now that's interesting, just can't figure out what's done. It looks like a "toad". And I also cannot compare two phrases "I tried to create my own program" and "At first I couldn't understand why the optimization includes knowingly losing shares in the portfolio". You just used some external optimization model or some "closed box with some intelligence stuffed in it" - say, HC or GA. But still I don't understand why the "algorithm by itself" shoves something somewhere. If this is the NS, then on what data were trained (ie where did they get the most "optimal score").
Calculated on the basis of 130 half-hour bars, i.e. for the last two weeks - 10 trading sessions in 35 financial instruments (32 stocks of the Dow Jones Industrial Average and 3 index stocks) using the improved Laplace criterion.
Optimization implies a criterion between the maximum return of each dollar invested and the minimum drawdown of the deposit. Therefore one should not be surprised if some assets are added to the portfolio that were known to incur losses during the examined period, as their role is hedging, i.e. mitigating the risk of a deposit drawdown. Loss-making and profitable assets in the portfolio will always have the highest negative correlation. However, not necessarily loss-making and profitable assets. If the portfolio only consists of profitable assets, the negative correlation between high-yielding and low-yielding assets is still taken into account. In that case low-yielding assets will perform a hedging role for high-yielding assets.
The calculations do not take into account: spreads, brokerage commissions, dividends and intersession swaps. All calculations are based on the Bid price of the assets, i.e. without leverage.
It is assumed that an investor has USD 100, which should be optimally invested in American stock market assets - the first column of the table. The resulting number must be divided arithmetically by the value of the asset to obtain the required number of shares.
Contrary to other valuations, in this case not only the Buy and Hold strategy is considered, but also short selling of assets.
Portfolio calculation time: Sun Dec 14 14:07:06 PKT 2008 +5 GMT
(or US dollars,
if you intend to invest
$100)
based on
10 previous
trading sessions
Short Sell
Short sell
Short sale
Short sale
Short sale
Short Sell
to Neutron
Now that's interesting, just can't figure out what's done. It looks like a "toad".
Doesn't matter what it's done on. In fact the final result is in Java application. But it can be implemented in MQL4 with relevant loss of speed, which at the moment is not quite acceptable, since it is difficult to fit the calculations into the timeframe between trade sessions. So far the implementation is in two programming languages: The Java application launches the MT4 terminal specifying the Expert Advisor in MQL4 in the command line. The Expert Advisor downloads quotes and pre-processes them. It stores the results in a file. After the script is processed the terminal is automatically unloaded and the Java program receives the terminal shutdown code and takes data from the file and performs the optimization. The results are then displayed in the application window and in the file as a web page.
to Neutron
Was it just an external optimization model or some kind of a "closed box with intelligence stuffed into it" - say, HC or GA? But still I don't understand why the "algorithm by itself" shoves something somewhere. If it is NS, on what data were trained (i.e. where did they get the most "optimal score")?
This is optimization of the payment matrix by criteria. I.e. not GA, since GA finds a single extremum and therefore is a fitting one. The best, i.e. the only one at the return extremum, asset can be found much easier, namely, to divide profit for the period under review by the initial share price - momentum oscillator and invest there where the maximum result is obtained. I.e. optimization by additional algorithms to find the maximum return is redundant, because there is only one solution. As for neural networks, there is no sense either, because it is not clear at all what to feed into inputs.
The optimization comes into play when besides maximum profitability we need to consider the risk of drawdown. Considering the above and the minimax theorem, the optimal solution found may not be the only one (the theorem states that there is at least one solution).
to Reshetov
Struggling with the crisis, I missed your answer :o). Thanks for the clarification.
...Т.е. оптимизация дополнительными алгоритмами для поиска максимальной доходности излишняя, поскольку решение единственное... Смысл оптимизации проявляется тогда, когда необходимо помимо максимальной прибыльности еще и учитывать риск просадок.
I wrote that I will take into account much more parameters including not only drawdown but also risk of the operation itself. And the model is in fact more complex - in the picture I have shown a <part of segments>:
The clients are "sequentially" in different instruments, with different correlation of their characteristics (all that variety described earlier) and start times. And it already starts to make sense - to take into account the future "theoretical" profit from each deal in optimization. So, the search for the optimal one is quite relevant and it seems that LP is the only and effective tool. So far, without much explanation (it seems obvious), but here appears such a graph of predicted trades (in some sense, very conditionally):
Where branching is decision making for opening of new trades (including "overflow" of profit by "channels", or rather by assets). Well, it is a long story, so far this is brief. I hope (if time is OK) I will post more detailed studies soon.
As for neural networks, there is no sense too, because it is not clear what to feed on inputs.
I agree
I reread my post and decided to clarify the appearance of the graph just in case. Everything should be clear here by now:
And that's what I'm running LP on - very interesting results :o)
Is the topic still relevant? Has goal (multicriteria) programming been considered for optimal asset management? (instead of linear)
Of course it is, if you have something to say, in the sense of offering.
A target programming problem is a problem about the optimal composition, under given constraints. That is, if there are several, possibly conflicting, linear target functions, then target programming can be used to find a compromise solution. I didn't use this method for asset management, but I thought it could be used here as well. It differs from linear programming in that linear programming implies a single TF, while goal programming implies several.