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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      156 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      90 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      138 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      130 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X