Download MetaTrader 5

fail to use externalbuffer, please help

To add comments, please log in or register
tomas1983
26
tomas1983  

hello mql4s ppl, sry for my noob quistion. but im stuck on this for 3 days now, il be heppey to be resque.

i have indicador "A" that send exteralbuffer like that:

#property indicator_label1  "USD Blue"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrDodgerBlue
#property indicator_style1  STYLE_SOLID
#property indicator_width1  2

double         Label1Buffer[];

int OnInit()
  {
   SetIndexBuffer(0,Label1Buffer);
   return(INIT_SUCCEEDED);
  }

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 i = 0;
int mybuffer = "doing some calculation here"
Label1Buffer[i] = mybuffer;

  }

 if i print "mybuffer" from indicator "A" i get result "x", if i print it from indicator "B" i get deffernt result...
this is the code for indicator "B":

Print(iCustom(NULL, 0, "indicatorA", 0,0));

 can u tall what im doing worng?
tnx

Carl Schreiber
6989
Carl Schreiber  
tomas1983:

hello mql4s ppl, sry for my noob quistion. but im stuck on this for 3 days now, il be heppey to be resque.

i have indicador "A" that send exteralbuffer like that:

 if i print "mybuffer" from indicator "A" i get result "x", if i print it from indicator "B" i get deffernt result...
this is the code for indicator "B":

 can u tall what im doing worng?
tnx

Why don't you make a normal test by assigning a double value to Label1Buffer[i]?
Ex Ovo Omnia
3261
Ex Ovo Omnia  
tomas1983:

hello mql4s ppl, sry for my noob quistion. but im stuck on this for 3 days now, il be heppey to be resque.

i have indicador "A" that send exteralbuffer like that:

 if i print "mybuffer" from indicator "A" i get result "x", if i print it from indicator "B" i get deffernt result...
this is the code for indicator "B":

 can u tall what im doing worng?
tnx

You need to allocate the buffer with #property indicator_buffers.
Carl Schreiber
6989
Carl Schreiber  
Ovo:
You need to allocate the buffer with #property indicator_buffers.
Wouldn't he get a compiler error or at least a warning?
whroeder1
15331
whroeder1  
nope; lack of a preprocessor directive can't generate a warning.
Zirkon
121
Zirkon  
WHRoeder:
nope; lack of a preprocessor directive can't generate a warning.

Yes it does.

indicator buffers amount is less than needed       

To add comments, please log in or register