yes thats true, and in 31 million years we will need the gv to be a long but, judging by the way my ea's work on backtesting every one of them would have lot the entire federal budget several times over and bankrupted the entire planet by then lol
let's go back to business
remember, the topic was about how to store ChartID()
To store safely correct long values as doubles a value of the ChartIDs:130 370 193 351 027 472
is too big!
It wont even help to divide this by 2000000000 or so as most
probably an equal-comparison will fail too, the difference is now smaller but I gues has not dissapeared. Remember the save double-zero-check?:
if (MathAbs(x) < 0.0000000001 ).. // this is a safe zero-check!
if ( x == 0.0 ) .. // this can fail!!
have thought of ChartID()%100000000 but this is not save either because I
don't know how this ID is calculated and all of a sudden I get false
It looks to me, that the whole ChartID is part of the OO-programming and it is meant only to be used as handle to 'where I am' and no one of Metaquotes has thought of communicating it to other charts.
They still think of the very simple: one chart one symbol one ea.
I will use
IDChart[c] = ChartOpen( ChartPair[c], PERIOD_M1 );
ChartSetString( IDChart[c], CHART_COMMENT, "I am install-no:"+(string)c );
But this means now my EA has to carefully manage it Comments if this has to be kept as in some cases OnDeinit() is not called like if the EA removes itself with ExpertRemove() :(
Why do I have a computer if programs forces me to do many things manually :(
I want my multi-currency-trading EA to organize itself on several charts with different setups (currencies to trade).
For this the various ChartID (ChartFirst, ChartID, ChartNext) would be ideal - if their IDs could be communicated to other charts.
It would be a lot easier if the ID would only between 0 and 100 (=CHARTS_MAX). This is what I initially thought and this could be used as an index for the array of the setups e.g. - I thought.
Then I realized that it is a huge, huge number like the serial code of some hardware??
I'll try tomorrow ChartSetString() ChartGetString().
If you (would,search) like to use something like recognizer (magic-number), unique recognizer, for shorter version of number you can change it to
number as not as sum, but adding like strings with 4 byte int, ex.:
int.id.1. +(add not mathematically)+ charts[ 0, 1, ... Id ] (int 4 byte) + (some symbol Id recognizer from some array, 4 byte int)
that would be 1-st number for id 0-9 as it is not manual, 2-nd number 0-9 charts chosen, 3-rd number would be probably longer by the total number of symbols.
Ex.: 1599, where 1 is id.robot(that this is not manual interruption), 5 is chart array, 99 is id.symbols.
If you would like to organize them from external (i.e. more internal) own robot independent from any-mql, than export short data to text file, and read that data from mql expert/script attached to by your choice (that I concluded by "I want my multi-currency-trading EA").
Similar difference there is with how Linux calculates Date&Time vs MsWin way, Linux uses much shorter version of numbers for same, by but with opposite way of counting.
That should be fail save by either a script and/or if solely applied to a chart, so that e.g. no setup is installed twice and another one is missing.
To find the right setup it should know what and where a setup is already installed and running.
For what else a ChartID could be used than to compare it to another chartID. But for this you have to communicate to another chart - how would you do it?
Named Pipes? Isn't that a bit like using a sledgehammerto crack a little nut? I need that only for the installation.
Another way would be if I would be able to get the name of the EA that is running on another chart.
I can get all the indicators of another chart (ChartIndicatorsTotal() and ChartIndicatorName() ), I can get the ChartSymbol(ChartID) of another Chart but not the name of the EA and may be its status (running, stopped,...)
They have provided so many new functions ..AsInteger(), ..AsDouble(), ..AsString().
All this first gave me hope for an elegant solution which is immediately disappointed.
I'll try tomorrow ChartSetString() ChartGetString().
Of course I can create my own ID - but why should I if the MT4 offers already an ID?
The type of handles of files is an int and that matches biggest no of handles being open. We can only open 100 charts but their ID is bigger than dept of the USA in Cent?
My problem is just that all the new types don't match in a meaningful manner.
Another tiny example is FileSize returns a ulong ok, but FileReadString() requires an int for the size - this should be ulong too to read a file completely.
Are there files with an ulong-size (18 446 744 073 709 551 615 bytes this is may be the size complete content the NSA has saved) that can be used by MT4?
Shall I now - do I have to - code an extra routine to check whether there might raise an error due to FileSize > MaxInt = 2 147 483 647 ~ 2GB?
Again we go back, I think approach for counting makes the numbers big, in the case if it was started to count like the -DateTime- in Linux (like) from (millennia or other form for Billion years which I don't know it) Year Date, i.e. smaller number and than to extract/add the bigger number Months than etc.. to ticks. Opposite way counting from stored many ticks makes numbers bigger and bigger (correct when you said soon "complete content the NSA has saved" for few small data).
( For the FileSize ulong and strings-positions I am not able to give suggestions, never went inside the structure of the compiler. Maybe for advice would be good Fabrice Bellard - he created(made) smallest C compilers. )
In the context of that those problems/solvents arise from 4 bit and up, 32 64, and any later, but again they all depend on binary choice (there (are) can be many choice(s) forms).
Storing to and extracting from smaller number would be a point. Choice of bool ulong or double whatever form if it makes the storage smaller does matter in these cases.
To add comments, please log in or register