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

 
Taras Slobodyanik:

datetime is ulong - The integer type ulong occupies 8 bytes and can store values from 0 to 18,446,744,073,709,551,615.

It takes 584 billion years to go beyond that, during which time the universe will disappear and reappear several times)

But Serik29 will watch it all and swear about going beyond ...
 
Taras Slobodyanik:

datetime is ulong - The integer type ulong occupies 8 bytes and can store values from 0 to 18,446,744,073,709,551,615.

It takes 584 billion years to go beyond that, during which time the universe will disappear and reappear several times)

And you try translating that value into years of seconds and minutes in C++. I've been trying to break that number down for 2 weeks. Got it done of course but it's very hard.

 
Artyom Trishkin:
But Serik29 will watch all this and scold me for going beyond ...

I won't, of course. I just don't know if I made the correct function in C++ with the hard work I put into splitting these 158 mln.

 
Valeriy Yastremskiy:

9.3.6 File operations 517

Tutorial is small, it's manual and help is big))))

Thanks.

 
Seric29:

In a year

1).365 days. In this case you must also add a leap year.

2). A more accurate calculation shows that time is not constant. For the time being it is possible to calculate that the year has 365 days, i.e. 5 hours 46 minutes and 12 seconds, or 365.25 days.

Hence the question arises about the calculations of mql4 using the first or the second option. Besides, the methodology of storing time in seconds strikes me, as it is possible to go beyond the long term.

https://ru.wikipedia.org/wiki/Unix-%D0%B2%D1%80%D0%B5%D0%BC%D1%8F

You are advised to read it.

 

Hello. I need a function to disable an EA when it reaches a certain balance, how to achieve this. I am not a programmer myself, but I can add and correct the programming code myself.

I am not a programmer myself but I am able to add, edit and correct code myself. Thanks for the reply.

 
Asfandiyor Ibragimov:

Hello. I need a function to disable an EA when it reaches a certain balance, how do I achieve this. I am not a programmer myself, but I can add and correct the programming code myself.

Thank you for your feedback.

For example: My initial balance is $10000, I have specified in external parameter, after this balance the EA will not trade or will be disabled = 10100; now the EA trades and after CLOSE of all open trades the balance has reached > $1,0100, the EA should not trade.

 
Asfandiyor Ibragimov:

For example: I have an initial balance of $10000, on the external parameter, I have specified a balance after which the advisor no longer trades or is disabled = 10100; and now the advisor is trading and after CLOSE of all open trades the balance has reached > $1,0100, the advisor should not trade.

You can do this:

int OnInit()
{
   if(AccountInfoDouble(ACCOUNT_BALANCE) >= нужного мне && нет открытой позиции)
   {
      Print("Уже набрали бабла )))");
      ExpertRemove(); // не обязательно :)
   }
   else
   {
      тут код самого советника
   }
}   
 
Сергей Таболин:

You can do this:

you can't go like this...

OnTick() multiple....

 
Vladimir Pastushak:

you can't do that...

OnTick() multiple....

Of course )))) A little mistake. But "code of the Expert Advisor itself" implies finding exactly in OnTick...

Reason: