Hi Gang,
Any idea where one could find a simple sample code of a Strategy using Keltner channels ?
Just for one to use as a point of departure
Hi Gang,
Any idea where one could find a simple sample code of a Strategy using Keltner channels ?
Just for one to use as a point of departure
You could just make copies of any NinjaScript strategy that uses Bollinger Bands and make tiny changes, since both indicators have an upper, lower, and middle line, and are used in the same ways. If a trading methodology uses Bollinger Bands, none of the trading logic, technical analysis concepts, or quantitative analysis concepts change in any meaningful way.
If you are open to using a third-party no-code strategy builder, the one from Quagensia has quite a few Bollinger Bands-based strategies for NinjaTrader built in, some of which are shown in the screenshot below. To create a Keltner channel strategy out of any of the Bollinger Bands strategies, just click one of the strategies on the left side of the app and select the âCreate New Strategy From Copy of This Strategyâ context menu item, scroll down to the âInternal Variablesâ section and switch out the Bollinger Bands indicator with a Keltner Channel indicator as shown in the screenshot below, and then scroll down to the âWhen Bar Updatesâ section and make sure that the proper Keltner Channel plots (upper, middle, or lower) are being used in the no-code trading logic. Once youâve converted a Bollinger Bands strategy into a Keltner Channel strategy, click the appropriate button at the bottom of the app to send the plain text NinjaScript strategy code file to NinjaTrader, where you can use it just like you would use any other NinjaScript strategy that you might normally manually code.
Quick question as I try to understand Quagensia
It looks like I can access a number of strategies (similar to NT8 Strategy Builder)
In this example, I can switch out Bollinger Bands for Keltners.
By the looks of âtemplate namesâ , I can have a Keltner Strategy with Stops and Profit targets.
Does Quagensia have the ability to provide a sample where the take profit (ExitLongLimit) is based on the value of the Keltner channel from the prior bar ? and where the take profit order changes OnBarUpdate (). i.e, the take profit order is based on the upper keltner channel which changes bar by bar.
Great questions.
Yes! You can do all of this quickly and easily without code in Quagensia N Edition and send the NinjaScript strategy to NinjaTrader with the click of a button.
Note that the strategies in the âStrategy Templates (Click & Copy to Start Fast)â folder in Quagensia N Edition that are shown in the previous screenshot are mostly intended for brand new users on day 1, so they use the most basic âstaticâ money management techniques. There are many far more advanced strategies built into Quagensia N Edition that are not in the screenshot, and all of them can be used as âtemplatesâ by making a copy of them even though they donât have the word âtemplateâ in the name.
Does Quagensia have the ability to provide a sample where the take profit (ExitLongLimit) is based on the value of the Keltner channel from the prior bar ? and where the take profit order changes OnBarUpdate (). i.e, the take profit order is based on the upper keltner channel which changes bar by bar.
While there is no built-in strategy that does exactly what you are asking, this logic is very simple to build in Quagensia N Edition without code.
Here are two of the options available to you in the current version of Quagensia N Edition that will allow you to accomplish this:
The easiest way, and the one that I recommend for new users, is with the built-in no-code âSet Profit Targetâ functions. In Quagensia N Edition you can simply add two âSet Profit Targetâ function calls to the âWhen Bar Updatesâ section to do this. The first âSet Profit Targetâ function call should go directly before you enter a position in the âWhen Bar Updatesâ section. Its âCalculation Modeâ should be set to âPriceâ and its âCalculation Valueâ should be set to the value of the Keltner Channel plot of interest on the previous bar (so long as that price is on the âgoodâ side of the current Ask price, or else your limit order could get rejected⌠you can use no-code functions for the Ask and the Maximum of 2 values to handle this). The second âSet Profit Targetâ function call should go in a separate âOtherwise, if the following condition is trueâŚâ block that checks if the Current Market Position for the strategy is not Flat, its âCalculation Modeâ should also be set to âPriceâ and its âCalculation Valueâ should be set to the value of the Keltner Channel plot of interest of the current bar (again, so long as that price is on the âgoodâ side of the current Ask price, or else your limit order could get rejected⌠you can use no-code functions for the Ask and the Maximum of 2 Values to handle this). This really is no big deal to do without code in Quagensia N Edition, even for new users. If you need help doing this, this is exactly the kind of question that Quagensia customers get answers to (with screenshots) in the Quagensia Discord.
A significantly more difficult but potentially more powerful way for Quagensiaâs more advanced users to do this completely without code is by doing the same thing as described above, but with one of the built-in no-code functions for exiting a long position using a limit order. Quagensia has always had no-code versions of the more basic âExitLongLimitâ NinjaScript variants, and as of yesterdayâs new version, Quagensia N Edition now has complete support for âadvanced managed order handlingâ, so you can even do things like submit a limit order that is âLive Until Cancelledâ rather than the order getting cancelled on each bar. You can even do this in the âWhen OnExecutionUpdate Occursâ section of your strategy, which is executed when the entry fill(s) come back for your entry order so that your position will have a profit target very soon after you enter a new position instead of having to wait until the next execution of the âWhen Bar Updatesâ section. And since Quagensia N Edition has support for popular rich NinjaScript objects like the âOrderâ object, you can create a no-code Internal Variable of type âNinjaScript Order Objectâ and you can then set this Order Internal Variable to the limit order that is passed to the âWhen OnOrderUpdate Occursâ section of your strategy, and then in the âWhen Bar Updatesâ section you can change the limit price of the limit order to which your âNinjaScript Order Objectâ Internal Variable is set with the no-code function that lets you change the limit price of such a NinjaScript Order Object. You would just need to set the NinjaScript Order Object to the no-code function that represents the ânull valueâ in the âWhen Order Updatesâ section when the limit order to exit your position is filled, cancelled or rejected (which is easy to do without code by looking at the orderâs âOrderStateâ using the corresponding no-code function).
These are the two ways that I would recommend creating the trading logic you were asking about, one for new users and one for advanced users that want something that might not be possible when using the âSet Profit Targetâ function. But frankly, there isnât much that the âSet Profit Targetâ canât do that an âExit Limit Orderâ can.
The new version of Quagensia N Edition that was released yesterday has a ton of new features, including some mentioned in point 2 above. If you wanted to see the whole list of just what was released yesterday, you can read the release notes here:
Release Notes â Quagensia N Edition â Point-and-Click Strategy Builder for NinjaTraderÂŽ
And if you wanted to see some screenshots of the new features, including some I mentioned above, you can see a bunch of them that were posted yesterday in the general-chat channel of the Quagensia Discord.