Discussion of article "MQL5: Create Your Own Indicator" - page 4

 
Hello, someone could explain me in
r+s-1

why

-1

please?

Thanks so much.

 
Antonio Jesus Martin Ruiz:
Hello, someone could explain to me in

why

please?

Thanks so much.

Yeah, it's easier to learn Russian.

 
As a "basic student" of robot creation, practically every article or video I've watched, its author makes the following claim:_ Every indicator has a handle...
Considering this excellent article, which is already part of my study texts, which situations is this statement true for? How do I create a handle for this indicator?
Can someone help me?
 

I am with @okwh. I am still baffled why the loop starts with 1?

I've read the article that was pointed by @Rashid Umarov. It did say this :

The default indexing of all arrays and indicator buffers is left to right. The index of the first element is always equal to zero. Thus, the very first element of an array or indicator buffer with index 0 is by default on the extreme left position, while the last element is on the extreme right position.

 
Thank your very much for this useful article. As a beginner using the MT5 platform, and as @Wolfgang pointed out, those of us who are not professional coders really depend on these types of articles to get familiarized with the inner workings of the language.
 
Great article!! I simply loved all the details and learned a lot from it! Thank you. Great job.
 
dhermanus #:

I am with @okwh. I am still baffled why the loop starts with 1?

I've read the article that was pointed by @Rashid Umarov. It did say this :

The default indexing of all arrays and indicator buffers is left to right. The index of the first element is always equal to zero. Thus, the very first element of an array or indicator buffer with index 0 is by default on the extreme left position, while the last element is on the extreme right position.

Because in this particular example, the indicator needs to calculate the Close[1]-Close[0]. Then, if the start is equal 0, that would cause the indicator to calculate a negative index: Close[0] - Close[-1]. That's why the start must be 1. So the indicator will calculate: Close[1] - Close[0]. Somenthing like: Close[start] - Close[start-1] written on the code.

 
okwh #:

   for(int i=1;i<rates_total;i++)
     {
      MTMBuffer[i]=price[i]-price[i-1];
      AbsMTMBuffer[i]=fabs(MTMBuffer[i]);
     }

 

Why use [i-1] to calculate [i] and start i=1 ?  no [0] ?

  MTMBuffer[i]=price[i]-price[i-1];

Because in this particular example, the indicator needs to calculate the Close[1]-Close[0]. Then, if the start is equal 0, that would cause the indicator to calculate a negative index: Close[0] - Close[-1]. That's why the start must be 1. So the indicator will calculate: Close[1] - Close[0]. Somenthing like: Close[start] - Close[start-1] written on the code.
 
Does this exist in German? 
Searching for "Wie man einen eigenen Indikator erstellt" yielded a lot of results, however not from 2010.
 
Tobias Johannes Zimmer #:
Does this exist in German? 
Searching for "Wie man einen eigenen Indikator erstellt" yielded a lot of results, however not from 2010.

From the article itself you can switch between the different available languages.

https://www.mql5.com/de/articles/10

MQL5: Erstellen Ihres eigenen Indikators
MQL5: Erstellen Ihres eigenen Indikators
  • www.mql5.com
Was ist ein Indikator? Es ist ein Satz berechneter Werte, die auf praktische Weise auf dem Bildschirm angezeigt werden sollen. Sätze von Werten werden in Programmen als Arrays dargestellt. Somit bedeutet das Erstellen eines Indikators, einen Algorithmus zu schreiben, der bestimmte Arrays bearbeitet (Preis-Arrays) und die Ergebnisse der Bearbeitung für andere Arrays (Indikator-Arrays) aufzeichnet. Durch die Beschreibung der Erstellung des True Strength Index zeigt der Autor, wie Indikatoren in MQL5 geschrieben werden.