Download MetaTrader 5

indicator color coding - page 2

To add comments, please log in or register
Namthanduan Kahmei
178
Namthanduan Kahmei  

introduced another indicator buffer

this will not be a drawing buffer

but only a calculation buffer

if calculation value is true,assign it to one drawing buffer,and you color your lien

if false,assign to the other drawing buffer and your line color change

whroeder1
16111
whroeder1  
tenlau: Sorry, don't know how to "translate" in code your advice: "At a change in color, both buffers must have the same value."
  1.       dir[1]=dir[0];
    
    This doesn't work. After the initial fill, every tick you set dir[1]=dir[0], so dir[1] is useless. This is what MirFX means by "introduced another indicator buffer"
  2.       if(dir[0]==-1)                                           
    {
             sslup[i]=iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
    if( sslup[i+1] == EMPTY_VALUE ) // start of up line
        ssldn[i] = sslup[i];        // join the lines
    }
          else                                                     
            {                                                      
    //       if(dir[0]==1)          // unnecessary test, can only be up or down.
                ssldn[i]=iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1);
    if( ssldn[i+1] == EMPTY_VALUE ) // start of dn line
        sslup[i] = ssldn[i];        // join the lines
    

12
To add comments, please log in or register