Using Colors

Introduction

The Quagensia® Desktop Application’s “Color” data type represents a color with a red, green and blue component that together form a color that can be applied to a line, shape, or text that can be displayed on the chart to which a strategy is attached.

When you create an input parameter or internal variable of type “Color”, you will see a button that you can click on to select a color from a color chooser window. The color chooser window allows you to select a color from a color palette or enter a color using numeric values for its red, green, and blue values. When you select a color and click OK, the button that represents your color variable will show a square with the color you selected, followed by either the name of the color or a hexadecimal value representing the color if the color’s name is not known.

Color variables are just like numeric variables or any other kind of variable. They can be set to different values from the “Set a Variable” action, and the value to set your variable equal to can be selected manually from another color chooser window, can be set to the value of another color variable, or can be the return value of a Quagensia Function that returns a color. You can create time series containing one color for each or your primary instrument’s price bars, lists of colors, single-dimensional and multi-dimensional arrays of colors, and Quagensia Functions that accept colors as input parameters and return colors either as return values or by passing a color variable into the Quagensia Function by reference and setting it from within the function.

To see the many kinds of things you can do with colors and drawing, click on any location in the “When Bar Updates” section where an action is allowed, and browse through the many Quagensia Functions under the “Draw Something” folder of the “Replace Item”, “Add Item Above Me”, or “Add Item Below Me” folders of the context menu that appears.

Creating partially or fully transparent colors and creating colors programmatically in Quagensia N Edition

Creating a partially transparent color in Quagensia N Edition allows you to do things like draw small partially transparent shapes on top of price bars on a NinjaTrader® chart and still be able to see the price bars beneath the partially transparent shapes.

To create a partially or fully transparent color in Quagensia N Edition from a preexisting color manually chosen from a color picker, use the built-in function called “Create a Partially or Fully Transparent Color”. It accepts a color and an “alpha value”, where 0 is 100% transparent and 255 is 100% opaque, and returns a partially or fully transparent color. You can add this function to a Quagensia N Edition Strategy by clicking on a location on the strategy’s workspace where a color is allowed, then navigating to the “More Expressions > Drawing > Colors” context menu subfolder and selecting the “Create a Partially or Fully Transparent Color” function.

To see examples of using partially transparent colors in Quagensia N Edition Strategies, take a look at these three built-in strategies, which use the “Create a Partially or Fully Transparent Color” function to create little green partially transparent diamonds at the profit target prices for each bar, and little red, orange, and yellow partially transparent diamonds at the stop loss, breakeven stop, and trailing stop prices for each bar, respectively:

The limitation of Quagensia N Edition’s “Create a Partially or Fully Transparent Color” function is that the color input parameter of this function has to be manually selected from a color picker or set to an expression that returns a color with red, green, and blue values already set so it is not possible to calculate values from 0 to 255 for the red, green, and blue components of the color.

If you want to be able to create a color programmatically instead of manually from a color picker you can use the Quagensia N Edition Function called “Create Color From Alpha, Red, Green, and Blue (ARGB) Values” that accepts a Whole Number from 0 to 255 for the red, green, and blue components where 0 means “none of that color”, 255 means “the maximum amount of that color”, and a number in between 0 and 255 means “some of that color”. Like the “Create a Partially or Fully Transparent Color” function described above, this function also has an input parameter for the “alpha value”, where 0 is 100% transparent and 255 is 100% opaque, and returns an opaque color or a partially or fully transparent color. Since the alpha, red, green, and blue (ARGB) input parameters are all Whole Numbers, you can calculate each of the four color components’ values from 0 to 255 and pass the calculated color component values into this function to create a color fully programmatically. You can add this function to a Quagensia N Edition Strategy by clicking on a location on the strategy’s workspace where a color is allowed, then navigating to the “More Expressions > Drawing > Colors” context menu subfolder and selecting the “Create Color From Alpha, Red, Green, and Blue (ARGB) Values” function.

Creating partially or fully transparent colors and creating colors programmatically in Quagensia T Edition

You can create partially or fully transparent colors in your Quagensia T Edition Strategies, and you can create partially or fully transparent colors and opaque colors fully programmatically.

This allows you to do things like draw small partially transparent shapes on top of price bars on a TradeStation® chart and still be able to see the price bars beneath the partially transparent shapes, and optionally even do so using calculated values for the red, green, blue, and “alpha value” (in TradeStation® 10.0) or “transparency value” (in TradeStation® 9.5) of the color.

The following four built-in functions were added to this release to enable you to create partially transparent colors and optionally create opaque colors and partially or fully transparent colors programmatically:

  1. Create a Partially or Fully Transparent Color (TradeStation® 10.0 Only)
  2. Create a Partially or Fully Transparent Color (TradeStation® 9.5 Only)
  3. Create Color From Alpha, Red, Green, and Blue (ARGB) Values (TradeStation® 10.0 Only)
  4. Create Color From Transparency, Red, Green, and Blue (Transparency and RGB) Values (TradeStation® 9.5 Only)

To use one of these functions, click on a location where a color is allowed and select one of the functions above from the “More Expressions > Drawing > Colors” context menu subfolder.

Note that of the four functions above, two are only for TradeStation® 9.5 and two are only for TradeStation® 10.0. We created separate functions for TradeStation® 9.5 and TradeStation® 10.0 because these functions use the “Reserved Word” built into TradeStation® called ARGB() to create a color with transparency. The meaning of the first parameter of ARGB was changed between TradeStation® 9.5 and TradeStation® 10.0. In TradeStation® 9.5, the first parameter of ARGB represents the “Transparency”, where a higher number means more transparent and less opaque. In TradeStation® 10.0, the first parameter of ARGB represents the “Alpha”, where a higher number means more opaque and less transparent.

If you want to use the TradeStation® 10.0 variants of these functions the value of the drop-down list named “Version of TradeStation® In Which This Code Will Be Used” in the Code Generation Tab directly below the Algo Workspace must be set to either “The Newest Version” or to one of the TradeStation® 10.0 “Updates” (versions). Note that if you set this drop-down list to either “The Newest Version” or set it to one of the TradeStation® 10.0 “Updates” (versions), you will still see the TradeStation® 9.5 function variants as options in the context menus that appear when you click on locations where a color can go, but adding a TradeStation® 9.5 variant to that location will cause a validation error to occur when you attempt to save the algo or generate its code.

If you want to use the TradeStation® 9.5 variants of these functions the value of the drop-down list named “Version of TradeStation® In Which This Code Will Be Used” in the Code Generation Tab directly below the Algo Workspace must be set to one of the TradeStation® 9.5 “Updates” (versions). Note that if you set this drop-down list to one of the TradeStation® 9.5 “Updates” (versions), you will still see the TradeStation® 10.0 function variants as options in the context menus that appear when you click on locations where a color can go, but adding a TradeStation® 10.0 variant to that location will cause a validation error to occur when you attempt to save the algo or generate its code.

The two functions “Create a Partially or Fully Transparent Color (TradeStation® 10.0 Only)” and “Create a Partially or Fully Transparent Color (TradeStation® 9.5 Only)” allow you to create a partially or fully transparent color from a color and a Whole Number that either represents an “alpha value” in the TradeStation® 10.0 function variant or a “transparency value” in the TradeStation® 9.5 function variant.

The limitation of these two functions is that the color input parameter of this function has to be manually selected from a color picker or set to an expression that returns a color with red, green, and blue values already set so it is not possible to calculate values from 0 to 255 for the red, green, and blue components of the color. To get around this limitation, you can use either the “Create Color From Alpha, Red, Green, and Blue (ARGB) Values (TradeStation® 10.0 Only)” function or the “Create Color From Transparency, Red, Green, and Blue (Transparency and RGB) Values (TradeStation® 9.5 Only)” function. These two functions accept a Whole Number from 0 to 255 for the red, green, and blue components where 0 means “none of that color”, 255 means “the maximum amount of that color”, and a number in between 0 and 255 means “some of that color”. Like the functions described in the previous paragraph, these two functions also have an input parameter for the “alpha value” in the TradeStation® 10.0 function variant or the “transparency value” in the TradeStation® 9.5 function variant. Since the alpha (or transparency), red, green, and blue (ARGB) input parameters are all Whole Numbers, you can calculate each of the three red, green, and blue color components’ values from 0 to 255 and calculate either the “alpha value” from 1 to 255 (for the TradeStation® 10.0 function variant where 1 is 100% transparent and 255 is 100% opaque) or the “transparency value” from 0 to 254 (for the TradeStation® 9.5 function variant where 0 is 100% opaque and 254 is 100% transparent) and pass the calculated color component values into this function to create a color fully programmatically.

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.