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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X