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

 
Lians:

I have already contacted the forum about writing and reading arrays to a file, and now I have run into a problem again: After writing an array to a file, I cannot find the array element by value, so here is a script:

The result of running this script on me is the log entry "The word xyz is not in the written file, but the word xyz is"

Could you please tell me what is wrong and how to fix it?

You are using 2-dimensional array string y[][] while checking (searching) in one-dimensional array. Try this function:

bool ArraySearchString (string m[][], string e1)
{
    for (int i1 = 0; i1 < ArrayRange (m, 0); i1++)
    {
        for (int i2 = 0; i2 < ArrayRange (m, 1); i2++)
        if (m[i1][i2] == e1) return (true);
    }
    return (false);
}

and change the check condition to

if (ArraySearchString (y,"xyz"))
 

TarasBY, thank you very much! It works!

And another question, has anyone encountered a phenomenon where the same script that mathematically calculates an integer in different builds of the terminal gives different values. For example, in 399 build it produces 488143839, but in 416 build it produces 348186686.

I've already checked it several times - the script runs the same with the same parameters in different builds.

 
Lians:

TarasBY, thank you very much! It works!

And another question, has anyone encountered a phenomenon where the same script that mathematically calculates an integer in different builds of the terminal gives different values. For example, in 399 build it produces 488143839, but in 416 build it produces 348186686.

I've already checked it several times - the script runs the same with the same parameters in different builds.



Your numbers are large, perhaps the cause is an integer variable overflow.
 
Hello, can you help me add a stop loss? Tried it myself, stop loss doesn't appear.
Files:
q163hud4n85.mq4  33 kb
 
moskitman:
No, Vadim, the desktop! A 512mb GForce 9600 graphics card itself.
32bit client operating systems cannot use more than 3.5GB memory (some 3.25, it depends on the nature of the motherboard bios)
This is due to the 32-bit architecture and the fact that 3.5 to 4Gb of space is dedicated to addressing PCI devices, in particular, if you have a lot of PCI devices installed, you will "see" less RAM than you have
.
 
Zhunko:
I've been told, but thanks anyway, Vadim.
 
sand:

Your numbers are big, maybe the reason is an integer variable overflow.
Do you know how to avoid this? Not to use functions like MathFloor(), MathSqrt() ...? Or there is nothing to be done about it? I need it to count the same way everywhere.
 
yosuf:
Often the internet goes down, is it possible to automate its restart with software? Or what is known about it? Is there any way to power two or more ISPs at the same time, I mean in parallel? Thanks in advance.

XmaksasX:

make a plain text document and put in this text

:LOOP
ping 8.8.8.8 | find "100%" && (rasdial /disconnect & rasdial "NAME OF YOUR CONNECTION" login pass)
ping -w 1000 -n 30 127.0.0.1

goto LOOP

save it and change the extension from *.txt to *.bat, roll it up and enjoy))

XmaksasX, thank you very much for your very wise advise, the internet connection has not been down for two days, or maybe I have not noticed it, since the principle above works. I used to get blackouts every 10 minutes, every hour or at night, even sadder at work, i.e. without any system. Now it's a blessing, you can get a good night's sleep too.

Another question, is it possible to manage a real account from two computers in parallel, from home and work?

 

Here's a piece of code from the EA. I wanted to implement the idea that if there is a deviation from the open price by sigma, then close. in theory if you put sigma = 1*Point. Then the Expert Advisor should always close with profit, because the deviation is always present at 1*Point. Another thing is that in real trade, there is a spread so it will lose profit and in the Strategy Tester there is no spread, so it should make profit all the time.

I think there is an error here.

if (OrdersTotal()!=0)
    {
     OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
     
     if (OrderType()==OP_BUY)
     {
      if ((Bid-Open[0])>=SigmaHigh*Point) OrderClose(OrderTicket(),OrderLots(),Bid,slippage,Red);
     }
      
     if (OrderType()==OP_SELL) 
     {
       if ((Open[0]-Ask)>=SigmaLow*Point) OrderClose(OrderTicket(),OrderLots(),Ask,slippage,Green);
     }
    }
 
orb:

and there's no spread in the tester


There is a spread in the tester. Exactly the same as on the chart when the test was run.