SetIndexEmptyValue(0,0.0); - am I right: it's needed only once?

To add comments, please log in or register
Carl Schreiber
Moderator
7653
Carl Schreiber  

Hi,

it's just a request for a confirmation.

if I write in my indicator only once in the init() function:

SetIndexBuffer(0,buffer0); 
SetIndexEmptyValue(0,0.0);

then at every new bar the buffer0[0] ist set to 0.0 automatically and NOT to EMPTY_VALUE?

Thanks in advance,

Gooly

whroeder1
17954
whroeder1  
yes
Carl Schreiber
Moderator
7653
Carl Schreiber  

THANKS!

Gooly

Carl Schreiber
Moderator
7653
Carl Schreiber  

But it seems not to be true!??

int init() {
..
   SetIndexBuffer(0,buffer0); 
   SetIndexEmptyValue(0,0.0);
..
}

int start() {
...
if ( buffer0[0] == EMPTY_VALUE ) {
   Print(TimeToStr(TimeCurrent(),TIME_SECONDS),"  eCkeck: buffer0[0] = ",DoubleToStr(buffer0[0],0)," = ",EMPTY_VALUE);
}
..}

and I get once and a while:

2013.05.17 17:15:28    eCheck EURUSD,M15: 18:15:01  eCheck: buffer0[0] = 2147483647 = 2147483647
2013.05.17 17:15:28    eCheck EURUSD,M5:   18:15:01  eCheck: buffer0[0] = 2147483647 = 2147483647

What went wrong?

Is it a bug?

Gooly

whroeder1
17954
whroeder1  
Is it an indicator? Show the the code above init.
Carl Schreiber
Moderator
7653
Carl Schreiber  

ok here the beginning of the iondicator:

#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Red 
#property indicator_color2 DodgerBlue
#property indicator_color3 LawnGreen
#property indicator_color4 White
#property indicator_color5 Gray

// User input
extern int              LongMA_PER=0;
extern int              ShortMA_PER=13;

int MA_Shift=0,minPer=0;

// Buffers
double buffer0[];
double buffer1[];  // 
double buffer2[];  // 
double buffer4[];  // 
double buffer3[];  // 
//----
int ExtCountedBars=0;
int lastcolor=0;
string nameIndi;

double   v, cMA_Short, prB,cMA_Long, Long_PRb;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()  {
   int    draw_begin;

   // indicator buffers mapping, drawing settings and Shift
   // Histogram upArrow Green
   SetIndexBuffer(0,buffer0); 
   SetIndexBuffer(1,buffer1);
   SetIndexBuffer(2,buffer2); 
   SetIndexBuffer(3,buffer3);
   SetIndexBuffer(4,buffer4);

   SetIndexStyle(0,DRAW_HISTOGRAM);

   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   SetIndexEmptyValue(2,0.0);

   
   // Histogram downArrow Red
   SetIndexStyle(1,DRAW_HISTOGRAM);

   // Histogram upArrow Green
   SetIndexStyle(2,DRAW_HISTOGRAM);

   // Moving average line white
   SetIndexStyle(3,DRAW_LINE);

   // Moving average line white
   SetIndexStyle(4,DRAW_LINE);


        if ( Period() != 1 )
           IndicatorDigits(0);
        else
           IndicatorDigits(2);

   if(ShortMA_PER<2) ShortMA_PER = 2;
   draw_begin=ShortMA_PER-1;

   SetIndexDrawBegin(0,draw_begin);
   
   return(0);
}

something wrong?

This indicator is running on M1, M5 and M15 but (now) only M15 is in troubles..???

2013.05.17 22:45:28     eCheck  EURUSD,M15: 23:45:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:45:28     eCheck  EURUSD,M15: 23:45:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:45:28     eCheck  EURUSD,M15: 23:45:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:30:29     eCheck  EURUSD,M15: 23:30:01  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:30:29     eCheck  EURUSD,M15: 23:30:01  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:30:29     eCheck  EURUSD,M15: 23:30:01  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:15:30     eCheck  EURUSD,M15: 23:15:02  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:15:30     eCheck  EURUSD,M15: 23:15:02  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:15:30     eCheck  EURUSD,M15: 23:15:02  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:00:28     eCheck  EURUSD,M15: 23:00:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:00:28     eCheck  EURUSD,M15: 23:00:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 22:00:28     eCheck  EURUSD,M15: 23:00:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:45:29     eCheck  EURUSD,M15: 22:45:01  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:45:29     eCheck  EURUSD,M15: 22:45:01  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:45:29     eCheck  EURUSD,M15: 22:45:01  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:30:28     eCheck  EURUSD,M15: 22:30:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:30:28     eCheck  EURUSD,M15: 22:30:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:30:28     eCheck  EURUSD,M15: 22:30:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:15:28     eCheck  EURUSD,M15: 22:15:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:15:28     eCheck  EURUSD,M15: 22:15:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:15:28     eCheck  EURUSD,M15: 22:15:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:00:28     eCheck  EURUSD,M15: 22:00:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:00:28     eCheck  EURUSD,M15: 22:00:00  eCheck : buffer0[0] = 2147483647 = 2147483647
2013.05.17 21:00:28     eCheck  EURUSD,M15: 22:00:00  eCheck : buffer0[0] = 2147483647 = 2147483647

Regards,

Gooly

To add comments, please log in or register