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 Hwop38, 05-04-2026, 07:02 PM
          0 responses
          152 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          305 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          244 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          345 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          176 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Working...
          X