Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1454

 
Dzmitry Zaitsau:
Hello, can you please help me understand what the % sign in PrintFormat() is for, if without it the values in Print() are printed in the log?
PrintFormat("%s %d: leverage = 1:%I64d",
server,login,leverage);

this is formatted output

the inverted commas indicate the format of the output value - type, number of characters...

Experiment with their help example

 
Hi all! I am making an owl on a custom indicator, and some problems have appeared!
We need a signal (when there is one) only on the first candle and that's it (example: Buy first candle by the signal, Sell first candle by the signal). But it opens from the first candlestick and keeps opening on every candlestick! Can I ask whether there is a lock?
 

Make global variables, something like this:

bool up_opened=false, dn_opened=false;

void OnTick()
   {
   if(!up_opened && OrderSend(symbol,OP_BUY,.....)
      {
      up_opened=true;
      dn_opened=false;
      }


   if(!dn_opened && OrderSend(symbol,OP_SELL,.....)
      {
      dn_opened=true;
      up_opened=false;
      }
   }
 
Aleksei Stepanenko:

Make global variables, something like that:

Flags are our everything))) You really can't outrun them)

 
Valeriy Yastremskiy:

Flags are everything)))) You really can't outrun them).

The only problem is that they reset on reset

 
Vitaly Muzichenko:

The only problem is that they reset on restart

Well it is how to put) At opening, at presence, at closing, at absence. When ping is good, when ping is bad) Well, no one cancelled files and external variables.

Protection against a fool should always be present)

 

Hello, could you please advise on two questions:
1) Is it possible to make a calculating math-complete search parameters function OnTester does not show any results in the optimization log, if they are below a criterion? I have in the test is almost 100 million results of which I need 0.1% at most, and with so many results, I even in Excel can not sift them out.

2) Is it possible to make the tester not go into genetic optimization when the number of overshoots is more than 100mln? (I need about 10 billion)? ParameterSetRange doesn't help, the tester still goes to genetics. 100mln passes takes me 3 minutes to test.

 
Alexander Generalov:

Hello, could you please advise on two questions:
1) Is it possible to make a calculating math-complete search parameters function OnTester does not show any results in the optimization log, if they are below a criterion? I have in the test is almost 100 million results of which I need 0.1% at most, and with so many results, I even in Excel can not sift them out.

2) Is it possible to make the tester not go into genetic optimization when the number of overshoots is more than 100mln? (I need about 10 billion)? ParameterSetRange doesn't help, the tester still goes to genetics. My 100 mln pass takes 3 minutes to test.

You can save individual usable results to file immediately after frame processing.

There may be more than 1 frame per pass, which will reduce the number of jobs.

For example I count 10,000 results per pass and transfer the same number of frames, which allows you not to go into genetics.

 
What does Alarm - synchronisation failed, trade action processing disabled mean ?
 
Good evening
int  TimeHour( 
   datetime      date            // дата и время     );

The settings indicate that it returns the hour value (0-23) of the specified date. How can I add a function that will not only look at the current date, but at all times?

Reason: