MT5: someone help for multi color HMA pls

 
Hello
The indicator consists of 2 lines that if it is ascending, for example, green, and if it is descending, it will be another color, for example, red.
I do not know why the lines do not change color.
Help me if you can. Thank
 
Mahdi Heydai :
Hello
The indicator consists of 2 lines that if it is ascending, for example, green, and if it is descending, it will be another color, for example, red.
I do not know why the lines do not change color.
Help me if you can. Thank

Use DRAW_COLOR_LINE. An example can be seen in the code MA Color N Bars

MA Color N Bars

Рис. 1. MA Color N Bars

Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_LINE
Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_LINE
  • www.mql5.com
DRAW_COLOR_LINE - Indicator Styles in Examples - Custom Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Vladimir Karputov:

Use DRAW_COLOR_LINE. An example can be seen in the code MA Color N Bars


Рис. 1. MA Color N Bars

I saw the codes
The problem is that I have 2 lines and I want the colors of each to be different.(2plot)
I Already to create an indicator that has only one line, but now after converting the indicator to 2 lines, the indicator does not work.
 
Mahdi Heydai :
I saw the codes
The problem is that I have 2 lines and I want the colors of each to be different.(2plot)
I Already to create an indicator that has only one line, but now after converting the indicator to 2 lines, the indicator does not work.

1. You never said what exactly is needed. I recommend drawing a picture.

2. All your code must be thrown away, sorry.

 
Vladimir Karputov:

1. You never said what exactly is needed. I recommend drawing a picture.

2. All your code must be thrown away, sorry.

Sorry

My English is a bit weak but I try to explain better.

I want the first image to be the second image.

In fact, each plot has a color change.

I am sending the part of the code that I think does not work with all the code.

Infinite thanks

   for(int a=0; a<rates_total-1 && !IsStopped(); a++)
     {
      HMA1C[a]=HMA1C[a+1];
      if (HMACALCULATE1[a] > HMACALCULATE1[a+1]) HMA1C[a] = 0;
      if (HMACALCULATE1[a] < HMACALCULATE1[a+1]) HMA1C[a] = 1;
      
      HMA2C[a]=HMA2C[a+1];
      if (HMACALCULATE2[a] > HMACALCULATE2[a+1]) HMA2C[a] = 1;
      if (HMACALCULATE2[a] < HMACALCULATE2[a+1]) HMA2C[a] = 0;
     }
 
Mahdi Heydai :

Sorry

My English is a bit weak but I try to explain better.

I want the first image to be the second image.

In fact, each plot has a color change.

I am sending the part of the code that I think does not work with all the code.

Infinite thanks

This is a mistake - you RECALCULATE THE WHOLE HISTORY at every tick

   for(int a=0; a<rates_total-1 && !IsStopped(); a++)
 
Vladimir Karputov:

This is a mistake - you RECALCULATE THE WHOLE HISTORY at every tick

Can you help me fix it?

pls

 
Mahdi Heydai :

Can you help me fix it?

pls

I gave you an example - the example shows how to copy and fill indicator buffers correctly. Just study the example. I give you a homework deadline - until tomorrow.

 
Vladimir Karputov:

I gave you an example - the example shows how to copy and fill indicator buffers correctly. Just study the example. I give you a homework deadline - until tomorrow.

thanks ***
 

Here is your code:

EURUSDDaily

Files:
 
Vladimir Karputov:

Here is your code:


Thank you very much
I read that article, but because my programming language level is low, I realized some of the generality but could not implement it. So I decided to read the mql5 introductory lessons again.
I have a great strategy for this indicator that I will tell you when I have completed it, maybe I got help from you.
Reason: