please as Someone explain how to get an indicator like that : Arrow Style

 

Hello ;

firstly I would like to represent my indicator like that :

it's a great indicator that I found here :https://www.mql5.com/en/code/9402 but my problem is I would like to do the same but instead of moving average, I 'm basing on my own indicator that I call histogramtrend (it' s similar to MACD : there are 2 lines : and when the signal (line 1) cross over his moving average (line 2) it's positif (>0) and if it's opposite line 1 < line 2 it's negatif (<0)

so I think that I can call this indicator by usin Custom Indicator iCutstom () . so I need represent like that in picture when >0 blue and when <0 red . but my real problem is how to do like this, I try to understand the code here :

my first remark of this code (the original) is in he presents 8 buffers :

#property indicator_buffers 8

so as you can see there are 4 different moving average, so 2 buffers for each Moving average . I try to write an other code basing on the original and I would just try one Time frame so I suppose that I need 2 buffers to represent UP and Down . after, I compare the Moving average (1) to Moving average (13) . the code

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1  Blue
#property indicator_color2  Red

extern string MA1            = "The input parameters of the 1st Moving Average";
//----
extern int    MA1.Period     = 13;                // Averaging period.
extern int    MA1.Mode       = MODE_EMA;          // Averaging method.
extern int    MA1.Price      = PRICE_MEDIAN;      // The type of the price used for calculaton of Moving Average.

extern string Wingdings      = "0 -rectangles, 1 - arrows";
extern int    Bar.Wingdings  = 0;
//extern int    Bar.Width      = 0;
//extern color  Bar.Color.Up   = DeepSkyBlue;
extern color  Bar.Color.Down = Red;

//----
extern int    P1.Position    = 4;
//----
extern double Gap            = 0.6;

extern bool   Show.Label     = true;

//----
extern string V.Label        = "Vertical shift for text labels";
//----
extern double V.Shift        = 0.5;
//----
extern string H.Label        = "Horizontal shift for text labels";
//----
extern int    H.Shift        = 20;
//----
//----
double MA1.UP.Buffer[];
double MA1.DN.Buffer[];

//----
double MA0.Buffer.0;
//----

//----
double MA1.Buffer.1;
double MA1.Buffer.0; 

extern color  Text.Color.Up    = DeepSkyBlue;
extern color  Text.Color.Down  = Red;

string Label ="", Short.Name;


//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

    //----
   int Wingdings.UP, Wingdings.DOWN;
   //----
   if(Bar.Wingdings==0) { Wingdings.UP = 167; Wingdings.DOWN = 167; }
   if(Bar.Wingdings==1) { Wingdings.UP = 217; Wingdings.DOWN = 218; }
   if(Bar.Wingdings!=0 && Bar.Wingdings!=1) { Alert("Please enter the correct value for Bar.Wingdings ! (0-3)"); return; }
    
 //----
   SetIndexStyle (0, DRAW_ARROW, STYLE_SOLID,0, Blue);
   SetIndexArrow (0, Wingdings.UP);
   SetIndexBuffer(0, MA1.UP.Buffer);
   SetIndexEmptyValue(0, 0.0);
   
   SetIndexStyle (1, DRAW_ARROW, STYLE_SOLID, 0, Red);
   SetIndexArrow (1, Wingdings.DOWN);
   SetIndexBuffer(1, MA1.DN.Buffer);
   SetIndexEmptyValue(1, 0.0);
  
 SetIndexLabel(0, "1.Buffer.UP");
   SetIndexLabel(1, "1.Buffer.DN");
   IndicatorDigits(0);
   Short.Name = "Alex5757000 - MTF Moving Average";
   IndicatorShortName(Short.Name);



    

   

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
  // int limit ; 
    color Text.Color.1;
   
   //
   
//----
 
 if(counted_bars>0) counted_bars--;
     int Limit = Bars - counted_bars;
          
         
         for(int i=Limit; i>=0; i--)
     {
         
           MA0.Buffer.0 = iMA(NULL, 0, 1, 0, MODE_SMA, PRICE_MEDIAN, i);
           
          MA1.Buffer.0 = iMA(NULL, 0, 13, 0, MODE_EMA,PRICE_MEDIAN, i);
      MA1.Buffer.1 = iMA(NULL, 0, 13, 0,MODE_EMA,PRICE_MEDIAN, i+1);
         
         MA1.UP.Buffer[i] = EMPTY_VALUE;
      MA1.DN.Buffer[i] = EMPTY_VALUE;
          
           if(MA1.Buffer.0 < MA1.Buffer.1)
           MA1.DN.Buffer[i] = Gap * P1.Position + 1.0;
      else                           
          MA1.UP.Buffer[i] = Gap * P1.Position + 1.0;
          
          
         
         
         }
 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

the result is like this

as you can see there are 2 lines or in the original code there are 1 for each moving average . may be he ajusts the 2 line to be one but how ????

my second remark is in each line we saw that it changes color sometimes blue and sometimes red so I would like to answer if it 's possible to change the color of one buffer according to condition :

for example :

 // here i the buffer as default it ' s blue 
SetIndexStyle (0, DRAW_ARROW, STYLE_SOLID,0, Blue);
   SetIndexArrow (0, Wingdings.UP);
   SetIndexBuffer(0, MA1.UP.Buffer);
   SetIndexEmptyValue(0, 0.0);

// 
 something like this 
           if line 1 > line 2
               MA1.UP.Buffer  = Blue ;

           else 

                  MA1.UP.Buffer  = Red ;

       

           

because here (in the original he creates one buffer for UP and one for Down .

My second problem and my second question is how can ajust the buffer (horizontal and vertical axes ) as you can see at the 2 pictures : the line on my code is on the top then in the original he adjusts it well .

if I resume : I would present my own indcator (in one file ) like this (first picture) my indicator is similar to macd (2 lines : if line 1 > line 2 : blue so if not red )

my first problem is on the creating Arrow and also adjusting it at the true position .

that 's my problem and thank you for your answer .