Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using an Indicator with a secondary data in a Strategy

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

    Using an Indicator with a secondary data in a Strategy

    Hi all. I am using this Open Breakout Indicator as a base (https://ninjatraderecosystem.com/use...nge-indicator/) to created a modified version that is simpler and have a few public variables for upper and lower ranges. It works well as an indicator in all timeframes as expected.

    The issue is that I am trying to use it from a strategy and can't make it work. I read I also need to add the same dataseries in the host, so I did but still upper and lower does not set.

    private OBR2 OBRIndicator;

    else if (State == State.Configure)

    {
    ​AddDataSeries(BarsPeriodType.Minute, 1);
    }

    else if (State == State.DataLoaded)
    ​{
    OBRIndicator = OBR2 (DateTime.Parse("09:30",...,...);

    AddChartIndicator(OBRIndicator);
    ​}


    What am I missing?

    Much appreciated as always.

    Thanks




    #2
    Hello tradebot,

    Thank you for your post.

    Does your version of the indicator have a plot? The indicator you linked to does not have a plot, so Update() would potentially need to be called. The following note from the OnBarUpdate() page of the help guide is relevant here:
    • "Hosted indicators will need to be accessed by the hosting script to ensure OnBarUpdate functionality. This can be done by: 1) Calling Update on the hosted indicator within the host script, 2) Including a plot in the hosted indicator and accessing the plot in the host script, 3) Including a plot in the hosted indicator and adding the indicator to the chart with AddChartIndicator (strategies only)​"
    If your version of the indicator does not have a plot added via AddPlot() then only the first option is relevant. The reference sample that demonstrates "Exposing indicator values that are not plots" calls Update() in the indicator to update the value of the exposed variable for when it is accessed in the strategy:


    Please let us know if we may be of further assistance.

    Comment


      #3
      Thank you Emily. It worked.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      60 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      32 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      44 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      58 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      47 views
      0 likes
      Last Post CarlTrading  
      Working...
      X