how to draw objects in indicator without using index buffers?

 

hi, all.

is it possible to draw objects in indicator by not using the buffers, like in the sample code below?

please help and thank you.

#property version   "1.0"
#property strict
#property indicator_chart_window
//+------------------------------------------------------------------+
//|                         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[])
  {
   int limit=MathMax(rates_total-prev_calculated-2,2);
   for(int i=1;i<limit;i++)
     {     
      if(Low[i]<Low[i+1])
      if(Close[i]>High[i+1])
      {
       ObjectDelete(0,"ARROW_UP");
       ObjectCreate(NULL,"ARROW_UP",OBJ_ARROW_UP,0,Time[i],Low[i]);
       ObjectSet("ARROW_UP",OBJPROP_COLOR,clrBlue);
       ObjectSet("ARROW_UP",OBJPROP_WIDTH,1);
       ObjectSet("ARROW_UP",OBJPROP_BACK,1);
       ObjectSet("ARROW_UP",OBJPROP_RAY,0);
    
       ObjectDelete(0,"ARROW_txt");
       ObjectCreate(NULL,"ARROW_txt",OBJ_TEXT,0,Time[i],Low[i]);
       ObjectSetString(NULL,"ARROW_txt",OBJPROP_TEXT,"Engulf"); 
       ObjectSetString(NULL,"ARROW_txt",OBJPROP_FONT,"Lucida Console"); 
       ObjectSetInteger(NULL,"ARROW_txt",OBJPROP_FONTSIZE,8); 
       ObjectSetDouble(NULL,"ARROW_txt",OBJPROP_ANGLE,-90); 
       ObjectSetInteger(NULL,"ARROW_txt",OBJPROP_ANCHOR,ANCHOR_LEFT); 
       ObjectSetInteger(NULL,"ARROW_txt",OBJPROP_COLOR,clrBlack); 
      }
     }

   return(rates_total);
  }
//+------------------------------------------------------------------+


 

 
Yeah, it's possible, and if you run your code  then right click on the chart > Objects List, you will see that two objects are created.
 
Alexander Chertnik: is it possible to draw objects in indicator by not using the buffers, like in the sample code below? please help and thank you.
  1. Of course, it is.
  2. Your code only draws two (2) objects.
  3. Your loop appears to index as non-series. Your Low/Close/Time access is as-series. Decide which way and adjust to match.
              How to do your lookbacks correctly #9#14 & #19

    You can't use an as-series index in object names as they are not unique. As soon as a new bar starts, you will be trying to create a new name (e.g. "name0"), same, existing, previous, name (e.g. “name0” now on bar one.)

    Use time (as int) or a non-series index:

    #define  SERIES(I)   (Bars - 1 - I) // As-series to non-series or back.
 
Alexander Martinez #:
Yeah, it's possible, and if you run your code  then right click on the chart > Objects List, you will see that two objects are created.

tnx for your reply.

 
William Roeder #:
  1. Of course, it is.
  2. Your code only draws two (2) objects.
  3. Your loop appears to index as non-series. Your Low/Close/Time access is as-series. Decide which way and adjust to match.
              How to do your lookbacks correctly #9#14 & #19

    You can't use an as-series index in object names as they are not unique. As soon as a new bar starts, you will be trying to create a new name (e.g. "name0"), same, existing, previous, name (e.g. “name0” now on bar one.)

    Use time (as int) or a non-series index:

tnx for your reply. im gonna check the lookback.
 
William Roeder #:
  1. Of course, it is.
  2. Your code only draws two (2) objects.
  3. Your loop appears to index as non-series. Your Low/Close/Time access is as-series. Decide which way and adjust to match.
              How to do your lookbacks correctly #9#14 & #19

    You can't use an as-series index in object names as they are not unique. As soon as a new bar starts, you will be trying to create a new name (e.g. "name0"), same, existing, previous, name (e.g. “name0” now on bar one.)

    Use time (as int) or a non-series index:

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

 

Don't double post! You already had this thread open.
          General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)

Reason: