Excuse me,
I am dealing with global variables and met a problem.
I need something similar to global variable, but I want it to be string type.
As we know, the global variable could only be numeric.
Thank you so much!
Hi blackkettle,
Use script with show input property and writes to a file. The other app (EA, CI, Script) read from that file.
:D
Hi blackkettle,
Use script with show input property and writes to a file. The other app (EA, CI, Script) read from that file.
:D
onewithzachy,
Thank you very much for your reply.
Do you mean that we could store the variable name and its value to a txt file. We could modify, get, delete its value and its name from the file at anytime necessary?
Could you please give me an example?
Thank you so much!
onewithzachy,
Thank you very much for your reply.
Do you mean that we could store the variable name and its value to a txt file. We could modify, get, delete its value and its name from the file at anytime necessary?
Could you please give me an example?
Thank you so much!
Hi blackkettle,
Play (read: experimenting) this script, ask later
:D
#property show_inputs extern string String = "Wow"; extern bool Bool = true; extern int Int=-1; extern double Double=2.0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { //--- write file ny deleting the previous file int handle = FileOpen ("Folder/"+WindowExpertName()+".txt", FILE_CSV|FILE_WRITE); if (handle > 0) { FileWrite (handle, String, Bool, Int, Double); FileClose (handle); Alert ("Writing file is done"); } //--- read the file string Read_String; bool Read_Bool; int Read_Int; double Read_Double; handle = FileOpen ("Folder/"+WindowExpertName()+".txt", FILE_CSV|FILE_READ); if (handle > 0) { while (FileIsEnding (handle) == false) { Read_String = FileReadString (handle); Read_Bool = StrToDouble(FileReadString (handle)); //convert string ... Read_Int = StrToDouble(FileReadString (handle)); //...to ... Read_Double = StrToDouble(FileReadString (handle)); //... number :) string dummy = FileReadString (handle); // somehow anyhow this line is needed } FileClose (handle); } //--- show 'em Alert ("Str ",Read_String,", Bool ",Read_Bool,", Int ",Read_Int,", Double ",Read_Double); return(0); }
Excuse me,
I am dealing with global variables and met a problem.
I need something similar to global variable, but I want it to be string type.
If you only need to save a few specific instances of strings, for example, specific error messages, you can save an integer to represent each error message.
Hi blackkettle,
Play (read: experimenting) this script, ask later
:D
onewithzachy,
Thank you very much for your help.
I am investigating and will ask you later.
:)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Excuse me,
I am dealing with global variables and met a problem.
I need something similar to global variable, but I want it to be string type.
As we know, the global variable could only be numeric.
Thank you so much!