Introduction
Creating and modifying Quagensia® Functions with the Quagensia® Desktop Application is easy and allows you to get far more value out of Quagensia by greatly extending the capabilities of your installation of Quagensia with proprietary actions and expressions that can be created without code, completely inside of Quagensia by you or any non-programmer. Furthermore, Quagensia Functions allow you to work with programmers on your Quagensia Strategy without them seeing any part of your Quagensia Strategy’s trading logic besides the code they created based on your specifications.
Examples of extending the capabilities of Quagensia with your own Quagensia Functions include:
- You can create a proprietary action or expression that accomplishes something that can’t be done with the functions that come with your installation of your edition of Quagensia. For example, you may have access to a function containing 500 lines of code in TradeStation®’s EasyLanguage® programming language or in NinjaTrader®’s NinjaScript® programming language that returns a Boolean (true or false) to indicate if a complicated chart pattern has occurred. If Quagensia didn’t support the creation of your own Quagensia Functions you would have no way to use this code visually and codelessly from within Quagensia. Fortunately, Quagensia makes it easy to create your own proprietary Quagensia Function and then call actual code from within the “Function Logic” section of the Quagensia Function, and then use the Quagensia Function in both your Quagensia Strategies and other Quagensia Functions completely visually and codelessly with two clicks: one to open the context menu at a location where your Quagensia Function is allowed to be used, and another click to add that Quagensia Function to your Quagensia Algo from the context menu item that represents it.
- You can create a Quagensia Function that allows you to quickly and easily reuse complex logic that you find yourself using in multiple locations in multiple algos by calling a single one of your proprietary Quagensia Functions in each location rather than having to copy and paste a complex expression or lots of actions between algos whenever you want to use the complex logic, and then having to go back through all of the places where you copied and pasted the complex logic every time that you think of a way to improve it.
- Quagensia Functions allow you to work with programmers on your Quagensia Strategy without them seeing any part of your Quagensia Strategy’s trading logic other than the Quagensia Function that they created based on your specifications. For example, you can pay a programmer to write 500 lines of code inside of a function written in TradeStation®’s EasyLanguage® programming language or NinjaTrader®’s NinjaScript® programming language that returns a Boolean (true or false) to indicate if a complicated chart pattern has occurred, then either you or the programmer can quickly and easily create a Quagensia Function that uses this function that contains 500 lines of code. This can all be done without the programmer having access to any of your trading logic other than the chart pattern that they programmed. The programmer can email you the function with 500 lines of code and instructions on how you get the code into the trading platform, and either you or the programmer can create a very simple Quagensia Function that uses the code, and you can then easily use the 500 lines of code using a Quagensia Function that you can use visually and codelessly with two clicks on your algo’s workspace, without being able to program.
- Quagensia Functions can call other Quagensia Functions, so you can create an ever expanding library of proprietary trading logic that can be added to any Quagensia Algo with two clicks. When you first start using Quagensia you may be completely happy with the Quagensia Functions that come with Quagensia. Over time, you will likely want to start extending Quagensia to support the way that you trade. As more time passes, you will likely want to create composite Quagensia Functions that are made up mostly of calls to other Quagensia Functions that you made previously. Once you’ve made your own massive library of composite Quagensia Functions, your installation of Quagensia may seem more like your own highly proprietary codeless trading strategy development environment developed by your own team of programmers rather than the piece of software called Quagensia that everybody else is using.
The code output of a Quagensia N Edition Function’s logic can either be inlined or can be wrapped in an actual function definition.
The “Function Summary” section of a Quagensia N Edition Function has a check box titled “Wrap in a Function in Code Unconditionally (Instead of Letting Quagensia Make the Decision for Me)”.
If this check box is checked, the Quagensia N Edition Function’s code output will be wrapped in an actual function in the code output of the Quagensia Algo that uses the Quagensia N Edition Function and the outputted function in the code will be called at the location where it is used.
If unchecked, all of the Quagensia N Edition Function’s code output will be “inlined” at the location where it is used unless the Quagensia code generation engine determines that the Quagensia N Edition Function should be wrapped in an actual function rather than “inlined”, in which case the Quagensia code generation engine will wrap the Quagensia N Edition Function’s code in an actual function automatically.
If a Quagensia N Edition Function outputs a tiny amount of code, then “inlining” a Quagensia N Edition Function’s code output at the location where it is used can make the code output easier to read because the person reading the code doesn’t need to scroll up or down in the code to find the function definition of the function being called to know what the code is doing.
On the other hand, if a Quagensia N Edition Function outputs a large amount of code, then wrapping a Quagensia N Edition Function’s code in an actual function and then calling it from the location in the code where it is used can be easier to read, especially if the same function is used multiple times in a Quagensia Algo.
Furthermore, sometimes a Quagensia N Edition Function needs to be wrapped in an actual function in the code to work properly. For instance, you should check this check box if any of the following are true:
- This function has code in a “Raw Code Output” Action or “Raw Code Output” Expression that uses its own “local variables” that are not defined in the function’s Input Parameters section or Internal Variables section within Quagensia.
- This function is an Expression Function, i.e. it returns an expression, and has any logic components other than a “Raw Code Output” Expression with a single compound expression in an “Exit Function With This Return Value” action.
- It’s safe to check this check box, so if your function has logic that may or may not need to be wrapped in a function to work properly, you should check this check box.
Note that the kinds of things that Quagensia will let you build into a Quagensia N Edition Function differ based on if this function will be wrapped in a function in code or if its contents will be inlined.
Note that the “Function Summary” section of a Quagensia T Edition function does not have the check box titled “Wrap in a Function in Code Unconditionally (Instead of Letting Quagensia Make the Decision for Me)” because Quagensia T Edition function code output is always “inlined” at the location where it is used.
The best ways to quickly get up to speed to be able to create and use your first Quagensia Function are as follows:
STEP #1: Watch some or all of the relevant Quagensia video tutorials listed on the “Start Page” tab of Quagensia and follow along.
STEP #2: After watching the videos in Step #1, you can quickly learn by example by viewing, copying, and making your own small changes to your copies of the Quagensia Functions that come pre-installed with all editions of the Quagensia Desktop Application.
Once you’ve installed Quagensia on your computer, you can browse through the built-in Quagensia Functions using the Algo Explorer and you can search through them using the Search Window.
To view and copy the pre-installed Quagensia Functions available in the Algo Explorer, expand the Algo Explorer Tree’s “Algos from Quagensia” >> “Functions” tree item, then expand the “Actions” tree item to view Quagensia Action Functions or expand the “Expressions” tree item to view Quagensia Expression Functions. When you see a Quagensia Function you want to view or copy, click on it and choose either “View Function” or “Create New Function from Copy of This Function” from the menu item in the context menu that appears.
Please read the Search Window documentation to learn how to search for, view, and copy the pre-installed Quagensia Functions in the Search Window.
STEP #3: Learn as you work with real-time context-sensitive help.
The real-time context-sensitive help built into Quagensia is much better than any comprehensive textbook, because it allows you to learn about the things you need to learn about, when you need to learn them, and not worry about the thousand other things that may be of use to you someday.
You can access real-time context-sensitive help as you build your own Quagensia Strategies and Quagensia Functions through both tooltips as well as the real-time help that appears in the Context-Sensitive Help panel and includes a description of whatever is under your mouse cursor as well as links to its related online help documentation.