[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

 
paladin80:
If you want, that with 3 orders already open, the subsequent (4, etc.) opened with 2 x lots, then
Yes everything is correct, but I need to put it all into second condition, these two conditions are turned on and off manually if (LotConst_or_not) gd_200 = Lot; (this is the first condition)

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.

 
Can you tell me how to close pending orders when a TakeProfit for a market order triggers?
 

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:

StringSubstr(Text,0,16);

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!

 
forexnew:

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);
 
artem86:
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

 
FAQ:

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.

 
forexnew:

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":

int StringLen( string text) 
Возвращает число символов в строке
 
atztek:

To be honest, I'm not quite sure what the problem is...
You can always check the "line length":

Thank you! It's working.
 

Look carefully at the format of my entry, I didn't specify a line length there, then read the description, again carefully:

string FileReadString(int handle, int length=0)
The function reads a string from the current file position. Applies to both CSV and binary files. For text files the string will be read before the separator. For binary files a specified number of characters will be read into the string.
To get error information, call GetLastError()function .
Parameters:
handle-File descriptor returned by FileOpen().
length-Number of characters to read.
Example:
 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);

}


Reason: