Download MetaTrader 5
To add comments, please log in or register
Learn operation principles of Trading Signals for MetaTrader.
mrmedia
342
mrmedia 2014.10.18 04:57 

How do you find the current indicator width?

I want to preserve the changes rather than go with defaults.

            color tmpcolor1 = indicator_color1;
            color tmpcolor2 = indicator_color2;
            color tmpcolor3 = indicator_color3;
            color tmpcolor4 = indicator_color4;
            color tmpcolor5 = indicator_color4;
            
            
            int iwidth1 = indicator_width1;
            int iwidth2 = indicator_width2;
            int iwidth3 = indicator_width3;
            int iwidth4 = indicator_width4;
            int iwidth5 = indicator_width5;               
            

 
                    
          if(MyColour!=Black)
          {
             tmpcolor1 = MyColour;
             tmpcolor2 = MyColour;
             tmpcolor3 = MyColour;
             tmpcolor4 = MyColour;
             tmpcolor5 = MyColour;
          }
          
                                      

            SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,tmpcolor1);
            SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2,tmpcolor2);
            SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2,tmpcolor3);
            SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2,tmpcolor4);
            SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,2,tmpcolor5);

.

But cannot work out how

Conversely, how do you change just the color.



.

.

.

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.10.18 05:24  
Go with the defaults and then do the changes. You need to have base knowledge of the indicator.
mrmedia
342
mrmedia 2014.10.18 06:27  
deysmacro:
Go with the defaults and then do the changes. You need to have base knowledge of the indicator.

I got it .....

just allow for manual color and width 


#property indicator_buffers 5
#property indicator_color1 FireBrick
#property indicator_color2 FireBrick
#property indicator_color3 FireBrick
#property indicator_color4 FireBrick
#property indicator_color5 FireBrick
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 3
#property indicator_width4 1
#property indicator_width5 1



extern color   MyColour       = FireBrick;
extern int   MyWidth1       = 1;
extern int   MyWidth2       = 1;
extern int   MyWidth3       = 3;
extern int   MyWidth4       = 1;
extern int   MyWidth5       = 1;
 

int init()
  {

        
            color tmpcolor1 = indicator_color1;
            color tmpcolor2 = indicator_color2;
            color tmpcolor3 = indicator_color3;
            color tmpcolor4 = indicator_color4;
            color tmpcolor5 = indicator_color4;
        
          
            
            int iwidth1 = indicator_width1;
            int iwidth2 = indicator_width2;
            int iwidth3 = indicator_width3;
            int iwidth4 = indicator_width4;
            int iwidth5 = indicator_width5;               
            

   
                    
          if(MyColour!=FireBrick)
          {
             tmpcolor1 = MyColour;
             tmpcolor2 = MyColour;
             tmpcolor3 = MyColour;
             tmpcolor4 = MyColour;
             tmpcolor5 = MyColour;
          }
         
          
         
         if( MyWidth1!=iwidth1 )
          {
             iwidth1 = MyWidth1;
          }
         if( MyWidth2!=iwidth2 )
          {
             iwidth2 = MyWidth2;
          }
         if( MyWidth3!=iwidth3 )
          {
             iwidth3 = MyWidth3;
          }
         if( MyWidth4!=iwidth4 )
          {
             iwidth4 = MyWidth4;
          }
         if( MyWidth5!=iwidth5 )
          {
             iwidth5 = MyWidth5;
          }                                                            
        
 
            SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,iwidth1,tmpcolor1);
            SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,iwidth2,tmpcolor2);
            SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,iwidth3,tmpcolor3);
            SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,iwidth4,tmpcolor4);
            SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,iwidth5,tmpcolor5);

 }
/
To add comments, please log in or register