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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    52 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    71 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    38 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    99 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    60 views
    0 likes
    Last Post PaulMohn  
    Working...
    X