How to get the value of multiple time frame of an indicator calculating with iMAOnArray - page 2

 

at the moment, I work on the code and finally, I use Label as object

here is the code (simple)

int start()
  {

// here there are a lot of declaration 

//
    

   MM1 = iCustom(NULL,1,"histogramtrend",13,7,0,0); // the value        ExtMapBuffer1 of histogramtrend
       MM1bis = iCustom(NULL,1,"histogramtrend",13,7,1,0); // the moving average        ExtMapBuffer2 of histogramtrend
    
    
       MM5 = iCustom(NULL,5,"histogramtrend",13,7,0,0); // the value    ExtMapBuffer1 of histogramtrend
       MM5bis = iCustom(NULL,5,"histogramtrend",13,7,1,0); // the moving average        ExtMapBuffer2 of histogramtrend


        // I create a function CreerObjet which create object 

        valueM1 = (MM1-MM1bis);
        
        
         normeM1 = CreerObjet("valeurM1",valueM1,297,20,Textcolor1);
         // error 
         if(normeM1==0)
         {
             Print("error: can't create label_object! code #",GetLastError());
         }
           
           // M5
  
        valueM5 = (MM5-MM5bis);
        
        
         normeM5 = CreerObjet("valeurM5",valueM5,365,20,Textcolor5);
         // error 
         if(normeM5==0)
         {
             Print("error: can't create label_object! code #",GetLastError());
         }


           //  the Labels H1 H5 etc ..
       
            // int labelM1,labelM5,labelM15,labelM30,labelH1,labelH4,labelD1,labelW1,labelMN ;
            labelM1= CreerLabel ("labelM1","M1" ,314,2,color_label);
             labelM5 = CreerLabel ("labelM5","M5" ,381,2,color_label);


   return(0);
  }



// function 
  
   int CreerObjet(string label_name,double value_name,int distance_X,int distance_Y,color name_textcolor)
  
   {
   
        int  obj_total = ObjectsTotal();  
   
       if(!ObjectCreate(label_name,OBJ_LABEL,0,0,0))
        {
            Print("error: can't create label_object! code #",GetLastError());
                        return(0);
        
        }
        else
        {
            //ObjectSetText("labelM5",DoubleToStr(valueM5,4),10,"Arial",Black);
            ObjectSetText(label_name,DoubleToStr(value_name,Digits));
            ObjectSet(label_name,OBJPROP_CORNER,0);
            ObjectSet(label_name,OBJPROP_XDISTANCE,distance_X);
             ObjectSet(label_name,OBJPROP_YDISTANCE,distance_Y);
             
                  if(value_name<0)
                  name_textcolor=Red;
                  else if (value_name>0)
                   name_textcolor=Green;
                   else
                    name_textcolor=Orange;
                    ObjectSet(label_name, OBJPROP_COLOR, name_textcolor );
                    
                    return (1);
            
        
        }
  
      
      
   }
   
   //
   int CreerLabel (string label_name,string vrai_nom ,int distance_X,int distance_Y,color name_textcolor)
   
   {
        int  obj_total = ObjectsTotal();  
   
       if(!ObjectCreate(label_name,OBJ_LABEL,0,0,0))
        {
            Print("error: can't create label_object! code #",GetLastError());
                        return(0);
        
        }
        else
        
        {
           
          ObjectSetText(label_name,vrai_nom,8,"Arial",name_textcolor);
          ObjectSet(label_name,OBJPROP_CORNER,0);
            ObjectSet(label_name,OBJPROP_XDISTANCE,distance_X);
             ObjectSet(label_name,OBJPROP_YDISTANCE,distance_Y);
             return(1);
        }
        
        
   
   
   }

and the result is like on the picture, but my next question is how to change the value that is to say how to refresh the value ???? or they refresh automatically because now, the market are closed !!

because if I ask that, I suppose that may there is a problem on this code line

  MM1 = iCustom(NULL,1,"histogramtrend",13,7,0,0); // the value         ExtMapBuffer1 of histogramtrend
       MM1bis = iCustom(NULL,1,"histogramtrend",13,7,1,0); // the moving average        ExtMapBuffer2 of histogramtrend

because MM1 have double as a data type and ExtMapBuffer1 also but the one MM1 is not an array and the other is one .

what do you think ?? the most important is the way to refresh value

thank

Reason: