- Mt5 code MTF supplement
- Metatrader 5 coding questions / issues
- Array resize bug in beta build 530
There is nothing stopping you from calculating indicator values yourself. You create dynamic arrays and calculate indicator values for each bar, plus manage the sizes of the arrays.
Use OOP if you want to use OOP. Don't use OOP if you don't want to use OOP😄
But in this case there is a lot more work involved. Especially in MQL5 Expert Advisors, where there are no ready-made arrays with price data and, in addition to emulating indicator buffers, you need to take care of correct copying of bar prices.
There is nothing stopping you from calculating indicator values yourself. You create dynamic arrays and calculate indicator values for each bar, plus manage the sizes of the arrays.
Use OOP if you want to use OOP. Don't use OOP if you don't want to use OOP😄
Okay, can you explain? I figured it was necessary if I wanted to use the CExpertSignal system to create EAs from custom indicators with the wizard system.
class CSignalRSI : public CExpertSignal { protected: CiRSI m_rsi; // object-oscillator //--- adjusted parameters int m_periodRSI; // the "period of calculation" parameter of the oscillator ENUM_APPLIED_PRICE m_applied; // the "prices series" parameter of the oscillator //--- "weights" of market models (0-100) int m_pattern_0; // model 0 "the oscillator has required direction" int m_pattern_1; // model 1 "reverse behind the level of overbuying/overselling" int m_pattern_2; // model 2 "failed swing" int m_pattern_3; // model 3 "divergence of the oscillator and price" int m_pattern_4; // model 4 "double divergence of the oscillator and price" int m_pattern_5; // model 5 "head/shoulders" ...
It uses classes like CiRSI etc. These have the same structure, no?
//+------------------------------------------------------------------+ //| Class CiRSI. | //| Purpose: Class of the "Relative Strength Index" indicator. | //| Derives from class CIndicator. | //+------------------------------------------------------------------+ class CiRSI : public CIndicator { protected: int m_ma_period; int m_applied; public: CiRSI(void); ~CiRSI(void); //--- methods of access to protected data int MaPeriod(void) const { return(m_ma_period); } int Applied(void) const { return(m_applied); } //--- method of creation bool Create(const string symbol,const ENUM_TIMEFRAMES period,const int ma_period,const int applied); //--- methods of access to indicator data double Main(const int index) const; //--- method of identifying virtual int Type(void) const { return(IND_RSI); } protected: //--- methods of tuning virtual bool Initialize(const string symbol,const ENUM_TIMEFRAMES period,const int num_params,const MqlParam ¶ms[]); bool Initialize(const string symbol,const ENUM_TIMEFRAMES period,const int ma_period,const int applied); };
All he is doing is mimic the structure, just with iCustom, right? What else should be done?
Okay, can you explain? I figured it was necessary if I wanted to use the CExpertSignal system to create EAs from custom indicators with the wizard system.
It uses classes like CiRSI etc. These have the same structure, no?
All he is doing is mimic the structure, just with iCustom, right? What else should be done?
Where is this conclusion argued ?
My posts (see the search engine) and opinion are exactly the reverse : in general, it's not worth the trouble to implement indicators directly in the EA.
Where is this conclusion argued ?
My posts (see the search engine) and opinion are exactly the reverse : in general, it's not worth the trouble to implement indicators directly in the EA.
There is nothing stopping you from calculating indicator values yourself. You create dynamic arrays and calculate indicator values for each bar, plus manage the sizes of the arrays.
Use OOP if you want to use OOP. Don't use OOP if you don't want to use OOP😄
I respect all your opinions, but I think I think I chose a pretty simple and straightforward question. Is there a way to get indicator values into an EA with OOP that doesn't use iCustom or CopyBuffer? An Indicator is a certain entity in MQL and calling one is a fairly obvious task. I would like to remind you that I did not ask if an indicator calculation could be done directly in an EA, although I am aware of the restrictions of mql indicator thread management, as well as the obvious flaws of CiIndicator classes like the DEFAULT_BUFFER_SIZE of 1024.
While it is interesting to have experienced developers talk about such details please respect that this was not the question asked.
I respect all your opinions, but I think I think I chose a pretty simple and straightforward question. Is there a way to get indicator values into an EA with OOP that doesn't use iCustom or CopyBuffer? An Indicator is a certain entity in MQL and calling one is a fairly obvious task. I would like to remind you that I did not ask if an indicator calculation could be done directly in an EA, although I am aware of the restrictions of mql indicator thread management, as well as the obvious flaws of CiIndicator classes like the DEFAULT_BUFFER_SIZE of 1024.
While it is interesting to have experienced developers talk about such details please respect that this was not the question asked.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use