Warning: The advanced procedure below was used by the old, out-of date way of getting custom NinjaTrader® Indicators Into Quagensia N Edition.
It still has some relevance for getting custom TradeStation® EasyLanguage® functions that return indicator values into Quagensia® T Edition, but all Quagensia N Edition users should now use the new automatic process for getting NinjaTrader® indicators imported into Quagensia N Edition all at once in a batch process, which you can learn how to do by watching the video on the following help page:
As a bonus, the indicator import process also imports over 200 “List of Choices” data types that you can use in your Quagensia N Edition Strategies as input parameters that appear as (optimizable!) drop-down lists in NinjaTrader®, drop-down list internal variables in your strategies, or drop-down lists in your strategies’ trading logic, and the drop-down lists used by an imported indicator will also be imported automatically into Quagensia N Edition, making the complicated procedures for getting a drop-down list’s hard-coded numerical values into Quagensia N Edition unnecessary for all but the rarest edge cases.
Introduction
This is an advanced topic that is only relevant to custom NinjaTrader® indicators whose input parameters’ order, number, or data types are different than the order, number, or data types of the input parameters of the Quagensia N Edition Function that makes the indicator available to be used in Quagensia Strategies without code. See the two main use cases below to see when this rare situation might arise. See the The Old, Out-Of-Date Way of Getting Custom NinjaTrader® Indicators Into Quagensia N Edition that Still Has Some Relevance for Getting Custom TradeStation® EasyLanguage® Functions that Return Indicator Values Into Quagensia T Edition help page to learn the basics of getting custom indicators into Quagensia N Edition before you try to follow the instructions on this help page or if your custom indicator’s input parameters are the same as the input parameters of your Quagensia N Edition Function that gives you access to it from within Quagensia N Edition.
When you follow the instructions on the The Old, Out-Of-Date Way of Getting Custom NinjaTrader® Indicators Into Quagensia N Edition that Still Has Some Relevance for Getting Custom TradeStation® EasyLanguage® Functions that Return Indicator Values Into Quagensia T Edition help page, you will copy one of the Quagensia N Edition indicator functions as a starting point for the Quagensia N Edition indicator function for your custom indicator. When you do this, you will have a Quagensia N Edition Function whose return type is “Indicator Time Series”, and it will have a field in the Function Summary section labeled “Custom Param List in Indicator Code Output (If Different from Input Param List) (This Field is Very Rarely Required)”. The rest of this help page will teach you how to use this field to create Quagensia N Edition indicator functions that have different input parameters than those in your custom indicator’s NinjaScript® code.
How to Fill Out the “Custom Param List in Indicator Code Output (If Different from Input Param List) (This Field is Very Rarely Required)” Field
In the rare scenario where the order, number, or data types of a Quagensia Function’s input parameters are different from the order, number, or data types of the input parameters that need to be passed to the trading platform’s indicator exposed by the Quagensia Function, the “Custom Param List in Indicator Code Output (If Different from Input Param List) (This Field is Very Rarely Required)” field needs to be filled out.
If this field has any text in it, the value to pass to each input parameter of the trading platform’s indicator must be on its own line.
If a trading platform’s indicator has 10 input parameters, this field must have exactly 10 lines of text, and the lines of text must be in the same order as the input parameters of the trading platform’s indicator appear in the code that would be used to create the indicator from within a strategy in the trading platform.
It is acceptable to have some lines with data that is hard-coded, like 0, true, or “This is some text”, in order to use the hard-coded data on that line as the value passed to the trading platform’s indicator’s input parameter represented by that line.
It is also acceptable to have a single input parameter with hard-coded data to its left and/or right on one line, as is demonstrated in the “Use Case #2: Custom ‘Enumerated Constants'” example below.
It is also acceptable to have multiple input parameters from a Quagensia Function combined together in a calculation or other expression on the same line if the objective is to use a more complex expression for the value of the trading platform’s indicator’s input parameter represented by that line in this field.
To add a Quagensia Function’s input parameters to the “Custom Param List in Indicator Code Output (If Different from Input Param List) (This Field is Very Rarely Required)” field’s text box, right click inside the text box, then select from the list of the Quagensia Function’s input parameters displayed in the context menu that appears.
The first non-empty line of the text box will be passed into the first parameter of the trading platform’s indicator, the second non-empty line will be passed into the second input parameter, etc.
Use Case #1: Hard-Coding Additional Input Parameters
The “Custom Param List in Indicator Code Output (If Different from Input Param List) (This Field is Very Rarely Required)” field allows you to create a Quagensia Function that accepts three input parameters, but that exposes an indicator in the trading platform with five input parameters, the last two of which you want to always pass a value of “false” or a hard-coded number like “0” into, rather than giving the user of this Quagensia Function the choice of passing “true” or “false” or a number of their choice into the last two input parameters. To pass a hard-coded value such as these into the trading platform’s indicator’s input parameters, enter the value as it would be entered in the trading platform’s programming language. For instance, to pass “0” as the fourth input parameter, just enter the number 0 on the fourth non-empty line of this text box.
Use Case #2: Custom “Enumerated Constants”
The “Custom Param List in Indicator Code Output (If Different from Input Param List) (This Field is Very Rarely Required)” field allows you to create a Quagensia Function for a custom indicator, such as a third-party indicator, that has an input parameter that is a custom “enumerated constant” that is not one of the large number of “List of Choices” data types in Quagensia.
If your custom indicator doesn’t have any enumerated constants, or if it only has enumerated constants that have a corresponding “List of Choices” data type in Quagensia then you don’t need to use this field, and instead can just create one input parameter in this Quagensia Function’s “Input Parameters” section for each input parameter of your custom indicator.
If your custom indicator has a custom enumerated constant that that is not listed in the large number of “List of Choices” data types in Quagensia, you can create a Quagensia Function for this custom indicator by first creating an input parameter in the Quagensia Function’s “Input Parameters” section that is of the underlying data type of the enumerated constant, which will almost always be a “32-bit integer” and which is called a “Whole Number” in the “Type” drop-down list in the “Input Parameters” section, and then in this field add the “Whole Number” input parameter on its own line, then add text to the left of the input parameter like “((HLCCalculationMode)(” (without the double quotes) if the custom enumerated constant of the custom indicator has a data type of HLCCalculationMode, then put two right parentheses to the right of the input parameter like “))” (without the double quotes). The line of text will look something like this:
((HLCCalculationMode)({|~Var~Prior Day HLC Calculation Mode as a Whole Number~0eb8480e097a4bfc95b9c9cf19d67b1b~|}))
You can use this Quagensia Function in a Quagensia Strategy by setting this input parameter to the whole number equal to the numeric value of that constant in the enumerated constant.
To determine the full list of options for the whole number to which the input parameter should be set in order to pass the correct value for the enumerated constant input parameter, you have a few options.
Option #1: Ask the indicator’s author.
If this is a paid indicator, you might be able to ask the vendor of the indicator for these whole number values for each enumerated constant.
Option #2: Look at the indicator’s code, if available.
If the indicator is open source, you may be able to find the whole number values in the definition of the enumerated constant type in code. For instance, if you saw this enumerated constant’s definition in the indicator’s code, you would know which whole numbers to use for each of the enumerated constants.
public enum PriceTypesToUse
{
HighsAndLows = 1,
OpensAndCloses = 2,
OpensHighsLowsAndCloses = 3
}
Sometimes, definitions of enumerated constants have no numbers listed to the right of the enumerated constants, like this example:
public enum PriceTypesToUse
{
HighsAndLows,
OpensAndCloses,
OpensHighsLowsAndCloses
}
When definitions of enumerated constants have no numbers listed to the right of the enumerated constants, the numbers start at 0, so the enumerated constant definition above is the same as this one:
public enum PriceTypesToUse
{
HighsAndLows = 0,
OpensAndCloses = 1,
OpensHighsLowsAndCloses = 2
}
There are rare cases where an enumerated constant definition has numbers to the right of some enumerated constants but not others like this:
public enum CustomListOfColors
{
Blue,
Red,
Yellow = 10,
Black,
White,
Gray = 100,
Orange
}
If the first enumerated constant has no number, it is 0. All other enumerated constants without numbers listed in the enumerated constant type’s definition are 1 larger than the enumerated constant before it. So the whole number values of the enumerated constants above are as follows:
public enum CustomListOfColors
{
Blue = 0,
Red = 1,
Yellow = 10,
Black = 11,
White = 12,
Gray = 100,
Orange = 101
}
Option #3: If all else fails, you will have to write NinjaScript® to find these values, or ask someone to help you do this.
Here is how a person with a little C# knowledge could do if themselves:
- Generate a simple NinjaScript® strategy and send it to NinjaTrader® from Quagensia N Edition.
- Open up the NinjaScript® Editor, and open up the NinjaScript® strategy just sent from Quagensia N Edition in the NinjaScript® Editor.
- Find the line of code that says “protected override void OnBarUpdate()”.
- Put your cursor to the right of the left curly brace (the ‘{‘ character) after this line of code and press enter a few times to create blank lines of code.
- In the middle of the blank lines, type something like this, if for example the case-sensitive name of the enumerated constant type in the custom indicator is “HLCCalculationMode” and it has three enumerated constants, “CalcFromIntradayData”, “DailyBars”, and “UserDefinedValues”: Print(“CalcFromIntradayData: ” + (int)HLCCalculationMode.CalcFromIntradayData + “, DailyBars: ” + (int)HLCCalculationMode.DailyBars + “, UserDefinedValues: ” + (int)HLCCalculationMode.UserDefinedValues);
- Compile the code.
- Open the NinjaScript® Output window.
- Run a backtest of the strategy on an instrument for which you have market data.
- If the line “CalcFromIntradayData: 0, DailyBars: 1, UserDefinedValues: 2” prints out many times in the NinjaScript® Output window, you would know the whole number values of the enumerated constants are 0, 1, and 2.
Once you have the whole number values of the enumerated constants, add them to labels and tooltips so you don’t need to remember them.
If the enumerated constant has only a few values, you could add a suffix to the name of your Quagensia N Edition Function’s “Whole Number” input parameter that represents the enumerated constant, so you would always know which number to set this input parameter to when using this Quagensia N Edition indicator function in a Quagensia N Edition Strategy. For instance, instead of an input parameter name of “PriceTypesToUse”, you could name it “PriceTypesToUse (HL=1, OC=2,OHLC=3)”.
If the enumerated constant has a lot of values, you could make the name of the input parameter “CustomListOfColors (See tooltip for valid values)”, then click the input parameter’s “Show Advanced Fields” link and enter the full list of values in the “Description” field like this:
Blue = 0,
Red = 1,
Yellow = 10,
Black = 11,
White = 12,
Gray = 100,
Orange = 101
Then, when you use this Quagensia N Edition indicator function in a Quagensia Strategy and place your mouse pointer over the name of the input parameter, a tooltip will appear with all the whole number values.