Download MetaTrader 5

Need help with drawing arrows, I think I'm having a problem getting the name to re-write? - page 2

To add comments, please log in or register
whroeder1
16084
whroeder1  
gagebrk: but I'm not sure how to have the buffer draw using the individual candles that are found using my criteria.
SetIndexBuffer(0,arrowUp);
SetIndexBuffer(1,arrowDown);  


Put (non-EMPTY_VALUE) prices in your two arrays, the terminal draws them.
gagebrk
66
gagebrk  
whroeder1:
Put (non-EMPTY_VALUE) prices in your two arrays, the terminal draws them.

So mine would look something like this (template taken from the previous post)?

If so, this is starting to make sense! If not, where am I going wrong? If you guys had a good article/documentation on what is going on under the hood, that'd be helpful. Seems like the docs here tell you what is going to happen, but not the why/how behind it..

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
//--- check for rates
   if(rates_total<(my number of candles to draw on #)) return(0);
//--- preliminary calculations
   if(prev_calculated==0) limit=(my number of candles to draw on #);
   else limit=prev_calculated;
//--- the main loop of calculations
   for(i=limit;i<rates_total && !IsStopped();i++)
     {
      start=i-(my number of candles to draw on #);
      arrowUp[i]=(my arrow up logic);
      arrowDown[i]=(my arrow down logic);
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
gagebrk
66
gagebrk  
No...that's not right either. crap.
whroeder1
16084
whroeder1  
You originally had your logic.
void DrawUpArrow()
   {
   int counter = 10000;
   counter = IntegerToString(counter);
   string name = StringConcatenate("LLLCArrow " + counter);
   
   ObjectCreate(name,OBJ_ARROW_UP,0,iTime(NULL,0,1), Low[1]); 
      ObjectSet(name,OBJPROP_COLOR,LLLC_Color);
      ObjectSet(name,OBJPROP_STYLE,STYLE_DASH);
      ObjectSet(name,OBJPROP_WIDTH,1);
      ObjectSet(name,OBJPROP_ANCHOR,ANCHOR_UPPER);
      
   counter = StringToInteger(counter);
   counter += 1;
   }
Just change the drawing method.
void DrawUpArrow()
   {
   arrowUp[1]=Low[1];
   }
Then generalize it
void DrawUpArrow(int i)
   {
   arrowUp[i]=Low[i];
   }
12
To add comments, please log in or register