Your string array is filled:
string pplevels[] = {"Dwp","Dws1","Dws2","Ds1","Ds2"};
after sorting, dSortThis[3][1] == 4
So, pplevels[dSortThis[3][1]]) is calling pplevels[4];
so when you do
Alert ( " the 4th value sorted is ", pplevels[dSortThis[3][1]]);
You are printing pplevels[4] which holds the string, "Ds2". If you printed dSortThis[3][0]; it might be what you wanted
You're trying to ask questions like highest and lowest but you want to work with strings. That is going to cause you headaches. Within all the examples you've provided, strings are being associated with Array_Indexes, i.e 0-1-2-3-4. <--- If you break this association, you'll have to result to static methods of tracing the strings which throws all advantages of using an array out the window.
If price is lower than variable (string) name makes no sense. What you're looking for is should price be lower than the value of dSortThis[4][0].
- Example of what you're looking for is,
- get the Volatility of 5 different symbols within an array.
- sort the double_array from lowest to highest as example.
- create another loop which search for eurusd_volatility and returns the index
- then put that string_symbol_name i.e "eurusd" in a string_array @ the found index location.
- you end up with string array which looks like sym_sort_volatility_arr[] = {"eurchf","eurusd","eurjpy" etc};
Now if you want to know if eurusd is lower than eurjpy, you'll have to create another function which returns the index of string arrays.
So yea, don't work with strings.
added* just as a side note, I probably shouldn't say don't work with strings because that's how I've handles most of my multi_currency logics up_to_this_point. I used the strings because it's easier to remember that i want the value of "eurjpy" instead of trying to remember which index it's associated with. In your case, you're already using the 2d_array, in my case, I was trying to avoid them.
4xAndy you already have the names and values linked you're just not seeing it. The link between the values in SortThis[] and the names in pplevels[] is the second dimension of each value index in SortThis[] that link is good even after sorting the array
4xAndy you already have the names and values linked you're just not seeing it. The link between the values in SortThis[] and the names in pplevels[] is the second dimension of each value index in SortThis[] that link is good even after sorting the array
Ya I was the one who linked them, but with the hope i could use the linked strings to call the value, but like I say I can work purely from the data in the first dimension and insert the variable name as reference when I am outputting my data to spreadsheet. If you look at the other thread in forex factory you will hopefully see how this all came together. Max doom created the code to demonstrate whether my theory would work and then i added the pplevels string array to show him roughly where i was going with it. But I really did want to carry on with the actual variable names in the correct order and call the value from the correctly placed variable name. All the same thanks to you for making me realize that i can work round it by using the values from the first dimension and reinserting the strings that correspond only when I need to output the data for analysis.
Thanks Andy
You're trying to ask questions like highest and lowest but you want to work with strings. That is going to cause you headaches. Within all the examples you've provided, strings are being associated with Array_Indexes, i.e 0-1-2-3-4. <--- If you break this association, you'll have to result to static methods of tracing the strings which throws all advantages of using an array out the window.
If price is lower than variable (string) name makes no sense. What you're looking for is should price be lower than the value of dSortThis[4][0].
- Example of what you're looking for is,
- get the Volatility of 5 different symbols within an array.
- sort the double_array from lowest to highest as example.
- create another loop which search for eurusd_volatility and returns the index
- then put that string_symbol_name i.e "eurusd" in a string_array @ the found index location.
- you end up with string array which looks like sym_sort_volatility_arr[] = {"eurchf","eurusd","eurjpy" etc};
Now if you want to know if eurusd is lower than eurjpy, you'll have to create another function which returns the index of string arrays.
So yea, don't work with strings.
added* just as a side note, I probably shouldn't say don't work with strings because that's how I've handles most of my multi_currency logics up_to_this_point. I used the strings because it's easier to remember that i want the value of "eurjpy" instead of trying to remember which index it's associated with. In your case, you're already using the 2d_array, in my case, I was trying to avoid them.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
If i have a variable "double x=1.1;" and a string "string variables[] = {"a","b","x","y"};"
I can obvioulsy get my x string by saying "variables[3]" but how do i get this back into my variable value of 1.1 if i only know that variables[3] contains the name of the variable that holds my value of 1.1 but i cant just type x without bringing it from the string I will attach some code that might help explain better what i need to do if you look at the line near the end with the print function it has // explaining my problem