Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting Draw.ArrowUp() w/ Historical Data

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

    Plotting Draw.ArrowUp() w/ Historical Data

    I am trying to create an indicator that plots an up arrow below the bar if Low[0] < Low[1] && Close[0] > Low[1]. I have the indicator working, however it is only plotting the last instance where the above conditions are met. I would like it to plot all instances in the past where such conditions are met. Appreciate any help from those who know what I need to do to accomplish my goal. Thanks!!

    Below is what I have so far
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "MyCustomIndicator1";
    Calculate = Calculate.OnBarClose;
    IsOverlay = true;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    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;
    }
    else if (State == State.Configure)
    {
    }
    }

    protected override void OnBarUpdate()
    {
    //Add your custom indicator logic here.
    if (CurrentBar > 0)
    {
    if (Low[0] < Low[1] && Close[0] > Low[1])
    {
    Draw.ArrowUp(this,"", true, 0, Low[0] - TickSize,Brushes.Green);
    }
    }
    }

    #2
    I found the answer searching through other posts about plotting indicators. For those who find similar problems with custom script only plotting latest occurrence, you must add "+ CurrentBar" to the string tag argument.

    example : Draw.Dot(this, "dotTag" + CurrentBar, true, ...)

    hope somebody finds this helpful!

    Comment


      #3
      Thank you for the update, robertmaierle!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      155 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      307 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      346 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      176 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X