[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 220

 

is it possible that when communication with the server is lost/appears, the Expert Advisor reinitialises itself?

The result is an epic fail. IsConnected does not have time for ping.

IsConnected has no time. is there a fi nd to work with ping?

 
Omm:

is it possible that when communication with the server is lost/appears, the Expert Advisor reinitialises itself?

The result is an epic fail. IsConnected does not have time for ping.

IsConnected has no time. is there a fi nd to work with ping?

It needs to loop start. It works inside the loop. Everything can be done there.
 

Hi, could you please tell me why a position opens but the stop and profit does not. Thank you in advance!

int start()
{
double Sl =Low[1];
double Tpb =((High[1]-Open[1])/Tp)+Open;
double bar2b;
if (Open[2]<Close[2])bar2b=(High[2]-Open[2]);
double bar1b;
if (Open[1]<Close[1])bar1b=(High[1]-Open[1]);
if(bar2b<bar1b)OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Sl,Tpb,"",16384,0,Green);

Print("OrderSend failed with error #",GetLastError());
Also, where is the error? Thank you!!!

';' - series array has no left square bracket. zero shift assumed C:\Program Files\Alpari NZ MT4\experts\scripts\big program 1.mq4 (17, 40)
'-' - series array has no left square bracket. zero shift assumed C:\Program Files\Alpari NZ MT4\experts\scripts\big program 1.mq4 (18, 17)


 

I want to ask about the functionhttps://docs.mql4.com/ru/array/ArrayBsearch

It says:

"If there is no element with the specified value in the array, the function will return the index of the closest smaller element, between which the value is found."

What is the correct way to understand this? I.e. we're looking for the value we're looking for, and if it's absent, we're returned what we're not looking for? That's absurd. It makes more sense to return -1 if no item is found. Why not?

 
hoz:

I want to ask about the functionhttps://docs.mql4.com/ru/array/ArrayBsearch

It says:

"If there is no element with the specified value in the array, the function will return the index of the closest smaller element, between which the value is found."

What is the correct way to understand this? I.e. we're looking for the value we're looking for, and if it's absent, we're returned what we're not looking for? That's absurd. It makes more sense to return -1 if no item is found. Why not?


it will return the value, check it later. if it's not the right one, it's -1 for you.
 
hoz:

I want to ask about the functionhttps://docs.mql4.com/ru/array/ArrayBsearch

It says:

"If there is no element with the specified value in the array, the function will return the index of the closest smaller element, between which the value is found."

What is the correct way to understand this? I.e. we're looking for the value we're looking for, but if it's absent, we're returned what we're not looking for? That's absurd. It makes more sense to return -1 if no item is found. Why not?


The way we did it...

Just compare the value on the resulting index with the one you're looking for and that's it...

If this one doesn't fit, write your own function... a couple of minutes is all it takes...

 
sergeev:

It will return the value, check it later. If it's not the right one, it's -1 for you.


So...

hoz:

"If there is no element with the specified value in the array, the function will return the index of the closest smaller element between which the value is sought."

Doesn't make sense at all... Don't you see? Look at this:

"If the element with the specified value is absent in the array, the function will return the index of the closest smaller element between which the sought value is located." The element is missing, but the value you're looking for is located.

 

Good day! Evening! I'm trying to use the function, but it's not working. Cool! It underlines mistakes. I'm using the Ukrainian layout...

Anyway, here...

//записать

void SaveArray(string File, double &a[])
{
    int h = FileOpen(File, FILE_BIN|FILE_WRITE);
    if(h>0)
    {
      int sz = ArraySize(a); 
      FileWriteArray(h,a,0,sz);
      FileClose(h);
    }
}

//прочитать

void OpenArray(string File, double &a[], int sz)
{
    int h = FileOpen(File, FILE_BIN|FILE_READ);
    if(h>0)
    {
      ArrayResize(a,sz);
      FileReadArray(h,a,0,sz);
      FileClose(h);
    }
}

Here's

if (!Pishem&&PozyProstavleny){SaveArray(FileBuy, Buy); SaveArray(FileSell, Sell); Pishem=1;}

Here's

'Buy' - incompatible types D:\TeleTRADE/experts/checklist.mq4 (102, 53)

'Sell' - incompatible types D:\TeleTRADE/experts/checkpoints.mq4 (102, 79) ........ Please advise, it took me two hours! I even put square brackets after the array name, and what else...

 
It's pouring with rain and it's raining squeaks! Although it's not really pouring, that's an understatement. It's just a little bit of a splash.
 
Oh, there's more. Maybe that's where it went wrong! Called it that.
string FileBuy="FileBuy.csv",FileSell="FileSell.csv";