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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      93 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      138 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      123 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      73 views
      0 likes
      Last Post PaulMohn  
      Working...
      X