Discussion of article "Implementing indicator calculations into an Expert Advisor code" - page 2

 

@Dmitriy Gizlyk Very good article. I implemented your code in my EA and realised that the indicator is not plotted on the chart. How do I plot this indicator created inside the EA on the chart?

Thank you.

 

Joao Luiz Sa Marchioro:

I was looking for something like this. Thank you very much. Excellent article.


Hello, did you implement this example? I've implemented it and realised that the indicator isn't plotted on the chart. I've tried and researched various ways but have been unsuccessful. Would it be possible to plot the indicator within the EA code as was done in the study above?

 
a password to fund your account
 
wellingtondala:

@Dmitriy Gizlyk Very good article. I implemented your code in my EA and realised that the indicator is not plotted on the chart. How do I plot this indicator created inside the EA on the chart?

Thank you.

The article presents a method for transferring the mathematical part of an indicator to an advisor. This approach is applicable for speeding up calculations and hiding the indicator from the user. It is not possible to draw an indicator from an Expert Advisor as it is from an indicator. To display it, you'll need to create graphical objects on the chart for each movement. This process will consume a lot of time on the part of the programmer and cost computing resources when used. If you need an indicator on the chart, it doesn't make sense to transfer its code to the advisor; it's easier to use the indicator itself. To transfer the advisor with the indicator with a file, you can use the functionality of the resource.

 

DMITRIY GIZLYK, thanks for the article.

I am interested in the issue of multithreading, is it possible to run the class in parallel on a separate processor core? You mentioned at the end of the article "the advantage can be levelled by MetaTrader 5 multithreaded architecture".

Dmitriy Gizlyk
Dmitriy Gizlyk
  • www.mql5.com
Опубликовал статью Нейросети - это просто Каждый раз, когда речь заходит об искусственном интеллекте, в голове всплывают какие-то фантастические образы и кажется, что это очень сложное и непостижимое. Но мы все чаще и чаще слышим об искусственном интеллекте в повседневной жизни. В новостных лентах все чаще пишут о каких-либо достижениях с...
 
Dmitriy Gizlyk:
Yes, the article says right away that the calculation is based on closed candlesticks. To calculate on each tick, we need to remove the check of opening a new bar from the code and copy the history from "0" bar, not from "1", as it is now.

I understood correctly, to work with the full set of time series data you need to add arrays besides this one:

массив исходных данных для расчета (m_source_data);

That is, if the indicator accesses different bar data - time[], maximum and minimum price high[] low[], then you need to add 3 more arrays analogue to m_source_data and copy the data there in CIndicator::LoadHistory,

and since the function is virtual, can it be rewritten directly in the indicator?

 

Here is where the error occurs if you make more than one buffer

bool CIndicator::SetBufferSize(const int bars)
  {
   if(bars>0)
      m_data_len  =  bars;
   else
      m_data_len  =  Bars(m_Symbol,m_Timeframe);
//---
   if(m_data_len<=0)
     {
      for(int i=0;i<m_buffers;i++)
         ar_IndBuffers[i].Shutdown();
      return false;
     }
//---
   if(m_history_len<m_data_len)
      if(!SetHistoryLen(m_data_len))
         return false;
//---
   for(int i=0;i<m_buffers;i++)
     {
      ar_IndBuffers[i].Shutdown();
      if(!ar_IndBuffers[i].Resize(m_data_len))
         return false;
     }
//---
   return true;
  }

array out of range in 'Indicator.mqh' (156,20)


UPD: I added a line at the beginning of the function and the problem is solved.

ArrayResize(ar_IndBuffers,m_buffers,m_buffers);

 

Thanks so much again for the article, it all worked! The most interesting thing is that it works faster in this version. My arrow indicator uses the request of ticks via CopyTicksRange and CopyTicks functions, which caused a lot of glitches and often led to incorrect data. Through class everything works like clockwork. I connect it with the fact that CopyTicksRange and CopyTicks in indicators work a little differently, the system does not give them time to synchronise.



ps. who will transfer arrow indicators with several buffers, please note that you need to edit the Indicator.mqh functions.

CIndicator::SetHistoryLen(const int bars)

CIndicator::LoadHistory(void)

в зоне protected 

well, and the method of writing and receiving data from indicator buffers ar_IndBuffers is different for the arrowman.

 

Hey guys,

I have an indicator that I have programmed myself in mql5 and I would like to call up the information from the buffer of this indicator inside an EA that I am programming. Could you help me how to do this? Will the codes in the article help me?

Thank you

 
Carlisson Correia :

Staff,

I have an indicator that I have programmed myself in mql5 and I would like to call up the information from the buffer of this indicator inside an EA that I am programming. Could you help me how to do this? Will the codes in the article help me?

Thank you

Good evening

Check out the iCustom feature