Creating Functions with “Wildcard (Any Simple Data Type)” Input Parameters

Introduction

Quagensia® Function authors with more advanced skills who work with lists, arrays, and time series will appreciate the ability to create a Quagensia Function with input parameters of data type “Wildcard (Any Simple Data Type)” and input parameters that are lists, arrays, or time series with the data type of their individual elements set to “Wildcard (Any Simple Data Type)”, which makes it possible to create a single Quagensia Function that can accept data of many different data types, which can then can be used in a way similar to how generic methods in C# and template functions in C++ are used.

To see many examples of how you can use the “Wildcard (Any Simple Data Type)” data type to create a single Quagensia Function that can accept data of many different data types and therefore become more useful in more situations, we recommend that you look at the many Quagensia Functions in the Algo Explorer’s “Algos from Quagensia” folder that accept lists or arrays with the data type of their individual elements set to “Wildcard (Any Simple Data Type)”.

For example, the Quagensia Function that calculate the number of items in a list, located in the Algo Explorer folder “Algos from Quagensia >> Functions >> Expressions >> More Expressions >> Lists >> Number of Items” has an input parameter that accepts a list whose individual elements can be of any data type. The benefit of creating this function using the “Wildcard (Any Simple Data Type)” data type is that it then becomes possible to create a single Quagensia Function that can calculate the number of items in a list whose individual elements are of any data type, instead of having to create and maintain many Quagensia Functions that differ only by the data types of the individual elements of the list input parameter.

Many other examples can be found in the subfolders of the Algo Explorer folders “Algos from Quagensia >> Functions >> Actions >> More Actions >> Lists” and “Algos from Quagensia >> Functions >> Actions >> More Actions >> Arrays”. It is easy to determine which of the Quagensia Functions in these subfolders have input parameters of the “Wildcard (Any Simple Data Type)” data type, because the names of these Quagensia Functions won’t refer to a specific data type, like “Whole Numbers” or “Decimal Numbers”.

Notes about “Wildcard (Any Simple Data Type)” Input Parameters

  • Wildcard input parameters can only be used in two locations in a Quagensia Function: 1) in a Raw Code Output (Single or Multiple Statements) action’s text box or 2) in a Raw Code Output expression’s text box. To insert a reference to a wildcard input parameter from within a Quagensia Function, right click in one of these “Raw Code Output” text boxes and select the wildcard input parameter from the context menu that appears.
  • Note that while it is both possible and easy to “chain” Quagensia Functions together, i.e. create Quagensia Functions that call other Quagensia Functions, such as creating Quagensia Function A, B, C, D, and E, and then calling Quagensia Function B from the Function Logic section of Quagensia Function A, calling Quagensia Function C from the Function Logic section of Quagensia Function B, calling Quagensia Function D from the Function Logic section of Quagensia Function C, and calling Quagensia Function E from the Function Logic section of Quagensia Function D, Quagensia Functions with input parameters of data type “Wildcard (Any Simple Data Type)” cannot pass the expressions passed into their “Wildcard (Any Simple Data Type)” input parameters into another Quagensia Function’s input parameter of type “Wildcard (Any Simple Data Type)”. In order words, while Quagensia Functions can be chained together, “Wildcard (Any Simple Data Type)” input parameters cannot be chained together. You can call Quagensia Functions that accept “Wildcard (Any Simple Data Type)” input parameters from other Quagensia Functions that accept “Wildcard (Any Simple Data Type)” input parameters, but the expressions that can be passed into a “Wildcard (Any Simple Data Type)” input parameter has to be an expression whose expected data type is known in the Quagensia Function that is calling the other Quagensia Function that has the “Wildcard (Any Simple Data Type)” input parameter.
  • When you create a Quagensia Function with multiple “Wildcard (Any Simple Data Type)” input parameters, it is best to make the first “Wildcard (Any Simple Data Type)” input parameter one whose data type can be determined definitively based on the expression to which is it set by the Quagensia Algos that use this function. This is because the Quagensia Desktop Application sets the data types of all “Wildcard (Any Simple Data Type)” input parameters to its best guess determination for the data type of the first “Wildcard (Any Simple Data Type)” input parameter. If the data type of the first “Wildcard (Any Simple Data Type)” input parameter cannot be determined definitively based on the expression to which is it set by the Quagensia Algos that use the function, the Quagensia Desktop Application will make its best guess for the determination of the data type of the first “Wildcard (Any Simple Data Type)” input parameter and therefore all of the “Wildcard (Any Simple Data Type)” input parameters, since all “Wildcard (Any Simple Data Type)” input parameters must have the same data type. For instance, if the first “Wildcard (Any Simple Data Type)” input parameter is allowed to be set to a text box containing a number, which is not recommended for Quagensia Functions with multiple “Wildcard (Any Simple Data Type)” input parameters, the Quagensia Algo that uses this function may set this input parameter to an expression that is a numeric text box with the number “1” in it, forcing the Quagensia Desktop Application to guess if the number should be considered a Decimal Number, Whole Number, Whole Number (Huge), or Whole Number (Non-Negative, Huge) (for editions that support that data type), and the Quagensia Desktop Application’s best guess may not be the desired one from the perspective of the author or user of the Quagensia Algo that uses the function. You can make the first “Wildcard (Any Simple Data Type)” input parameter one whose data type can be determined definitively based on the expression to which is it set by the Quagensia Algos that use the function in one of two ways:
    • If your Quagensia Function has an input parameter that is a list, array, or time series with the data type of its individual elements set to “Wildcard (Any Simple Data Type)”, you can make that input parameter first, because the Quagensia Desktop Application can determine the data type of the individual elements of a list, array, or time series with absolute certainty.
    • You can force the first “Wildcard (Any Simple Data Type)” input parameter of a Quagensia Function with multiple “Wildcard (Any Simple Data Type)” input parameters to be a settable variable, rather than allowing even non-settable expressions in the first “Wildcard (Any Simple Data Type)” input parameter, because the Quagensia Desktop Application can determine the data type of a settable variable with absolute certainty. You can force an input parameter to accept only settable variables by either manually checking the input parameter’s “Pass By Reference” check box, which is located in the “Advanced Fields” section of the input parameter, or you can choose a data type that automatically checks this check box if your edition of the Quagensia Desktop Application has such data types.
  • In the rare scenario that you need to create a Quagensia Function whose nature is such that its first “Wildcard (Any Simple Data Type)” input parameter cannot be one whose data type can be determined definitively based on the expression to which is it set by the Quagensia Algos that use this function by following one of the methods described directly above, the Quagensia Algo that uses the function can still set the first “Wildcard (Any Simple Data Type)” input parameter’s value in a way that will enable the Quagensia Desktop Application to determine its data type with certainty. First off, the only two kinds of expressions whose data types cannot be determined with certainty by the Quagensia Desktop Application are 1) the “A Number Entered Into a Text Box” expression and 2) the “Basic Arithmetic (+, -, *, and /)” expression when one of its operands is a “A Number Entered Into a Text Box” expression or the expressions in its operands have more than one data type and it has no “/ (Decimal Division)” operators. If you or your users want to set the first “Wildcard (Any Simple Data Type)” input parameter of a function to one of these two expressions but you or they want to inform the Quagensia Desktop Application of the exact numeric data type of the expression instead of relying on the Quagensia Desktop Application’s best guess, you or they have the following options:
    • If the Quagensia Algo is either a Quagensia Strategy (any edition) or is a Quagensia N Edition Function, you can 1) create an “internal variable” of the desired data type, 2) set the internal variable to the “A Number Entered Into a Text Box” expression or the “Basic Arithmetic (+, -, *, and /)” expression that shouldn’t be used in the first “Wildcard (Any Simple Data Type)” input parameter, then 3) set the first “Wildcard (Any Simple Data Type)” input parameter to that internal variable. This works because the Quagensia Desktop Application knows the data types of internal variables with certainty since the user who created an internal variable already selected the data type of the internal variable when they created it.
    • If you want to convert a numeric expression of a decimal number data type to a whole number data type before setting the first “Wildcard (Any Simple Data Type)” input parameter or before setting any other location with its value, you can use the appropriate Quagensia Function by clicking on the location where a numeric expression is allowed or expected, then navigating to the context menu folder “Set Me / Replace Me >> More Expressions >> Data Type Conversion and Rounding Decimal Numbers >> Convert Between Two Numeric Data Types (Including Rounding) >> Round a Decimal Number”, navigating to the appropriate context menu subfolder and selecting the appropriate function.
    • If you want a “A Number Entered Into a Text Box” expression to have a data type of “Decimal Number”, just add a “.0” to the end of the number.
    • If you want to convert a numeric expression of any whole number data type to a “Decimal Number” and the expression is not a numeric text box so you cannot simply add a “.0” to the end of the number, you can use the appropriate Quagensia Function by clicking on a location where a numeric expression is expected, then navigating to the context menu folder “Set Me / Replace Me >> More Expressions >> Data Type Conversion and Rounding Decimal Numbers >> Convert Between Two Numeric Data Types (Including Rounding) >> Numeric Data Type Conversions Other Than Rounding Decimal Numbers >> Convert to a Decimal Number” and selecting the appropriate function.
    • If you want to convert the data type of any whole number expression to a different whole number data type, such as converting a “Whole Number” to a “Whole Number (Huge)” or vice-versa, you can use the appropriate Quagensia Function by clicking on a location where a numeric expression is expected, then navigating to the context menu folder “Set Me / Replace Me >> More Expressions >> Data Type Conversion and Rounding Decimal Numbers >> Convert Between Two Numeric Data Types (Including Rounding) >> Numeric Data Type Conversions Other Than Rounding Decimal Numbers”, navigating to the “Convert to a …” folder that ends with the name of the whole number data type to which you want to convert the expression, and selecting the appropriate function.

Submit your high-quality Quagensia tutorials for consideration for free inclusion on our website.

If you publish high-quality Quagensia tutorials on a social media platform like YouTube, please consider submitting them to us. We may promote them for free by linking to them from relevant pages on our website.

To submit your Quagensia tutorials for consideration for free inclusion on our website, use the How to Submit Your Quagensia-Enhanced Content page. We are available by phone or email to help you create, publish, and promote Quagensia-enhanced content. You can also get questions answered in our Content Creator Support Center and in the official Quagensia® Discord community’s content-creators channel.

Thanks for Sharing!

Ready to get started?

Download the Quagensia no-code strategy builder free trial and build your trading strategies now.

Under a dollar a day.

Priced to be an easy decision for most traders.

Join Us on Discord

Build point-&-click strategies for NinjaTrader® and TradeStation® using Quagensia®. Collaborate with other traders to get and give help, build and backtest strategies together, and grow your skills.

Subscribe to our Newsletter

We'll send you product updates and company news from Quagensia as well as curated lists of Quagensia-enhanced content.

Welcome
Content Creators

Quagensia enables content creators to make interactive content. We invite you to create Quagensia-enhanced content and share it on YouTube and other social media channels. You may submit your high-quality Quagensia-enhanced content for consideration for free inclusion on our website.

Screenshots

For larger and additional screenshots, see large Quagensia N Edition screenshots (for NinjaTrader®) and large Quagensia T Edition screenshots (for TradeStation®).

For additional screenshots, see the list of Strategies Built into Quagensia N Edition (for NinjaTrader®) and Strategies Built into Quagensia T Edition (for TradeStation®). Select a built-in strategy that interests you and scroll down for the screenshot. Then scroll up to the top of the page and click the “Overview” link to watch the video on how to use that built-in strategy.

This is a screenshot of the point-and-click trading strategy you will build in Quagensia N Edition (for NinjaTrader®) if you follow along with the video titled Create NinjaTrader® Strategies Using Point-&-Click with Quagensia N Edition – Full Tutorial.

This is a screenshot of the point-and-click trading strategy you will build in Quagensia N Edition (for NinjaTrader®) if you follow along with the video titled "Introduction to Quagensia N Edition".

Click the gear icon that appears when you place your mouse pointer over the location to which you would like to add trading logic. A context menu will appear with filtered options to choose from.

Click the gear icon that appears when you place your mouse pointer over the location to which you would like to add trading logic. A context menu will appear with filtered options to choose from.

Thanks for Sharing!

Ready to get started?

Download the Quagensia no-code strategy builder free trial and build your trading strategies now.

Under a dollar a day.

Priced to be an easy decision for most traders.

Join Us on Discord

Build point-&-click strategies for NinjaTrader® and TradeStation® using Quagensia®. Collaborate with other traders to get and give help, build and backtest strategies together, and grow your skills.

Subscribe to our Newsletter

We'll send you product updates and company news from Quagensia as well as curated lists of Quagensia-enhanced content.

Welcome
Content Creators

Quagensia enables content creators to make interactive content. We invite you to create Quagensia-enhanced content and share it on YouTube and other social media channels. You may submit your high-quality Quagensia-enhanced content for consideration for free inclusion on our website.