Discussing the article: "Formulating Dynamic Multi-Pair EA (Part 2): Portfolio Diversification and Optimization"
Good morning, I'm trying to run the expert but I have the following error when the tester starts.
![]()
I seem stochastic oscillator works well on graph.

Could you help me? Thank you
Good morning, I'm trying to run the expert but I have the following error when the tester starts.
I seem stochastic oscillator works well on graph.
Could you help me? Thank you
- 2018.08.13
- mohsen bahrami
- www.mql5.com
Thank you for trying to help us, unfortunately I do not understand what I need to do in order to bypass this error.
Great Article! I'm going to try it tomorrow. I'm interested to know why you used such a strange time period for the strategy tester. I would have expected full months in 2024. I like your concept of the trailing stop loss, I am using the same technique. One wrinkle I have made is to also attempt to minimize the loss if the trade turns negative after almost reaching breakeven.
Cheers and keep the articles coming, they are great
CapeCoddah
Good morning, I'm trying to run the expert but I have the following error when the tester starts.
I seem stochastic oscillator works well on graph.
Could you help me? Thank you
Each input currency should be separated only by a comma. Do not put a space between currencies
Hi Again,
I have tried to use your system on an active chart and have found a couple of improvements
Alberto's problem was probably he did not have all pairs in the symbol list on his market watch window, ctlM. I got that error also with XAUUSD
Instead of ArraySize(... for For statements, use Num_symbls, a little quicker. Also I have found that spelling out full names helps others understand your code better and also prevents a lot of yntax errors, e.g. Number_Symbols is better in my opinion than Num_symbls.
DisplayObjects was not in the code, I added it.
In display objects, I added a condition to select only the chart symbol. Enumerating through the others is not required and will clutter up the screen. But maybe I am missing something.
Finally there is a problem with the Range Calculation. On an active chart, not in the Strategy Tester, Starting the EA produces a ray that is beyond the current date in the future. For example starting on 4/30 produces a ray that starts on 4/30 10am and ends on 5/1. This results in a non visible ray that doesn't show on the chart but does show in the Objects List. I'll let you fix this one.
I'm attaching my code for your use
Cheers, CapeCoddah
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check out the new article: Formulating Dynamic Multi-Pair EA (Part 2): Portfolio Diversification and Optimization.
Portfolio Diversification and Optimization strategically spreads investments across multiple assets to minimize risk while selecting the ideal asset mix to maximize returns based on risk-adjusted performance metrics.
One of the most persistent challenges in professional trading lies in maintaining portfolio consistency and robust risk management protocols. Traders often exhibit over-reliance on singular assets or strategies, heightening exposure to substantial draw-downs during abrupt shifts in market regimes. Compounding this risk is the prevalent tendency to over-leverage correlated instruments, which amplifies the likelihood of concurrent losses and undermines the stability of returns. Absent a rigorously diversified and optimized portfolio, traders face erratic performance outcomes, often precipitating emotion-driven decision-making and volatile profitability. A systematic framework that strategically balances risk-adjusted returns across a spectrum of uncorrelated assets is therefore indispensable for sustainable long-term performance.
To mitigate these challenges, a quantitative methodology integrating portfolio optimization, multi-asset diversification, and a breakout trading strategy enhanced by oscillator-based confirmation offers a robust solution. By deploying a breakout strategy across multiple currency pairs, traders can capitalize on high-probability momentum-driven price movements while dispersing risk through exposure to non-correlated markets. The integration of an oscillator indicator serves to validate entry signals, minimizing false breakout participation and curtailing unproductive trades. This approach not only elevates profit potential but also fortifies portfolio stability by systematically exploiting opportunities across divergent market phases. The resultant strategy demonstrates heightened resilience to volatility, ensuring consistent performance alignment with evolving macroeconomic and technical conditions.
Author: Hlomohang John Borotho