Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 520
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
What's the harm in such a design?
Or is it better to makedatetime a long type?
But there is an obvious craving for accuracy (datetime is larger than time_t, to put it mildly).
and it should rather be long for time comparisons. If the compiler optimizes something, it will throw it away, and a deposit for the future remains :-)
I don't see a problem so far.
But there is an obvious tendency to be more precise (datetime is softly larger than time_t)
and it's more likely that this long should be used to compare times. If compiler optimizes something, it will throw it away and leave a deposit for the future :-)
So you can use it without cheating without consequences?
So you can use it without cheating without consequences?
Well, how could it be without consequences :-)
long x = TimeCurrent(); already gets a "slap on the face" in a good company :-) Not only are the types different in physics, but they are also different in dimension and you convert a larger type to a smaller one.
But yes, all seconds from (datetime)TimeCurrent seem to fit into long
there is a great function StringFind() - search for "#" or "from #".
and what do we do with it?
InStringSubstr, everything is clear, you get digits immediately - ticket, but here inStringFind , we already know that there is"to #" in the comment
Found
and what to do with it?
InStringSubstr everything is clear, we get the numbers immediately - ticket, but here inStringFind what, we already know that there is"to #" in the comment
but we don't know where.) StringFind will tell us if the "to #" we are looking for is at this position or not there at all. Never rely on something that comes from the net and you personally/personally don't control it :-) We're playing money here - this is serious.
but don't know where :-) StringFind will tell you that the "to #" you're looking for is from exactly this position, or it doesn't exist at all. Never rely on something that comes from the net and you personally/personally don't control it :-) We're playing money here - this is serious.
need to highlight the ticket from the comment and throw out the "to #".
the ticket for an open position is compared to the one in the comment for a closed position
why are we even looking for the"to #"?
TheStringSubstr function returns the right part of the comment. Why does this function return the profit of an open position and not the profit of a closed position? I'm going throughMODE_HISTORY
What is the harm of such a construction?
Or is it better to makedatetime a long type?
the ticket should be highlighted from the comment and the "to #" should be discarded.
the ticket for an open position should be compared to the ticket in the comment for a closed position
why are we even looking for the"to #"?
We are looking for it in order to find out "is there even to# or from#" in the comment. If there isn't, then this order is not a part of a closed position and we do not need it.
If the StringFind(OrderComment(), "#to") is greater than or equal to zero, it means that the comment contains the sought sub-string, and only now we can calculate the position of the ticket number in this string.
TheStringSubstr function returns the right part of the comment. Why does this function return the profit of an open position and not the profit of a closed position? I am going throughMODE_HISTORY.
And this is the answer to this question.
Forum on trading, automated trading systems and strategy testing
Any questions from newbies on MQL4, help and discussion on algorithms and codes
PolarSeaman, 2018.04.07 00:25
FoundAnd what to do with it?
Everything is clear inStringSubstr, you get numbers - ticket, but here inStringFind what, we already know that there is"to #" in the comment
But if you don't, you'll get something completely different.