iFractals gives strange buffer values

 

Hello,

Following code gives me a number in the -214000000? cant seem to figue out what i do wrong.

Looked through the forum but only found people with the same problems.



double Fractalshigh[];

 double Fractalslow[];

 int Fractaldef=iFractals(_Symbol,_Period);

 ArraySetAsSeries (Fractalshigh,true);

 ArraySetAsSeries (Fractalslow,true);

 CopyBuffer(Fractaldef,0,0,5,Fractalshigh);

 CopyBuffer(Fractaldef,1,0,5,Fractalslow);

 int highFractal = (Fractalshigh[1]);

 int lowFractal =(Fractalslow[1]);

For some reason the buffer values are way off, any help would be appriciated!!

 
traderkoos:

Hello,

Following code gives me a number in the -214000000? cant seem to figue out what i do wrong.

Looked through the forum but only found people with the same problems.



For some reason the buffer values are way off, any help would be appriciated!!

I've found the solution! So i want to thank everybody for their help :P


 double Fractalshigh[];

 double Fractalslow[];

 int Fractaldef=iFractals(_Symbol,_Period);
 
 ArraySetAsSeries (Fractalshigh,true);

 ArraySetAsSeries (Fractalslow,true);
 
 int copiedhigh=CopyBuffer(Fractaldef,0,0,30,Fractalshigh); 
 int copiedlow=CopyBuffer(Fractaldef,1,0,30,Fractalslow); 
   
  
     
   double lasthighfractal;
   double lastlowfractal;
   
   for(int i=2;i<copiedhigh;i++)
     { 
      if(Fractalshigh[i]!=EMPTY_VALUE)
        {  
            lasthighfractal = Fractalshigh[i];
             
              break;
            
        } 
        
        }

   for(int i=2;i<copiedlow;i++)
     { 
      if(Fractalslow[i]!=EMPTY_VALUE)
        {  
            lastlowfractal = Fractalslow[i];
             
              break;
            
        } 
        
        }

Its probably not the best coding but it works, so i hope others with the same problem can learn from this.

 
Thank you.
 
traderkoos #: I've found the solution!
 int Fractaldef=iFractals(_Symbol,_Period);
 
 ArraySetAsSeries (Fractalshigh,true);

 ArraySetAsSeries (Fractalslow,true);
 
 int copiedhigh=CopyBuffer(Fractaldef,0,0,30,Fractalshigh); 
 int copiedlow=CopyBuffer(Fractaldef,1,0,30,Fractalslow); 

Your posted code is without context. Are those lines together, or is the iFractals call in OnInit (where it should be) and the others not? Always post all relevant code (using Code button) or attach the source file.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

Reason: