Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1684

 
Sorry, Makar, I think you can change it via SetIndexStyle. But I haven't tried it.
 
Aleksei Stepanenko #:
Sorry, Makar, I think you can change it via SetIndexStyle. But I haven't tried it.

SetIndexStyle changes the whole line, not the desired section

MT5 has DRAW_COLOR_LINE for that
 
Right. Do you want a zebra? Then yes.
 
MakarFX #:
I think I'm getting the hang of it, next we tell the code
Buf2[i] = Buf1[i];
else
Buf2[i] = EMPTY_VALUE; we don't need to draw the 3rd line separately
but we can do as the person above suggested adding a condition to our start module only he had the price of open and closs and we have arrays
int start()
  {
   if(Bars<=RSIPERIOD) return(0);
   int ExtCountedBars=IndicatorCounted();
   if (ExtCountedBars<0) return(-1);
   if (ExtCountedBars>0) ExtCountedBars--;
   for(int i=0;i<Bars-RSIPERIOD;i++)
      {
       Buf0[i] = iRSI(NULL,0,D10,0,i);
       Buf1[i] = (iRSI(NULL,0,D11,0,i)+iRSI(NULL,0,D12,0,i))/2;
       if(iRSI(NULL,0,D11,0,i)>iRSI(NULL,0,D12,0,i))
       Buf2[i] = Buf1[i]; 
       else
       Buf2[i] = EMPTY_VALUE;
       if(Buf2[i] < Buf1[i]) 
  SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,clrRed);
      }
   return(0);
  }
string Ds_0(double DOUBLE) {return(DoubleToStr(DOUBLE,0));}








 
Andrey Kipyatkov #:
I think I'm getting the hang of it, next we tell the code
Buf2[i] = Buf1[i];
else - more
Buf2[i] = EMPTY_VALUE; you don't have to draw the 3rd line separately
. We can do as the person above suggested adding the condition to our module, only he had the price of open and closs, while we have arrays

add)))

the result is a single-colored line

 
Andrey Kipyatkov #:
I think I'm getting the hang of it, next we tell the code
Buf2[i] = Buf1[i];
else
Buf2[i] = EMPTY_VALUE; we don't need to draw the 3rd line separately
. We can do as the person above suggested - add a condition to our module, only he had the open and closs price and we have arrays

If you need to change colour on the kinks, then look at this code and take snippets from it

https://www.mql5.com/ru/code/18167

AMA STL Color
AMA STL Color
  • www.mql5.com
Технический индикатор Адаптивное Скользящее Среднее (Adaptive Moving Average, AMA).
 
Vitaly Muzichenko #:

If you want to change the colour on the kinks, then look at this code and take snippets from it

https://www.mql5.com/ru/code/18167

Same thing - EMPTY_VALUE
 
MakarFX #:
Same thing - EMPTY_VALUE
I understand there's no point in adding something if we can set conditions for "superimposing" one line on another simply with a colour different from the first. The function is unnecessary
 
Valeriy Yastremskiy #:

What is the difference? And isn't order numbering from zero rather than one?

From one, OrdersTotal will return zero when there are no orders. But for some reason

for ( int i = OrdersTotal() ; i > 0 ; i -- )

gives an infinite loop, and so >= no.

h.s. is there another more convenient platform for communicating about mql???
 
Nerd Trader #:
h.s. Is there another more convenient platform for communicating about mql???
What's wrong with this one?
Reason: