Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Gap detector

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

    Gap detector

    Hi, I would like to create an indicator to detect upside gaps automatically on charts. When the opening price is above the previous day close, I would like an array to appear on the chart on the current bar. It would be supposed to work on any data series (daily, minutes, etc.) and over the period defined by the user.

    I have tried with the code below, but I do not understand why it does not work...

    Any help?

    Thank you

    HTML 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()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.MediumTurquoise), PlotStyle.Square, "UpGap"));
    Overlay = 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.
    if (Open[0]>High[1])
    {
    DrawArrowUp("up arrow"+CurrentBar, false, 0, Low[0] - 2 * TickSize, Color.Green);
    }
    }

    #2
    Manuel17, do you see any errors in the NT log tab when you apply this script to your chart?

    From your snippet shared, I feel you run into this issue - http://www.ninjatrader.com/support/f...ead.php?t=3170

    Comment


      #3
      Hello NinjaTrader_Bertrand, I did not have any error, but it solved the matter!

      Thank you very much for your help!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      577 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
      553 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