How to draw multiple objects without using buffers?

 

hi everybody!

i'm trying to draw multiple objects in the indicator without using buffers.

in the example code below, there is only 2 objects created.

please help to understand how to create multiple objects. thank you.


//+------------------------------------------------------------------+
//|                                           candlePatternIndicator |
//+------------------------------------------------------------------+
#property version   "1.0"
#property strict
#property indicator_chart_window

//+------------------------------------------------------------------+
//|                           on init                                |
//+------------------------------------------------------------------+
int OnInit()
  {
         
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                         on calculate                             |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {   
   for(int i=0; i<1000; i++)
     {      
      if(Close[i+1]>Open[i+1])
      if(Close[i]<Open[i])
      if(Close[i]<Low[i+1])
      if(High[i]>High[i+1])         
      {
       ObjectDelete(0,"ARROW3_DOWN");
       ObjectCreate(NULL,"ARROW3_DOWN",OBJ_ARROW_DOWN,0,Time[i],High[i]);
       ObjectSetInteger(NULL,"ARROW3_DOWN",OBJPROP_ANCHOR,ANCHOR_BOTTOM); 
       ObjectSet("ARROW3_DOWN",OBJPROP_COLOR,clrGreen);
       ObjectSet("ARROW3_DOWN",OBJPROP_WIDTH,1);
       ObjectSet("ARROW3_DOWN",OBJPROP_BACK,1);
       ObjectSet("ARROW3_DOWN",OBJPROP_RAY,0);
    
       ObjectDelete(0,"ARROW3_txt2");
       ObjectCreate(NULL,"ARROW3_txt2",OBJ_TEXT,0,Time[i],High[i]+100*Point);
       ObjectSetString(NULL,"ARROW3_txt2",OBJPROP_TEXT,"Engulf"); 
       ObjectSetString(NULL,"ARROW3_txt2",OBJPROP_FONT,"Orator Std"); 
       ObjectSetInteger(NULL,"ARROW3_txt2",OBJPROP_FONTSIZE,8); 
       ObjectSetDouble(NULL,"ARROW3_txt2",OBJPROP_ANGLE,-90); 
       ObjectSetInteger(NULL,"ARROW3_txt2",OBJPROP_ANCHOR,ANCHOR_RIGHT); 
       ObjectSetInteger(NULL,"ARROW3_txt2",OBJPROP_COLOR,clrBlue); 
      }
      
    }   
   return(rates_total);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+  
 
Alexander Chertnik:

hi everybody!

i'm trying to draw multiple objects in the indicator without using buffers.

in the example code below, there is only 2 objects created.

please help to understand how to create multiple objects. thank you.


Only two objects are created because you are only using two names. Add index to the string name of the objects
 
Navdeep Singh #:
Only two objects are created because you are only using two names. Add index to the string name of the objects

i think, i got it.. thanks a lot for the reply and the help.

 

Don't double post! You already had another thread open.

          General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)