Improving Documentation

 

It seems that MQl5 Documentation contains some errors and/or misleading information.

So I've started thread to collect such observations in order to help MQ team to amend errors and  improve overall the quality of Documentation.

My personal observation, from which I want to start is about article "DRAW_COLOR_ARROW". There is code example, which contains meaningful part - it includes initialization of color colors[] array, which afterwards is always called with constant "color_sections=8;", and later in code it has no influence of how ColorArrowColors[]is filled with values. MQ, please correct this confusing example.

Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_ARROW
Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_ARROW
  • www.mql5.com
DRAW_COLOR_ARROW - Indicator Styles in Examples - Custom Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Kaysar Sabraimov:
There is code example, which contains meaningful part - it includes initialization of color colors[] array, which afterwards is always called with constant "color_sections=8;", and later in code it has no influence of how ColorArrowColors[]is filled with values.

You don't know and don't understand when reading the program.
So don't say "It seems that MQl5 Documentation contains some errors and/or misleading information."

"There is code example, which contains meaningful part - it includes initialization of color colors[] array, which afterwards is always called with constant "color_sections=8;", and later in the code it has no influence of how ColorArrowColors[]is filled with values.?"

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,ColorArrowBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,ColorArrowColors,INDICATOR_COLOR_INDEX);
//--- Define the symbol code for drawing in PLOT_ARROW
   PlotIndexSetInteger(0,PLOT_ARROW,code);
//--- Set the vertical shift of arrows in pixels
   PlotIndexSetInteger(0,PLOT_ARROW_SHIFT,5);
//--- Set as an empty value 0
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0);   
//---- The number of colors to color the sinusoid
   color_sections=8;   //  see a comment to #property indicator_color1 
//---
   return(INIT_SUCCEEDED);
  }

how ColorArrowColors[]is filled with values?

for(int i=1;i<rates_total;i++)
     {
      //--- If the current Close price is higher than the previous one, draw an arrow
      if(close[i]>close[i-1])
         ColorArrowBuffer[i]=close[i];
      //--- Otherwise specify the null value
      else
         ColorArrowBuffer[i]=0;
      //--- Arrow color
      int index=i%color_sections;
      ColorArrowColors[i]=index;
     }
 
Roberto Jacobs #:

You don't know and don't understand when reading the program.
So don't say "It seems that MQl5 Documentation contains some errors and/or misleading information."

"There is code example, which contains meaningful part - it includes initialization of color colors[] array, which afterwards is always called with constant "color_sections=8;", and later in the code it has no influence of how ColorArrowColors[]is filled with values.?"

how ColorArrowColors[]is filled with values?

Roberto, you just need to be a bit smarter and understand a simple truth - this 2nd part of code is going to work without declaration of colors[] array!

Just delete declaration of colors[] array and enjoin simplified code!

And also you just need to be a bit attentive to notice mismatch between value of "color_sections" constant (=8) and number of colors in colors[] array(=14)!

 
Kaysar Sabraimov #:

Roberto, you just need to be a bit smarter and understand a simple truth - this 2nd part of code is going to work without declaration of colors[] array!

Just delete declaration of colors[] array and enjoin simplified code!

And also you just need to be a bit attentive to notice mismatch between value of "color_sections" constant (=8) and number of colors in colors[] array(=14)!

Much to learn you still have… Padawan.