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

weird behavior of CurrentBar & or Count

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

    weird behavior of CurrentBar & or Count

    Hi,

    This is pretty weird. I'm trying to have that indicator consider only the last 120 bars to calculate and draw it's signals.
    This doesn't seem to work... It seems to start about 1000 bars from the last bar of the chart.
    Also check out the Count and CurrentBar print out...

    Thanks
    Thomas
    Click image for larger version

Name:	2024-02-12_14-53-14.png
Views:	29
Size:	372.0 KB
ID:	1290896

    #2
    Hello Thomas,

    If this is historical, you can use the following to start processing after the last 120 bars.

    Code:
    if (State == State.Historical && CurrentBar > Count - 121)
    With the output you want to clear the output window before reloading the script and ensure that there are no other instances of that indicator or other indicators that may be printing.
    (Try creating a test script that prints the time of the bar, CurrentBar, and Count without any other code)
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by geddyisodin, 04-25-2024, 05:20 AM
    8 responses
    60 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    4 responses
    3,287 views
    1 like
    Last Post jgualdronc  
    Started by Option Whisperer, Today, 09:55 AM
    0 responses
    5 views
    0 likes
    Last Post Option Whisperer  
    Started by halgo_boulder, 04-20-2024, 08:44 AM
    2 responses
    22 views
    0 likes
    Last Post halgo_boulder  
    Started by mishhh, 05-25-2010, 08:54 AM
    19 responses
    6,189 views
    0 likes
    Last Post rene69851  
    Working...
    X