Can MetaTrader Read Txt Files using the include statement and import variables from the text file? - page 2
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
the opposite of "the god of programming" is
NOT "the devil of programming"
it is
"the god of NO-programming"
analysing a problem and find the solution is the core of programming. not writing some letters in a script.
if someone isnt able to solve the problems on its own, he is simply no programmer. such easy.
yes, my english sucks.
you should be glad, that i dont write in german :-))))))
LOL
i have told you, that at least i had to know the structure of the file
and i dont write complete code for analysing it.
i havent said that i would possibly give you an advice to write your own code.but til now you havent posted the structure - so what ?
in a ascii-file each value is a string. an ascii-file is made of only strings...
read all as string and convert numbers with StringToDouble...
If you have a text file (.txt) created in notepad, and the only thing that is in the entire file is:
"Gold_Price = 1176.55"
How do I pull the "1176.55" out of the .txt file and into my EA to use in calculations? So far, the only way I have been able to do it is using FileReadString - which does me absolutely no good because I can't run calculations on String variables. I am not sure if I could use FileReadDouble or what to get just the "1176.55" into my EA.
Meikel, if you want to help me, then by all means. I don't need complete code! I only need one small iota...what file operator do I use to pull in variables from .txt files and what is the format for using it?! I would appreciate any help you can give. If you want to keep on with this run around, then please just leave.
string Line="Gold_Price = 1176.55";
string Result[];
in other languages this is very easy.
read one line of the file and use
StringExplode("=",Line,Result);
Result[0] will give "Gold Price "
Result[1] will give " 1176.55"
its late, i hope i have posted the correct function.... ( i always make a lot of bugs, thats the reason why i am good in debugging :-)))))
yes, FileReadDouble is used for reading bin file not text file.
for text file, you should read string, and parse it to digits.
If you have a text file (.txt) created in notepad, and the only thing that is in the entire file is:
"Gold_Price = 1176.55"
How do I pull the "1176.55" out of the .txt file and into my EA to use in calculations? So far, the only way I have been able to do it is using FileReadString - which does me absolutely no good because I can't run calculations on String variables. I am not sure if I could use FileReadDouble or what to get just the "1176.55" into my EA.
Meikel, if you want to help me, then by all means. I don't need complete code! I only need one small iota...what file operator do I use to pull in variables from .txt files and what is the format for using it?! I would appreciate any help you can give. If you want to keep on with this run around, then please just leave.
Hi,
once i was doing like this, for me was working, maybe you need your own interpretation...
The file need to placed in your experts/files folder, the content in my file was f.e. VOLA=8.
Function was:
but how you can see i was looking for few parameters from my extern set-File.
Hope it helps for you, brgds