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