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 AaronKoRn, Today, 09:49 PM
    0 responses
    11 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Today, 08:42 PM
    0 responses
    10 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Today, 07:51 PM
    0 responses
    11 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,980 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    9 views
    0 likes
    Last Post rbeckmann05  
    Working...
    X