Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Standard / Custom Indicator Use within a Strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Standard / Custom Indicator Use within a Strategy

    Here is a common usage scenario that arises when I am developing strategies for others that I thought I would share to help those starting out with strategy development . . .

    One very nice feature of NinjaScript strategies is the ability to Add() indicators to a chart to help visualize the underlying setup in your trading system. Although technically, the dataseries being plotted is a different than the dataseries used in your entry/exit setup logic, you can be assured that each OnBarUpdate value is the same if each indicator call is driven by the same set of input parameter values. Should you ever have any doubt, you can always Print() the internal values and compare them to the plotted values.

    Some indicators you might consider using contain collections of both Lines and Plots. Take the commonly used Stochastics indicator for example. It displays Lines for OB/OS and Plots for %D/%K. Now suppose you would like to use this indicator in a NinjaScript strategy and you want to input parameter values for PeriodD, PeriodK, Smooth, AND OB/OS values. In this context would Add()'ing the standard Stochastics indicator do the trick? No, as the standard indicator does not offer a parameter control the static OB/OS Lines nor can you manipulate the value of Line Collection members directly from the strategy. Also, keep in mind that although you have passed in these OB/OS values as parameters of your strategy, there is no way to Plot() these strategy specific values to the chart . . . . only indicators can Plot() directly to a chart.

    In this situation you would be left with two options, 1) create your own custom Stochastics indicator with its unique name, say StochasticsOBOS, that will allow you to pass in the static OB/OS values or 2) use a combination of the standard Stochastics indicator and standard Constant Lines indicator to achieve the same objective within your strategy.

    Hope this is helpful. Comments and suggestions from NT Support and other users are most welcome.

    Regards,

    Whitmark
    whitmark
    NinjaTrader Ecosystem Vendor - Whitmark Development

Latest Posts

Collapse

Topics Statistics Last Post
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
0 responses
571 views
0 likes
Last Post Geovanny Suaza  
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
0 responses
331 views
1 like
Last Post Geovanny Suaza  
Started by Mindset, 02-09-2026, 11:44 AM
0 responses
101 views
0 likes
Last Post Mindset
by Mindset
 
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
0 responses
549 views
1 like
Last Post Geovanny Suaza  
Started by RFrosty, 01-28-2026, 06:49 PM
0 responses
549 views
1 like
Last Post RFrosty
by RFrosty
 
Working...
X