Errors, bugs, questions - page 308

 
aharata:
Try reading about BarsCalculated in the help, which, by the way, gives the right example.

Let's try to do it with this one. Thank you!
 
Im_hungry:

that is, as long as CopyBuffer>0 we calculate it, and the new parameter (Close())

appears when the position is closed. In other words, we need to loop through While. It turns out like this.

I would put it this way: "While CopyBuffer<0, we repeat the call of this function".

The While (vhandle>0) line doesn't seem to carry any special load, because in case of first CopyBuffer<0 it will return(0);

I would work in this direction:

if(!PositionSelect(Symbol1) && !PositionSelect(Symbol2))
  {
   for(uchar u=0;u<100;u++)  //запускаем цикл с ограниченным количеством шагов
    {
     if(CopyBuffer(vhandle,0,0,50,Sp1Buffer) && CopyBuffer(vhandle,1,0,50,Sp2Buffer))
      {
       return(true);  //дождались копирования буферов - выходим
      }
     else
      {
       if(u==99) //т.е. выявляем последний шаг нашего цикла for, который не принёс ожидаемых результатов
         {
          Alert("Ошибка копирования буферов индикатора номер ошибки:",GetLastError());
          return(0);
         }
       Sleep(50);  //засыпаем ненадолго (хотя я сам не сторонник использования Sleep в теле OnTick)
      }
    }
  }

In general, something along these lines, at the author's discretion. As rightly pointed out, a reference guide would not hurt.

 
aharata:
Try to read in help about BarsCalculated, by the way, the right example is given there.

Thanks for the referral made - works, seems to have no issues (1 month tested)

Here is my working code for 1st pair

void OnTick()
{ 
   if (isNewBar()==true && proverkaHANDLA()==true)
     {
      if (!PositionSelect(Symbol1))
         {
          BSOpen();
         }
     }    
}
//+==================================================================+
bool proverkaHANDLA()
{
  ArraySetAsSeries(Sp1Buffer,true);
  ArraySetAsSeries(Sp2Buffer,true);
  vhandle=iCustom(NULL,0,"МТ5",Symbol1,100,Lots,1,Close());
  ResetLastError();
  int copied0=CopyBuffer(vhandle,0,0,50,Sp1Buffer);
  int copied1=CopyBuffer(vhandle,1,0,50,Sp2Buffer);
  if(copied0<=0 || copied1<=0)
     {
      Sleep(50);
      for(int i=0;i<100;i++)
        {
         if(BarsCalculated(vhandle)>0)
         break;
         Sleep(50);
        }
      copied0=CopyBuffer(vhandle,0,0,50,Sp1Buffer);
      copied1=CopyBuffer(vhandle,1,0,50,Sp2Buffer);
      if(copied0<=0 || copied1<=0)
        {
         Print("Не удалось скопировать Буфера индюков :-)",GetLastError(),
         "copied0",copied0,"copied1=",copied1);
         return (false); 
        }
       Print("Удалось скопировать Буфера :-)copied0",copied0,"copied1=",copied1);
       return (true);
     }
   Print("Удалось скопировать Буфера. Sp1Buffer=",ArraySize(Sp1Buffer),
         "Sp2Buffer=",ArraySize(Sp2Buffer));
   return (true);
}
 
Yedelkin:

I would say: "as long as CopyBuffer<0, repeat calling this function".

The While (vhandle>0) line doesn't seem to be much load, because in case of first CopyBuffer<0 it would return(0);

I would work in this direction:

Basically, something like that, at the author's discretion. As rightly pointed out, a reference book wouldn't hurt.

It's even simpler, let's see which of these 2 approaches is better and faster - that's what we'll take,

Thank you all! Let's go to test.

 
developers, please pay attention to application #33601 (there is a "great feature" about leverage in different OSs)...
 
Interesting:
developers, please pay attention to request #33601 (there is a "great feature" about leverage in different OSes)...

Maybe you are using terminals originally installed from different brokers? Add details to your application, please.
 
Rosh:
Perhaps you are using terminals originally installed from different brokers? Add details to your application, please.
Clarified about the terminals and what I need to get in the end.
 

Question for the developers.

Everything is clear about spreads, they are stored in bars and the tester can run the entire history, taking into account changing spreads (if the history is normally loaded), but what about swaps?

That is, what happens if broker/dealer changes rates of swaps or commission?

I understand the situation is a bit absurd, but still.

If I understand correctly now tester as in MT4 will take swaps and commission last....

PS

Clarified again, now with screenshots....

 
Interesting:

Question for the developers.

Everything is clear about spreads, they are stored in bars and the tester can run the entire history, taking into account changing spreads (if the history is normally loaded), but what about swaps?

That is, what happens if a broker/dealer changes the size of swaps or commission?

The history of swaps and commissions is not stored, these settings are taken from the last connection
 
Rosh:
Swap and commission history is not stored, these settings are taken from the last connection
I see, that's about what I thought. Let's hope they don't change often/not at all.
Reason: