Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator vs Strategy

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

    Indicator vs Strategy

    Hello,

    I'm trying to get familliar with the NinjaTrader platform and its indicators and strategys. I have written a stimple indicator that repaints a bar if it meets condidtions (meant to indicate a reversal).

    The problem is, the bar painting works as a strategy but not as an indicator. The problem with this is that I have to be connected to a data feed in order for the bars to be repainted. So checking past charts offline doesn't work.

    It's not the end of the world, but I'm curious why the strategy works and the indicator doesn't. Can I not repaint bars as an indicator? The only difference in the code (as far as my action goes) is in the initialize where I have overlay set to true in the indicator and that isn't in the strategy code. I tried the drawdot and plotcolors and neither of those work in the indicator as well. Thanks.

    protectedoverridevoid Initialize()
    {
    Overlay = true;
    CalculateOnBarClose =
    false;
    }

    protectedoverridevoid OnBarUpdate()
    {
    //bar down
    if( High[0] > MAX(High, DPeriod)[1] && Close[0] < Close[1] && Open[1] < Close[1])
    {
    this.BarColor = Color.Magenta;

    //DrawDot("tag1", true, 0, Low[0] - 1, Color.Red);
    }

    //bar up
    if( Low[0] < MIN(Low, UpPeriod)[1] && Close[0] > Close[1] && Open[1] > Close[1])
    {
    this.BarColor = Color.Aqua;
    //PlotColors[0][0] = Color.Aqua;
    }
    }

    #2
    Ok I got it. Sorry.

    Comment


      #3
      Hello,

      Thank you for letting us know this was resolved.

      If you would like to provide the conclusion you came to it may be helpful for others if they come across this post.

      Please let me know if I may be of further assistance.

      Comment


        #4
        Sure. Put this as the first code in OnBarUpdate

        if (CurrentBar < DPeriod + 1 || CurrentBar < UpPeriod + 1)
        return;

        Comment

        Latest Posts

        Collapse

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