[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 300

 
costy_:
without overwriting this buffer.
And how do you imagine the logic of adding a new cell?
Then implement it...
 
artmedia70:
And how do you imagine the logic of adding a new cell?
Then implement it...

It's not working out the way I want it to).

I'll have to rewrite it, if that's the case ((.

//---------------------------------------------------------------------
// функция dIndBuf_In
// для эмуляции индикаторного буфера в любого рода скрипте
// bufIn[] ссылка на созданный ранее буфер  | double mine[]; for(i=0;i=10;i++)dIndBuf_In(mine,i,Close[i]); |
// position - смещение баров
// value - значение присваемое смещением бара
//---------------------------------------------------------------------
double dIndBuf_In(double &bufIn[],int position, double value){
   if(ArrayIsSeries(bufIn))ArraySetAsSeries(bufIn,false);
   if(ArraySize(bufIn)!=Bars+1)ArrayResize(bufIn,Bars+1);
   bufIn[Bars-position]=value;
}
//---------------------------------------------------------------------
// функция dIndBuf_Out 
// для извлечения значений эмуляции индикаторного буфера в любого рода скрипте
// bufIn[] ссылка на созданный ранее буфер  | double mine[]; for(i=0;i=10;i++)dIndBuf_In(mine,i,Close[i]); double x=dIndBuf_Out(mine,i)|
// position - смещение баров
//---------------------------------------------------------------------
double dIndBuf_Out(double bufIn[],int position){
   if(ArrayIsSeries(bufIn))ArraySetAsSeries(bufIn,false);
   return(bufIn[Bars-position]);
}
 
artmedia70:

:) The feminine came out...

And there was a witticism contest...

Oh... men... :)


>
 
Help with this error

10
sanches83 28.10.2011 18:24

Good evening all! Help solve the problem, because in this language does not make any sense so I appeal to you

The situation is as follows:

There is a part of the code:


Please advise how to make instead of displaying a message the program is trying to open the file again, and so on until it opens.

Thank you all in advance!


Try the while() loop. See here - https://docs.mql4.com/ru/basis/operators/while
 
22333222:

))

We don't live without smiles.

>
 
drknn:

Try the while() loop. See here - https://docs.mql4.com/ru/basis/operators/while

Like this.

int handle=0;
while(handle<1){
   handle=FileOpen("firstfile.xlsx",FILE_CSV|FILE_READ|FILE_WRITE,'\t');
   if(handle<1){
     Alert("Ашыпка ",GetLastError());
     Sleep(1000);
    }
} 
 
He doesn't need an alert - I understand that somewhere in the code, the file is probably already open but not closed. That's probably why the file can't be reopened and the alert window is bothering him. Maybe I'm wrong though - I'm not a member of the telepath club :(
 
Have searched the forum but haven't found a quick fix, help solve the problem with while in tester doesn't work, in real life it does.

Thank you.

  if(NewBar() == true)
  {
    int Result = -1;
    while(Result == -1)
    {
      if(TotalOpenOrders() < TotalOrders)
      {
        if(TrendDetection() == BULL)
        {
          Result = OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(Ask,Digits),Slippage,NormalizeDouble(Ask,Digits)-(StopLoss*Point),NormalizeDouble(Ask,Digits)+(TakeProfit*Point),OrderComments,Magic,0,CLR_NONE); 
        }
...........................

 

Ahhhhhh, I see - the man is trying to open an exel file in text mode, and not just any exel, but version 2007 and above. The file extension is *.xlsx. This is not a text file. An attempt to open it as a text file will result in the following

It wouldn't hurt to save this file in eksel as a text document under a different name and specify new (text) file name in handle=FileOpen("firstfile.xlsx",FILE_CSV|FILE_READ|FILE_WRITE,'\t'); specify the new (text) file name

 
rustein:
Have searched the forum but haven't found a quick fix, help solve the problem with while in tester doesn't work, in real life it does.

Thanks.


It's hard to say what the issue is. Take it as a rule in MQL4 that negative numbers in code should always be bracketed. Sometimes errors may occur without brackets.

Although, you shouldn't take negative values in brackets in code lines starting with extern. I don't know why it is so.