Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Display Problem

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

    Indicator Display Problem

    Hi, I've created this code in the strategy wizard, applied it to an indicator. However, the indicator does not work when I apply it, but I know the code is good b/c it works as a strategy. Any help is much appreciated...

    Here is the code:

    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    Overlay = false;
    PriceTypeSupported = false;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.

    // Condition set 1
    if (Open[1] > Close[1]
    && Open[2] > Close[2]
    && Open[3] > Close[3])
    {
    DrawArrowUp("My up arrow" + CurrentBar, false, 0, 0, Color.Lime);
    }

    }

    #region Properties

    #endregion


    Regards,

    Brian

    #2
    Hello,

    In indicators you need to do a CurrentBar check. This link will help:


    You need to add if(CurrentBar < 3) return; after OnBarUpdate().
    DenNinjaTrader Customer Service

    Comment


      #3
      Still can't get it to work. It's strange, b/c it works on my TICK chart, but it dosen't work on a chart of the S&P contaract...Here's the updated code: /// /// Called on each bar update event (incoming tick) /// protected override void OnBarUpdate() { // Use this method for calculating your indicator values. Assign a value to each // plot below by replacing 'Close[0]' with your own formula. // Condition set 1 if (CurrentBar < 3) return; if (Open[1] > Close[1] && Open[2] > Close[2] && Open[3] > Close[3]) { DrawArrowUp("My up arrow" + CurrentBar, false, 0, 0, Color.Lime); } }

      Comment


        #4
        Hello,


        Try using this code, which I tested and works if you paste it within the OnBarUpdate() block:

        if
        (CurrentBar < 3) return;

        if (Open[1] > Close[1]
        && Open[
        2] > Close[2]
        && Open[
        3] > Close[3])
        {
        DrawArrowUp(
        "tag1" + CurrentBar, true, 0, Low[0] - TickSize, Color.Red);
        }
        DenNinjaTrader Customer Service

        Comment


          #5
          Got it Ben... Tks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          579 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 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
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X