Indicator Problem

 
HI please see the above code it is a simple indicator which is not i mean it doesn't showing when i m printing values .Can some body help me ??
#property indicator_chart_window
#property  indicator_buffers 2
extern int period=15;
extern int shift=8;
extern int mode=0;
extern color color1=Blue;
extern color color2=Red;

//--- indicator buffers
double    ExtBuffer1[];
double    ExtBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- drawing settings
    SetIndexBuffer(0,ExtBuffer1);
    SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1,color1);
    SetIndexBuffer(1,ExtBuffer2);
    SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1,color2);
  
   return ;
 }
int start()
{
  int    limit;
 
  if(Bars<period) return(0); 
  int   counted_bars=IndicatorCounted();
  if(counted_bars<0) return(-1);
   
  if(counted_bars>0) counted_bars--;
  limit=Bars-counted_bars-2;
  while(limit>=0)
   {  
   double ma=iMA(NULL,0,period,shift,mode,PRICE_CLOSE,limit);
   double range=Close[limit+1];
   ExtBuffer1[limit]=ma+(range/2);
   ExtBuffer2[limit]=ma-(range/2);
   limit--;
 }
 return;
}
 

Maybe the result is out of the screen :

 ExtBuffer1[limit]=ma+(range/2);

this is not a range, this is something like close[3];

double range=Close[limit+1];
 

In the MetaTrader open the Data Window (Ctrl+D or find it on the View menu).

When you start your indicator, on the Visualisation tab there is "Show in the data window" checkbox. Mark that and then in the data window inspect values your indicator calculates. I tried it on the EUR/USD and as ffoorr wrote, values are out of the window.

 
#property indicator_chart_window
#property  indicator_buffers 2
#property indicator_color1 SkyBlue
#property indicator_color2 DarkOrange
#property indicator_color3 Yellow // DarkOrange
#property indicator_width1 2
#property indicator_width2 2

extern int period=15;
extern int shift=8;
extern int mode=0;

extern int per_range = 200;
//--- indicator buffers
double    ExtBuffer1[];
double    ExtBuffer2[];
double    ma[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- drawing settings
    SetIndexBuffer(0,ExtBuffer1);
    SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);
    SetIndexBuffer(1,ExtBuffer2);
    SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,2);
    
    SetIndexBuffer(2,ma);
    SetIndexStyle (2,DRAW_LINE,STYLE_SOLID);
//------------ 
  return(0) ;
 }
int start()
{
  int    limit;
 
  if(Bars<period) return(0); 
  int   counted_bars=IndicatorCounted();
  if(counted_bars<0) return(-1);
   
  if(counted_bars>0) counted_bars--;
  limit=Bars-counted_bars-2;
  while(limit>=0)
   {  
    ma[limit]=iMA(NULL,0,period,shift,mode,PRICE_CLOSE,limit);
   double range=iATR(NULL,0,per_range, limit); //Close[limit+1];
   ExtBuffer1[limit]=ma[limit]+(range/2);
   ExtBuffer2[limit]=ma[limit]-(range/2);
   limit--;
 }
 return(0);
}
 
ankityadav:
HI please see the above code it is a simple indicator which is not i mean it doesn't showing when i m printing values .Can some body help me ??


Maybe if you explain your problem clearly.

What does

" which is not i mean it doesn't showing when i m printing values"

mean exactly?

I don't see a Print() in your code at all .

 
Maybe he means for showing the buffer output on the chart.
Reason: