Using Numbers

Introduction

Each edition of the Quagensia® Desktop Application supports all of the core numeric data types that its target trading platform supports.

The two most important numeric data types for developing trading strategies are “Decimal Number” and “Whole Number”.

The third most important type is “Whole Number (Huge)”, for situations where you need to represent a whole number that is greater than 2,147,483,647 or less than -2,147,483,648.

Advanced users may have a need to use one of the other more advanced, less popular numeric data types, but most users, even most advanced users, will probably never need to use any numeric data type other than the three previously listed. A legitimate use of the more advanced data types would be if you have access to a dll with functions that accept or return one of the rarer data types and you want to call the dll’s functions from within your Quagensia Algos.

The many ways to use numbers within your Quagensia Algos are described in many of the other help pages, but here are a few things to note:

  1. When you enter a decimal number into a text box, use a point (‘.’) instead of a comma for a decimal point. Example: Type 1.5 to represent a number between 1 and 2.
  2. To write a negative number, use a negative sign (‘-‘) to the left of the number, with no spaces between the negative sign and the number.
  3. Do not use thousands separators. For example, write one million as 1000000, not 1,000,000 and not 1.000.000.
  4. Determining if two “Decimal Number” values are exactly equal is counterintuitive and a major potential source of bugs both for new Quagensia users and for new programmers of probably every programming language that supports floating point numbers such as double-precision decimal numbers (which Quagensia calls “Decimal Numbers”). Checking if two decimal numbers are exactly equal produces illogical results, because nearly every decimal number that you can think of cannot be stored exactly as a double-precision decimal number and so is an approximation of the number that it represents. One simple solution is to create trading strategies that don’t depend on two “Decimal Number” values being exactly equal, and instead only rely on logic that checks if one decimal number is larger or smaller than another decimal number. If you really do need to compare two decimal numbers for approximate equality in Quagensia N Edition, you can compare them with one of the “Advanced Decimal Comparisons” Quagensia N Edition functions that are located under “Set/Replace Item >> Conditions >> Standard Condition (X = Y, X > Y, etc.) >> Advanced Decimal Comparisons” in the context menu that appears when you click on any location that allows “Boolean (True or False)” expressions. Another option for determining if two decimals are approximately equal in a Quagensia N Edition algo is to round both decimal numbers to the nearest tick for the instrument on which your strategy is running and then compare the rounded values. Note that some programming languages, such as TradeStation®‘s EasyLanguage®, handle this challenge by default by making all decimal equality comparisons return true if the two decimal values being compared contain “almost the same” value, so by default all equality comparisons for decimal numbers in TradeStation® strategies actually determine if two decimal numbers are approximately equal, not if they are exactly equal. Search for “Set Floating Point Equality Comparison Tolerance” in Quagensia T Edition or view the list of no-code “Set Floating Point Equality Comparison Tolerance” functions built into Quagensia T Edition on the “Using Conditions” help page to view the Quagensia Functions that allow you to change the way that decimal numbers are automatically compared for equality in the TradeStation® EasyLanguage® strategy code output and read the TradeStation® 9.5 online help page for the SetFPCompareAccuracy reserved word.

Quagensia N & T Editions have built-in functions for rounding decimal numbers and converting to and from specific numeric types.

The no-code functions built into Quagensia N & T Editions for rounding decimal numbers and converting to and from specific numeric types are listed below with links to their help pages. Each of these expression functions is displayed in the same subfolder in which you can find it in the Quagensia Desktop Application’s Algo Explorer and in the context menu that appears when you click on a location on your Quagensia Algo’s workspace where the expression function is allowed to be used.

The next section lists the functions built into Quagensia N Edition for rounding decimal numbers and converting to and from specific numeric types (and includes a few functions for converting to and from non-numeric types). You can also scroll down to the list of these functions built into Quagensia T Edition further down on this page.

No-Code Functions Built into Quagensia N Edition (For NinjaTrader®) for Rounding Decimal Numbers and Converting Between Two Data Types

No-Code Functions Built into Quagensia T Edition (For TradeStation®) for Rounding Decimal Numbers and Converting Between Two Data Types

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.