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 sjsj2732, Yesterday, 04:31 AM
      0 responses
      31 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      286 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      283 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      133 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      91 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X