MetaQuotes:
New article Implementing indicator calculations into an Expert Advisor code has been published:
Author: Dmitriy Gizlyk
Blast from the past here.
Very interesting article indeed! Sound and nice concept... but I fear there is a mistake in the distributed software, and it is not good to leave errors around.
Method GetData. Distributed code is:
double CIndicator::GetData(const uint buffer_num,const uint shift) { if(!Calculate()) return EMPTY_VALUE; //--- if((int)buffer_num>=m_buffers) return EMPTY_VALUE; //--- return ar_IndBuffers[buffer_num].At(m_data_len-shift); }
Corrected code should be:
double CIndicator::GetData(const uint buffer_num,const uint shift) { if(!Calculate()) return EMPTY_VALUE; //--- if((int)buffer_num>=m_buffers) return EMPTY_VALUE; //--- return ar_IndBuffers[buffer_num].At(m_data_len-shift - 1); }
Array index starts from 0 and last element has index (m_data_len - 1) instead of m_data_len, isn't it?
rf, section Working with custom indicators of https://www.mql5.com/en/articles/261
Use of Resources in MQL5
- www.mql5.com
MQL5 programs not only automate routine calculations, but also can create a full-featured graphical environment. The functions for creating truly interactive controls are now virtually the same rich, as those in classical programming languages. If you want to write a full-fledged stand-alone program in MQL5, use resources in them. Programs with resources are easier to maintain and distribute.
Hi thanks u somuch
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
New article Implementing indicator calculations into an Expert Advisor code has been published:
The reasons for moving an indicator code to an Expert Advisor may vary. How to assess the pros and cons of this approach? The article describes implementing an indicator code into an EA. Several experiments are conducted to assess the speed of the EA's operation.
Below is what we are going to do to relocate the indicator calculations to an EA.
All the work can be visually summarized as follows.
Author: Dmitriy Gizlyk