Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Histogram Bar not Plotting

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

    Histogram Bar not Plotting

    Hi. After all this time I've never plotted a simple vertical bar histogram. The below is not working; something obvious here?



    protected override void OnBarUpdate()
    {
    // Assuming tape data is available through NinjaTrader's market data or an external source
    // For this example, we'll simulate tape data with volume for simplicity
    double tapeData = Volume[0];

    // Calculate average over the lookback period
    if (CurrentBar < LookBack)
    {
    // If we don't have enough bars yet, set to zero or initial value
    averageTapeValue[0] = 0;
    }
    else
    {

    double Sum = 0;
    for (int i = 0; i < LookBack && i < CurrentBar; i++)
    { Sum += i; }

    averageTapeValue[0] = Sum / LookBack; // Sum of tape data over lookback period

    }

    // Plot the average tape value
    TapeHistogram[0] = averageTapeValue[0];


    }

    region Properties
    [NinjaScriptProperty]
    [Range(1, int.MaxValue)]
    [Display(Name="LookBack", Order=1, GroupName="Parameters")]
    public int LookBack
    { get; set; }

    [Browsable(false)]
    [XmlIgnore]
    public Series<double> TapeHistogram
    {
    get { return Values[0]; }
    }​​

    #2
    Hello johnMoss,

    When you say its not working, in what way is it not working? Are you seeing errors in the log or output window?

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    601 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    347 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    559 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    558 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X