Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 519
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
How do I know that in the history of this particular position some of it is closed?
I opened a position with 1.0 lot, closed it with 0.5, and with 10$ loss. Later I closed another 0.25 with 5$ profit. I will close it all at 50$ profit. In fact, right now I have $50 profit.
How do I close -$10 and +$5 in the calculation of the current profit? To close at $55 profit
See the comment of the position (in mql4) - the closed part has a ticket of the remaining part (to#1234556789), the remaining part has a ticket of the closed (from#123456788) - I do not remember where there are gaps - you will see for yourself
Look at the comment of the position (in mql4) - the closed part has a ticket of the remainder (to#1234556789), the remainder has a ticket of the closed one (from#123456788) - I do not remember where the spaces are - you will see for yourself
I compare the comment of the closed position with the ticket of the open one, it returns "0.0"
Comparing a comment of a closed position with a ticket of an open position, returns "0.0".
From the comment the ticket should be highlighted, i.e. extra characters like "from #" and "to #" should be removed. It's not done here.
From the comment you need to highlight the ticket, i.e. remove extra characters like "from #" and "to #". This is not done here.
Exactly! How do you cut "to #"?
take the leftover part and convert it to long
in-5e, there's a rudimentary regexp - it'll be easier
find occurrence of character/substring #
How do I find it?
Is the site search not working? Don't you have documentation at the top of the page?
Is the site search not working? Don't you have documentation at the top of the page?
Thanks, I did this.
but the search history function started to return the current profit on the open position
> Thanks, that's how I did it.
Don't do that again :-) you can't rely on the length or start of a fragment when dealing with undefined strings
There's a nice StringFind() function - search for "#" or "from #".
ps/ you should also use a single case, either upper or lowercase. Unfortunately there is no protocol for tagging comments, so it's possible that some server will say "FROM #" (in capital letters);in particular some put [sl] and some (sl) at the end of the comment at stop-loss. And the size of the comment is limited by the way. And so on and so forth.
What is the harm of such a construction?
Or is it better to makedatetime a long type?