Use DRAW_COLOR_LINE and DRAW_COLOR_HISTOGRAM together - page 2

 
Alain Verleyen:

Are you ever listening the answers ?

Plot indexed 2 to 6 DOESN'T EXIST.

Thanks for the clarification...  I actually thought I was reading and studying the answers, trying to make them line up with the MQL5 Reference "Connection between Indicator Properties and Corresponding Functions" topic.  I now see where you have illustrated "PlotIndexSet...(1,..." where I had it as 2, and that does line up with the reference's statement:
     "numeration of levels and plots in preprocessor terms starts with one, while numeration of the same properties at using functions starts with zero, i.e. the indicated value must be by 1 less than that indicated for #property."
which I recognize as the same as was in MQ4.

I see the assertion that the PlotIndex... argument "plotting style index"  is not the same as the SetIndexBuffer argument "buffer index" and I have just been 'lucky' at setting colors and widths, I guess.

This leaves me wondering though, for example if I wanted to set Index Buffer 5's empty value to -1, it appears this will not work:

SetIndexBuffer(5,g_calcOne,INDICATOR_CALCULATIONS);
      PlotIndexSetDouble(5,PLOT_EMPTY_VALUE,-0.1); //(Not a direct replacement for MQ4's SetIndexEmptyValue ?)

This will be a relatively easy experiment.

 
LukeB:

Thanks for the clarification...  I actually thought I was reading and studying the answers, trying to make them line up with the MQL5 Reference "Connection between Indicator Properties and Corresponding Functions" topic.  I now see where you have illustrated "PlotIndexSet...(1,..." where I had it as 2, and that does line up with the reference's statement:
     "numeration of levels and plots in preprocessor terms starts with one, while numeration of the same properties at using functions starts with zero, i.e. the indicated value must be by 1 less than that indicated for #property."
which I recognize as the same as was in MQ4.

I see the assertion that the PlotIndex... argument "plotting style index"  is not the same as the SetIndexBuffer argument "buffer index" and I have just been 'lucky' at setting colors and widths, I guess.

This leaves me wondering though, for example if I wanted to set Index Buffer 5's empty value to -1, it appears this will not work:

SetIndexBuffer(5,g_calcOne,INDICATOR_CALCULATIONS);
      PlotIndexSetDouble(5,PLOT_EMPTY_VALUE,-0.1); //(Not a direct replacement for MQ4's SetIndexEmptyValue ?)

This will be a relatively easy experiment.

There is no sense to set a plot empty value when there is not plot.

 
Alain Verleyen:

There is no sense to set a plot empty value when there is not plot.

But, I have looked for values not the empty value in MQ4 worlds equivalent of "INDICATOR_CALCULATIONS".
I had referred to:
    https://www.mql5.com/en/articles/81
and found this listed as equivalence:
   MQL4: void SetIndexEmptyValue(int index, double value)
   MQL5:  bool PlotIndexSetDouble(index,PLOT_EMPTY_VALUE,value)
Which appears to be not true, as I inserted this which displayed 0.0000 (For Any Value N):

// in OnInit
PlotIndexSetDouble( N ,PLOT_EMPTY_VALUE, 27.0); // For Any Value N
.....
   // followed by this in OnCalculate:
   static datetime lastBarZeroTime=NULL;
   static int callCount=0; callCount++;
   datetime barZeroTime=iTime(_Symbol,PERIOD_CURRENT,0);
   if (barZeroTime != lastBarZeroTime)
    {
      Comment("CalcOne Empty Value: "+DoubleToString(g_calcOne[0],_Digits)+" : "+IntegerToString(callCount));
      lastBarZeroTime = barZeroTime;
    }
Migrating from MQL4 to MQL5
Migrating from MQL4 to MQL5
  • www.mql5.com
This article is a quick guide to MQL4 language functions, it will help you to migrate your programs from MQL4 to MQL5. For each MQL4 function (except trading functions) the description and MQL5 implementation are presented, it allows you to reduce the conversion time significantly. For convenience, the MQL4 functions are divided into groups, similar to MQL4 Reference.