[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 24
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
If you want, that with 3 orders already open, the subsequent (4, etc.) opened with 2 x lots, then
else gd_200 = AccountBalance() * RiskPercent / 100.0 / 10000.0; (second condition)
Now, instead of setting a lot of balance, we should correct the condition where with 3 orders opened the subsequent ones (4, etc.) will open with 2 lots. If there are any simpler functions.
Good afternoon!
Can you tell me how to read a text string with a certain number from a file.
In principle, I can use the following code:
For example read the first 16 characters, but if the lines will be of different lengths, and I need a match
value1=line 1;
value2=line #2;
Thank you in advance!
Please suggest a free word processor where you can move a part of the text to a new line when replacing it.
Thank you!
Good afternoon!
Can you tell me how to read a text string with a certain number from a file.
In principle I can use this code:
For example read the first 16 characters, but if strings will be different lengths, and I need a match
value1=line #1;
value2=line #2;
Thank you in advance!
FileReadString(hwd);
Could you please advise how to close pending orders when TakeProfit for a market order triggers?
Take the Kim function isCloseLastPosByTake().
If it returns true - the TP has triggered.
See the function itself at https://www.mql5.com/ru/forum/107476/page21#79908
FileReadString(hwd);
In this case, you must prescribe the length of the string to be read, e.g:
Str=FileReadString(handle); Symbol1=StringSubstr(Str,0,6); //6 characters
Str=FileReadString(handle); Symbol2=StringSubstr(Str,0,6); //6 symbols
What if I don't know the string length or it varies from line to line? I.e. I need to "capture" the text of the entire string.
In this case, you must prescribe the length of the string to be read, e.g:
Str=FileReadString(handle); Symbol1=StringSubstr(Str,0,6); //6 characters
Str=FileReadString(handle); Symbol2=StringSubstr(Str,0,6); //6 symbols
What if I don't know the string length or it varies from line to line? I.e. I need to "capture" the text of the whole string.
Honestly, I don't quite understand what the problem is...
You can always check the "line length":
To be honest, I'm not quite sure what the problem is...
You can always check the "line length":
Look carefully at the format of my entry, I didn't specify a line length there, then read the description, again carefully:
To get error information, call GetLastError()function .
int handle; string str; handle=FileOpen("filename.csv", FILE_CSV|FILE_READ);// if
(handle>0) { str=FileReadString(handle);//then this function will read to the end of the string
FileClose(handle);}