The “CultureInfo Object (For Culture-Specific Text Formatting)” Data Type
Quagensia N Edition has a no-code data type named “CultureInfo Object (For Culture-Specific Text Formatting)”. The underlying data type of this no-code data type is the “CultureInfo” data type of C#, which you can learn more on the CultureInfo Class help page on the microsoft.com website.
The Quagensia N Edition’s no-code data type named “CultureInfo Object (For Culture-Specific Text Formatting)” has the following two main uses:
- Some no-code functions have an input parameter of the “CultureInfo Object (For Culture-Specific Text Formatting)” data type that makes it possible for Quagensia N Edition Strategies to convert numbers, dates, and times into text that is formatted in one of the many unique ways that numbers, dates, and times are written in different countries and by different cultures around the world.
- Other no-code functions have an input parameter of the “CultureInfo Object (For Culture-Specific Text Formatting)” data type that makes it possible for Quagensia N Edition Strategies to convert text (such as might be stored in a plain text file) that is formatted in one of the many unique ways that numbers, dates, and times are written in different countries and by different cultures around the world into numbers, dates, and times that can be used as numbers, dates, and times in Quagensia N Edition Strategies.
The No-Code Function Named “Get CultureInfo Object (For Culture-Specific Text Formatting) For Selected ‘Formatting Preferences for Dates, Times, and Numbers'”
Quagensia N Edition has a no-code function named “Get CultureInfo Object (For Culture-Specific Text Formatting) For Selected ‘Formatting Preferences for Dates, Times, and Numbers'”, located in the “NinjaScript®/Advanced Objects >> CultureInfo Object (For Culture-Specific Text Formatting)” subfolder of the context menu that appears when a location is clicked in a Quagensia N Edition Strategy or Quagensia N Edition Function where a “CultureInfo Object (For Culture-Specific Text Formatting)” object is allowed, that has a single input parameter named “Formatting Rules for Numbers, Dates, and Times” that allows the user to select the formatting rules for numbers, dates, and times from a drop-down list.
The value to which this function’s “Formatting Rules for Numbers, Dates, and Times” input parameter is set will determine some or all of the rules that are used when attempting to read numbers, dates, and times from a piece of text and will also determine some or all of the rules that are used when determining how numbers, dates, and times should be formatted when they are written to a piece of text.
If you want to share your algos with other users from other countries or cultures that may format numbers, dates, and times differently than the way that numbers, dates, and times are formatted in your country or culture, you have one extremely safe and reliable choice for the value of this function’s “Formatting Rules for Numbers, Dates, and Times” input parameter and a second choice that is relatively safe and reliable:
The safest and most reliable choice for sharing algos is the choice entitled “The Best Formatting Preferences For Sharing Between Users”. When you select this choice, numbers, dates, and times will be written to and read from pieces of text using formatting rules that are considered relatively “cross-cultural”. The negative is that the formatting rules may not be those that you are used to using. For instance, the fraction “3 and 1/4” will written 3.25 rather than 3,25 as it might be written in your country or culture.
Another choice which is relatively safe and reliable for sharing algos is to select the set of formatting rules that match your country or culture from the large, alphabetized list of formatting rule sets listed under the menu item entitled “Select a Different Set of Formatting Preferences”. When you select a choice from this alphabetized list, numbers, dates, and times will be written to and read from pieces of text using formatting rules that match those which are normally used in your country or culture. The negative is that the formatting rules may not be those that the people with which you share your algos are used to using. For instance, if the fraction “3 and 1/4” is written 3,25 rather than 3.25 in your country or culture and you share your algo with people in countries or cultures that write the fraction “3 and 1/4” as 3.25 rather than 3,25 some users may find it more difficult to understand the pieces of Text your algo reads from or writes to. Note that the options in the alphabetized list of formatting rule sets listed under the menu item entitled “Select a Different Set of Formatting Preferences” are those that are known to your installation of Windows, which may be different than those known to another user’s installation of Windows if the user has a different version or edition of Windows installed on their machine or if they have a different set of installed Windows Updates, so it is possible that if you select an item under the menu item entitled “Select a Different Set of Formatting Preferences” another user may be unable to use your algo using the formatting rules for numbers, dates, and times that you intended.
If you are confident that you will never share your algos with other people from other countries or cultures, and the pieces of text that you intend to read have numbers, dates, and times formatted a way that is consistent to how numbers, dates, and times are usually formatted on your computer when you are logged in, then you may choose the option “The Personal Formatting Preferences of Whoever Uses This Algo”. The largest benefit of selecting this option is that numbers, dates, and times will be formatted the way that you are used to using them. The largest drawback of selecting this option is that if you ever do share this algo and the plain text files with the pieces of text that are read by it with other users from other countries or cultures, your algo may be unable to read the numbers, dates, and times that are saved to the plain text files since it will attempt to read the plain text files using the other person’s formatting preferences as they are configured on their computer.
NOTE: The difference between choosing the option “The Personal Formatting Preferences of Whoever Uses This Algo” and choosing your country or culture from the large, alphabetized list of formatting rule sets listed under the menu item entitled “Select a Different Set of Formatting Preferences” is that “The Personal Formatting Preferences of Whoever Uses This Algo” considers not just the formatting preferences of the selected country or culture for your user on your machine but even considers any additional formatting preferences that you or your system administrator may have configured for your user on your machine. For instance, if your user’s culture or country on your machine is set to one that writes the fraction “3 and 1/4” as 3.25 rather than 3,25 but you have set up your user on your machine to display the fraction “3 and 1/4” as 3,25 rather than 3.25, then the fraction “3 and 1/4” will be written as 3,25 rather than 3.25 because you overrode the default for this setting for your country or culture.
For faster execution speeds, use an Internal Variable with an “Initial Value” set to a usage of the no-code function named “Get CultureInfo Object (For Culture-Specific Text Formatting) For Selected ‘Formatting Preferences for Dates, Times, and Numbers'” instead of calling this function thousands of times.
An Internal Variable of Type “CultureInfo Object (For Culture-Specific Text Formatting)” can be used to improve the performance (execution speed) of trading logic that uses a no-code function that has an input parameter with a data type of “CultureInfo Object (For Culture-Specific Text Formatting)”.
By default, a no-code function’s input parameter of this data type is auto-populated with a usage of the no-code function named “Get CultureInfo Object (For Culture-Specific Text Formatting)”.
There is nothing wrong with this if your trading logic only calls this no-code function in this way a small number of times, but if you are calling this no-code function many times, such as would be done when reading thousands of pieces of text from a plain text file and converting them into numbers, dates, or times using the “CultureInfo Object (For Culture-Specific Text Formatting)” object for culture-specific formatting rules, your strategy will execute its trading logic faster if the strategy uses the no-code function named “Get CultureInfo Object (For Culture-Specific Text Formatting)” only once in the “Initial Value” field of an Internal Variable of Type “CultureInfo Object (For Culture-Specific Text Formatting)”, and then uses references to that Internal Variable as the input parameters of all no-code functions that require a “CultureInfo Object (For Culture-Specific Text Formatting)” object as an input parameter.