Keltner Strategy sample

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:

  1. 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.

  2. 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.