Useful features from KimIV - page 100

 
TarasBY:

Explain why: "it's better to exit a loop by break instead of return"?
I exit a function by return and only the loop by break. What is the trick?


Sorry, I don't check this thread often.

As for return and break - the point is that you have to develop a programming style that avoids "rake". That's why it is not desirable to use return inside the loop's body.

 
PapaYozh:


Sorry, I don't visit this thread often.

As for return and break - the point is that you have to develop a programming style that avoids "rake". That's why return should not be used inside the loop's body.


For the aesthetes:

http://c2.com/cgi/wiki?IsBreakStatementArchaic

 
Choomazik:


for aesthetes:

All aesthetes are here now: https://www.mql5.com/ru/forum/126359
 
Somebody...come forward....PLEASEZZZZZZZZZ
 
pyatka__ASD:
Somebody...come forward....PLEASEZZZZZZZZ
why are you yelling? it's not in the woods.
 
I'm not shouting, I just need to... really... tomorrow's defense.
 

Hello!

Please help a novice programmer to understand:

I am able to close trades like this: if(Hour()>=23) etc..... But i can't figure out -

How to write a function, so that the deal was closed not at a fixed time, but after some time had passed. I.e. a deal is opened, two hours pass after it is opened, the deal is closed.

 

Maybe there is a ready-made function of this kind, if you can tell me

 
KLMNC:

Maybe there is a ready-made function of this kind, if you can tell me.

There is a function, but it's not Kim's. OrderOpenTime()

if (TimeCurrent() - OrderOpenTime() > 2*60*60)

{

// ........

OrderClose(...);

}


 
goldtrader:

There is a function like this, only it's not Kim's. OrderOpenTime()

if (TimeCurrent() - OrderOpenTime() > 2*60*60)

{

// ........

OrderClose(...);

}


Thank you!