Is there a way of creating a permantent array? It should not be deleted when the indicator is reset (e.g changing timeframe, restart MT4,...). It is possible to create grafical objects and fit its text with the data but is there another way than this workaround?
Thanks for any help!
APeng: Is there a way of creating a permantent array? It should not be deleted when the indicator is reset (e.g changing timeframe, restart MT4,...). It is possible to create grafical objects and fit its text with the data but is there another way than this workaround? Thanks for any help!
Hi
There is no other way for a structure to persist across timeframe changes ?
(the file solution returns "structures or classes containing objects are not allowed") - tried the FileWriteStruct method ,since loading from include or from file
takes the same amount of time we want to avoid.
Thought of filling the structures with union types so i can mass load bytes but the arrays sizes are lost this way
Thanks
(edit : is the "structures or classes containing objects are not allowed" message about the strings alone or for other classes too?)Forum on trading, automated trading systems and testing trading strategies
Structures or classes containing objects are not allowed.
William Roeder , May 24, 2020 1:22 PM
- To create the elements in the array, the compiler needs to know how to initialize the class/struct. It doesn't know how to do that because of the string s. Add a default constructor (inside the struct ): void signal_data(void) : order_id(""), order_date(""), symbol(""),operation(""){}
Why are they strings (except symbols)? You need to change the types to real values and adjust the reading method (№ 3)
-
if (! FileReadStruct (export_file_handle, signals_arr[ 0 ])){
Your file is text. Read Struct only works with binary files; you have text. Read the manual! Add a read method to your structure, so it reads itself:void read( int H){ order_id = FileReadString (H); actual_date = FileReadDateTime(H); symbol = FileReadString (H); operation = FileReadString (H); price = FileReadNumber (H); ⋮
- Read Array only works with binary files; you have text. Read the manual! Open the file and, while it is not finished, have the nextelement in the array read it: for(int i=0; !FileIsEnding(export_file_handle); ++i) signals_arr[i].read(export_file_handle);
- You're reading, what are you trying to throw away?
-
string order_id[MC_MAX]; datetime actual_date[MC_MAX]; string order_date[MC_MAX]; string symbol[MC_MAX]; string operation[MC_MAX]; double price[MC_MAX]; double tp_1[MC_MAX]; double tp_2[MC_MAX]; double tp_3[MC_MAX]; double sl[MC_MAX];
Remove unused statements.
- Avoid strings and objects in structures if you use FileWriteStruct. Use only simple types like int or double.
- Manually serialize structures with objects (strings, etc.) to binary or text files. Use functions such as FileWriteInteger, FileWriteDouble, and FileWriteString.
- Use terminal global variables (GlobalVariableSet) for small numerical data.
- If you need greater efficiency, use arrays instead of structures or minimize write/read operations with large binary blocks.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there a way of creating a permantent array? It should not be deleted when the indicator is reset (e.g changing timeframe, restart MT4,...). It is possible to create grafical objects and fit its text with the data but is there another way than this workaround?
Thanks for any help!