Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    BertrandNinjaTrader Customer Service

    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 fx.practic, 10-15-2013, 12:53 AM
      5 responses
      5,404 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Started by Shai Samuel, 07-02-2022, 02:46 PM
      4 responses
      95 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Started by DJ888, Yesterday, 10:57 PM
      0 responses
      8 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by MacDad, 02-25-2024, 11:48 PM
      7 responses
      159 views
      0 likes
      Last Post loganjarosz123  
      Started by Belfortbucks, Yesterday, 09:29 PM
      0 responses
      8 views
      0 likes
      Last Post Belfortbucks  
      Working...
      X