MultiTF indicator error 4806

 

Hi guys,

I researched every single topic i could find on the issue, and only when i checked everything i found im writing. I am experiencing a massive headache as a result of getting the unresolvable "for me" error 4806. 

Now i have an MQL5 indicator to put a number of different TF BB on a single chart, at first this seems a fairly easy task. I initialize all the different TF BB handles on OnInit, and get the values with CopyBuffer with an external function.

But when i try to take the values from BB from m15, while the indicator is at a M5 chart, iget 4806.

This is some code i use to achieve what i described. One more thing - to find the specific index of a bar from a higher TF i made a function, lets assume we will run the indicator at M5 and this will be our lowest TF.

int OnInit()
  {
//--- indicator buffers mapping
   BB_M5 = iBands(_Symbol,PERIOD_M5,BBperiodM5,0,BBdevM5,BBpriceM5);
   BB_M15 = iBands(_Symbol,PERIOD_M15,BBperiodM15,0,BBdevM15,BBpriceM15);
   BB_H1 = iBands(_Symbol,PERIOD_H1,BBperiodH1,0,BBdevH1,BBpriceH1);
   BB_D1 = iBands(_Symbol,PERIOD_D1,BBperiodD1,0,BBdevD1,BBpriceD1);
   SetIndexBuffer(0,bbm5);
   SetIndexBuffer(1,bbm15);
   SetIndexBuffer(2,bbh1);
   SetIndexBuffer(3,bbd1);

This goes into onCalculate

   for(int i = limit; i>=0; i--)
     {
      datetime time = iTime(_Symbol,0,i);
      int m5time = FindBar(PERIOD_M5,time);
      bbm5[i] = bbM5(0,m5time);

      int m15time = FindBar(PERIOD_M15,time);
      bbm15[i]=bbM15(0,m15time);
      Print("bbm15 m15time  ",m15time," ",DoubleToString(bbm15[i],Digits()));
      int h1time = FindBar(PERIOD_H1,time);
      bbh1[i]=bbH1(0,h1time);

      int d1time = FindBar(PERIOD_D1,time);
      bbd1[i]=bbD1(0,d1time);

     }

This is how i get the BB value

double bbM5(int mode,int shift)
  {
   double value[];
   ArrayResize(value,1);
// ArraySetAsSeries(value,true);
   if(CopyBuffer(BB_M5,mode,shift,1,value)<0)
     {
     // Print("Can not copy BB M5  shift ",shift," ",GetLastError());
     }
   return NormalizeDouble(value[0],Digits());
  }

and in case you ask , this i how i get the index 

int FindBar(ENUM_TIMEFRAMES tf,datetime time)
  {
   for(int i = 0; i<Bars(_Symbol,tf); i++)
     {
      datetime time1 = iTime(_Symbol,tf,i);
      datetime time2 = iTime(_Symbol,tf,i+1);

      if((time<time1 || (i==0 && time>=time1)) && time>=time2)
        {
         if(i==0 && time>=time1)
           {return i;}
         return i+1;
        }
     }
   return -1;
  }

So, i know i have mistaken something or more than one thing, but i have no clue, i would really aprreciate it if you could help

 

Im thankfull for this message, but let me get it straight - i can only check , if the information is present and available, and can not do anything to make it available ?

Thanks in advance 

 
Stanislav Ivanov:

Over the past few years you have received a lot of help in the forum.

By now, you should have a fair amount of knowledge.

Do you ever read the forum or only when you need help?

It should be a 2 way street, people help you, you help others.

But that is not the case is it? Have you ever helped anybody else when they have problems?

It seems to me that you are selling your services in Freelance and whenever you have a problem that you cannot solve, you come to the forum to ask for help.

It just doesn't seem right to me to ask for free help to solve problems that you are being paid to solve.

 
Keith Watford:

Over the past few years you have received a lot of help in the forum.

By now, you should have a fair amount of knowledge.

Do you ever read the forum or only when you need help?

It should be a 2 way street, people help you, you help others.

But that is not the case is it? Have you ever helped anybody else when they have problems?

It seems to me that you are selling your services in Freelance and whenever you have a problem that you cannot solve, you come to the forum to ask for help.

It just doesn't seem right to me to ask for free help to solve problems that you are being paid to solve.

I completely agree. I decided a while ago to not answer him any more.
 
Keith Watford:

Over the past few years you have received a lot of help in the forum.

By now, you should have a fair amount of knowledge.

Do you ever read the forum or only when you need help?

It should be a 2 way street, people help you, you help others.

But that is not the case is it? Have you ever helped anybody else when they have problems?

It seems to me that you are selling your services in Freelance and whenever you have a problem that you cannot solve, you come to the forum to ask for help.

It just doesn't seem right to me to ask for free help to solve problems that you are being paid to solve.

my fair amount of knowedge isnt unlimited, and i have many gaps to cover.

Yes from time to time i ask for help when i find something unsolvable. 

And regarding the last thing you said, its up to you to help or not, it totally ok

 
Stanislav Ivanov:

my fair amount of knowedge isnt unlimited, and i have many gaps to cover.

Yes from time to time i ask for help when i find something unsolvable. 

And regarding the last thing you said, its up to you to help or not, it totally ok

There is no problem to have limited knowledge, it's more or less the case for everyone.

There is no problem asking for help.

There is a problem to always profit from the forum and never share anything. No more help for you until it's changed, and I will try to convince the others to do the same.

 
Keith Watford:

Over the past few years you have received a lot of help in the forum.

By now, you should have a fair amount of knowledge.

Do you ever read the forum or only whe.....

Alain Verleyen:
I completely agree. I decided a while ago to not answer him any more.

Hi Keith and Alain

I just saw your comments and thought I have to share something with you from my side.

I do exactly the same, coming here to ask my questions. sometimes I also come and read the other's questions and in some (very few) cases, I also reply to their questions. But usually I don't.
Not because I don't want to help to the others, the fact is there are so many great helpers here with a huge amount of knowledge, I didn't think that the forum is interested to hear from mid level coders (Just what I was thinking). I never want to give people ideas which may not be the best.

But, After I saw these comments, I will definitely try to give them the best I can.

I hope you didn't put me in your black list too :)

I truly appreciate what I learned from both of you and also  from Wiliam roeder.

 
Alain Verleyen:

There is no problem to have limited knowledge, it's more or less the case for everyone.

There is no problem asking for help.

There is a problem to always profit from the forum and never share anything. No more help for you until it's changed, and I will try to convince the others to do the same.

What you say makes sense, i agree with what you are doing, will try to help more !

 
Stanislav Ivanov:

What you say makes sense, i agree with what you are doing, will try to help more !

I will be happy to see it. Thanks.
 
Reza nasimi:

Hi Keith and Alain

I just saw your comments and thought I have to share something with you from my side.

I do exactly the same, coming here to ask my questions. sometimes I also come and read the other's questions and in some (very few) cases, I also reply to their questions. But usually I don't.
Not because I don't want to help to the others, the fact is there are so many great helpers here with a huge amount of knowledge, I didn't think that the forum is interested to hear from mid level coders (Just what I was thinking). I never want to give people ideas which may not be the best.

But, After I saw these comments, I will definitely try to give them the best I can.

I hope you didn't put me in your black list too :)

I truly appreciate what I learned from both of you and also  from Wiliam roeder.

Of course, we all have different skills and experience. If you can help, help, if you can't there is no problem. But your comment here is all at your honor.

The comments to Stanislav was mainly because he is a freelancer, and is profiting financially from the help. That's a serious difference with you.

Reason: