Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add a Draw Arrow object to an Indicator Panel

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

    Add a Draw Arrow object to an Indicator Panel

    Hello Support,

    I'm looking to add a Draw.ArrowDown / Draw.ArrowUp object to an indicator panel. Below is the code. I have debugged the key statements and the Draw.Arrow statements are being executed but the arrow doesn't show in the indicator panel.

    Is the code correct?

    What is the correct way to add this indicator to the Chart / indicator panel? What is odd is if I select Panel 1 in the Indicators window, the arrows show up on the price panel in the correct locations in relation to the indicator panel below. If I select Panel 3, a new panel (oddly?!) is added between the panel it should be on (Panel 2) and the bottom panel (another indicator). But, if I select Panel 2 (the desired panel/indicator), they do not show.

    When adding to the chart, for the Input Series, I have [IndicatorName](Instrument(15 Minute...

    Thank you!
    Matt

    =======

    Code:
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"My custom indicator";
    Name = "MyCustomIndicator23";
    Calculate = Calculate.OnBarClose;
    IsOverlay = false;
    DisplayInDataBox = false;
    DrawOnPricePanel = false;
    DrawHorizontalGridLines = false;
    DrawVerticalGridLines = false;
    PaintPriceMarkers = false;
    BarsRequiredToPlot = 10;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    // Setting defaults
    }
    else if (State == State.Configure) {}
    else if (State == State.DataLoaded) {
    // Set values
    }
    }
    
    protected override void OnBarUpdate() {
    
    if (CurrentBar < BarsRequiredToPlot) return;
    
    if (( -- Long conditions -- ) {
    Draw.ArrowUp(this, "RSIspkLong" + CurrentBar, IsAutoScale, 3, Low[3] - 2, Brushes.YellowGreen);
    }
    else if ( --  Short conditions -- ) {
    Draw.ArrowDown(this, "RSIspkShort" + CurrentBar, IsAutoScale, 3, High[3] + 2, Brushes.PaleVioletRed);
    }
    
    }

    #2
    Looks like you are drawing the arrows at a Price value instead of the indicator value. This is why you can see them when you put it in panel 1 (the price panel).

    You will need to add the RSI into your indicator in order to get the correct values (assuming you are using the RSI).

    Comment


      #3
      Hi Tasker-182

      Ah... Sure enough. My misunderstanding. I though the High/Low also applied to the "this" and the Input series. You're correct. The following update works, displaying the arrows correctly in the selected panel.

      if (( -- Long conditions -- ) {
      Draw.ArrowUp(this, "RSIspkLong" + CurrentBar, IsAutoScale, 3, Input[3] - 2, Brushes.YellowGreen);
      }
      else if ( -- Short conditions -- ) {
      Draw.ArrowDown(this, "RSIspkShort" + CurrentBar, IsAutoScale, 3, Input[3] + 2, Brushes.PaleVioletRed);
      }


      Thank you, Tasker-182, much appreciated!

      Kind regards,
      Matt

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X