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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      62 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      134 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      75 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      50 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X