Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 mattbsea, Today, 05:44 PM
    0 responses
    3 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    31 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    2 views
    0 likes
    Last Post tkaboris  
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,282 views
    0 likes
    Last Post Leafcutter  
    Started by WHICKED, Today, 12:45 PM
    2 responses
    20 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Working...
    X