The Basics of Using Secondary Price Bars in a Quagensia N Edition Strategy
You can use secondary price bars in your Quagensia® N Edition Strategies to enable your strategies to run on a main set of price bars but access data from a second, third, fourth, or higher order set of “secondary price bars”.
For example, you can create a strategy that uses the daily price bars for a single stock as its primary price bars, but your strategy can also consider the high or low prices of a “secondary” set of price bars, such as the daily price bars of gold futures or the monthly price bars of the same stock on whose daily data your strategy is using as its primary price bars.
The NinjaTrader® Desktop platform provides excellent support for NinjaTrader® strategies that use secondary price bar data series in their trading logic. You can read the official Ninjatrader® Help Guide’s Multi-Time Frame & Instruments topic to get a deeper understanding of the concepts involved with trading strategies that use secondary price bars in NinjaTrader.
Quagensia N Edition allows you to create an Internal Variable of type “Secondary Price Bars” in a Quagensia N Edition Strategy that creates a secondary price bar time series in your NinjaTrader strategy. A secondary price bar time series can have a different symbol, a different bar period, or a different symbol and bar period than the main set of price bars, i.e. the “primary price bars”, on which your strategy runs.
See the Using Secondary Price Bars in a Quagensia N Edition Strategy help page to learn more about adding Secondary Price Bars to a Quagensia N Edition Strategy generally. Most of the topics on that help page apply to doing this using either the standard no-code user interface or doing this using the advanced user interface by pasting a line of NinjaScript code into a text box (which is the specific topic of the help page you are reading now).
You can add Secondary Price Bars of *any* bar type supported in a NinjaTrader NinjaScript Strategy by pasting a single line of NinjaScript code into a text box in Quagensia N Edition.
When you click the button labeled “Paste a Line of Code into a Text Box Instead to Add Secondary Price Bars of *Any* Bar Type Supported in NinjaScript® (Advanced)” at the bottom of the user interface of a Secondary Price Bars Internal Variable in the Internal Variables grid of a Quagensia N Edition Strategy, the standard no-code user interface for adding Secondary Price Bars will be replaced with an advanced user interface that has a text box where a line of NinjaScript code can be pasted to add a Secondary Price Bars Internal Variable (i.e. a secondary data series) of any bar type that supports being added to a NinjaTrader NinjaScript strategy with a line of NinjaScript code, including secondary data series of the following bar types:
- Volumetric Bars (Using the “AddVolumetric” Function)
- Renko Bars (Using the “AddRenko” Function)
- Heiken Ashi Bars (Using the “AddHeikenAshi” Function)
- Kagi Bars (Using the “AddKagi” Function)
- Line Break Bars (Using the “AddLineBreak” Function)
- Point and Figure Bars (Using the “AddPointAndFigure” Function)
- Price on Volume Bars (Using the “AddPriceOnVolume” Function) (We at Quagensia know of no official help page for the “AddPriceOnVolume” function.)
- Delta Bars (Using the “AddDataSeries” function like the following, where 15 is the Order Flow Delta bar type, Value is the Trend Delta, and Value2 is the Trend reversal:
- AddDataSeries(null, new BarsPeriod() { BarsPeriodType = (BarsPeriodType)15, Value = 500, Value2 = 500 });)
- Custom Bar Types from Third Parties (Using a Line of Code Provided by the Third Party)
Secondary Price Bars Internal Variables added with a line of code can be used in all of the no-code ways that Secondary Price Bars Internal Variables that are added using the standard no-code user interface can be used in all other locations in a Quagensia N Edition Strategy without any additional code.
Getting Help with Creating the Line of NinjaScript Code to Paste Into the Text Box in Quagensia N Edition to Add a Specific Type of Secondary Price Bars
Option #1: Self-Help
If you are somewhat technical or would like to try to figure out the line of code to paste into the text box in Quagensia N Edition on your own and the bar type of the secondary data series of interest is mentioned specifically in the text on this page and the text includes a link to a web page on the ninjatrader.com website that provides documentation on the NinjaScript function required to add a secondary data series of the specific bar type to a NinjaScript strategy, then you can click the link, read the NinjaScript help page on the ninjatrader.com website, and attempt to figure out the line of NinjaScript code on your own.
Option #2: The Quagensia Discord Community
If you would like to see the lines of NinjaScript code that other Quagensia N Edition users have used to successfully add a Secondary Price Bars Internal Variable using the advanced user interface described on this help page and request help from other Quagensia N Edition users, the Quagensia Discord Community is the best place to do this.
Option #3: Use A Paid NinjaScript Consultant or Technical Colleague (*Without* Sharing the Rest of Your Trading Logic)
Quagensia N Edition is an excellent choice for a no-code strategy builder for working with paid NinjaScript consultants or technical colleagues without sharing any of the trading logic of your trading strategy that these individuals do not absolutely need access to in order to help you. For instance, you can either 1) have a consultant or technical colleague email you the specific line of code you need to paste into the text box, or 2) you can have them send you a Quagensia N Edition Strategy file via email or other file sharing technique whose entire contents consist of one Internal Variable of Type “Secondary Price Bars” in the Internal Variables section with this line of code filled in. If they send you a Quagensia N Edition Strategy file you could then either 1) copy and paste the entire Internal Variable of Type “Secondary Price Bars” from their otherwise empty Quagensia N Edition Strategy into your Quagensia N Edition Strategy full of your secrets and proprietary trading logic using the inter-strategy copy-and-paste feature available from the “gear icon” to the left of the rows in the Internal Variables grid of your and their Quagensia N Edition Strategies or 2) you could just manually copy the line of code from the text box in their Quagensia N Edition Strategy and paste it into your Quagensia N Edition Strategy’s text box.
There are many NinjaScript programming consultants that you can hire to help you build your strategy without code in Quagensia N Edition. There is a list of potential NinjaTrader NinjaScript consultants on the NinjaTrader Ecosystem website, and there are other lists on the internet as well, like the NinjaScript consultants at Upwork.
Volumetric bars and “Price on Volume” bars do not come free with the free version of NinjaTrader.
Both the Volumetric and Price on Volume bar types require payment of some kind, such as a paid NinjaTrader license or a paid subscription to an add-on that you can learn more about on the NinjaTrader website. You can learn more on the Subscribing to the Order Flow+ Add-On help page on the ninjatrader.com website.
Building Strategies for NinjaTrader that Use the Volumetric Data of the NinjaTrader Order Flow “Volumetric” Bar Type without Code using Quagensia N Edition
You can quickly add no-code trading logic to a Quagensia N Edition Strategy for NinjaTrader® that “looks inside of price bars” by using the no-code functions that provide access to the numeric “volumetric” information that each bar of a NinjaTrader Order Flow “Volumetric” bar data series (also called “footprint” or “TPO” bars) makes available to NinjaScript® strategies. To learn more, see the Using NinjaTrader® Order Flow Volumetric Bars and Footprint Charts in NinjaTrader® NinjaScript® Strategies Without Code help page.