Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Second BarsArray not showing historic results

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

    Second BarsArray not showing historic results

    Hi,
    My chart is a 300 tick chart which is barsarray[0].

    I was reading the help file and attempted to replicate the AddLineBreak() function but only am seeing results for the most recent occurance, no history.

    When I refresh the chart, the script below only shows one green dot within the last few bars yet there are 20 days of charted tick bars.

    Any ideas what I did wrong that makes the script not show any historical results from the barsarray[1] over 20 days?

    protected override void Initialize()
    {

    // BarsInProgress index = 1
    AddLineBreak("TF 12-14", PeriodType.Volume, 500, 3, MarketDataType.Last);
    }


    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Checks to ensure all Bars objects contain enough bars before beginning
    if ( CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired )
    return;


    if (BarsInProgress == 0)
    {
    //Up bar after a down bar of LineBreak bars (BarsArray 1)
    if (
    Closes[1][0] > Opens[1][0]
    && Closes[1][1] < Opens[1][1]
    )
    {
    DrawDot("DotUp", true, 0, Low[0] - 5, Color.Green);
    }
    }


    Thanks for any help you can provide!

    #2
    Hello whiterhino,

    Thank you for your post.

    You can think of the tag of your drawing object as the instance. If the tag is always the same then only one object will be drawn. So you would add something that changes with the bars, for example:
    Code:
    if (BarsInProgress == 0)
    { 
    //Up bar after a down bar of LineBreak bars (BarsArray 1)
    if ( 
    Closes[1][0] > Opens[1][0]
    && Closes[1][1] < Opens[1][1]
    )
    {
    DrawDot("DotUp"+[B]CurrentBars[0][/B], true, 0, Low[0] - 5, Color.Green);
    }
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    133 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    75 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    117 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    113 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    90 views
    0 likes
    Last Post CarlTrading  
    Working...
    X