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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    36 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    19 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X