Is it possible to call one derived class into another derived class from the same Base/Parent Class ? if yes how to instantiate the 1st class into 2nd class ? - page 2
![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
Hi agree with the reason, Dominik, it is very limiting. But not with the conclusion, I think using procedural instead of the limited OOP is going way too far.
Hi Amir
I agree with you and already noticing many ways to reduce my coding work by using classes.
regards
Hi Dominik
How about these layer type
StrategyBase as main parent class // TrendBase as derived class from StrategyBase // Breakout as derived class from TrendBase ?
I feel it might work out, however if we have mutiple conditions to include in "Breakout" class this may not be possible. I will give it a try and see if it works out.
Dominik, yes we all are just discussing the subject, nothing personal.
I really appreciate all your responses. May be I have not yet reached to skill level in programming, where I can start facing challenges in OOP as you do. So far in my early stage of learning and development, it is helping me quite well.
and that makes me tempted to "slip" into OOP too much :)
Hi Dominik
I found a simple way to handle my issue.
Created standalone class CTrend.mqh with required parameters for calculation.
Just included this Class into my CStrategyBase.mqh and initialized it. Wollaa from there derived classes of CStrategyBase have all of its methods.
Just thought to share my progress on this matter.
That sounds really good. Very nice.
wow that's really great piece of information in your last reply.
True for MQL I am new and started with v4 then moved to v5 after couple of months. Basically I am a finance professional with a passion for Programming. I had used to work on Oracle Database (including OOP) loooooong back in 1998 till 2000 :). Then my profession in Africa made me loose all connections with programming. It is only in 2020 around April, I was introduced to Forex Trading, and in few months sitting in front of computer and looking for trades, made me realize that this is not my cup of tea.
Then I came to learn about Algorithmic Trading and Trading Robots. Since then I am into it and so far OOP in MQL helping me well with my codes, so keeping it on. What I personally feel that it may not be perfect but with some tweaks it can deliver what you need.
The biggest challenge I had, there was no proper source to learn MQL, and hence I had to rely on forum and youtube tutorials and some paid contents on Udemy.com. But in general not much good knowledge is available for MQL5.
I have been struggling a lot with Custom Indicators and Candle Patterns to try position opening. However it used to work on the time range I look at creating the codes and most of the time if I run EA on different time period, I start loosing out.
about 2/3 months back I come across tutorials from https://www.youtube.com/c/OrchardForex and that totally changed my working style. Yes I could not follow his framework approach, but then when I blended his approach with mine, things are moving smoothly.