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

Simulating against 5 minute bars

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

    Simulating against 5 minute bars

    Hi there, I'm having trouble understanding why I'm getting multiple entries upon a simulation. I'm running a tick-by-tick simulation, on a five-minute chart. My code running on this chart is:

    if (FirstTickOfBar && (Position.MarketPosition == MarketPosition.Flat)) {
    Print("At " + ToTime(Time[0]) + " of close last bar " + Close[1]);
    ...
    }

    Going through one bar, for example, I'd expect to get:

    At 101500 of close last bar 2054.25

    Instead, going through one bar, I get:

    At 101500 of close last bar 2054.25
    At 101500 of close last bar 2054.25
    At 101100 of close last bar 2054.25
    At 101200 of close last bar 2054
    At 101300 of close last bar 2054.5
    At 101400 of close last bar 2055.25
    At 101500 of close last bar 2055.5

    Somehow, I'm entering my clause seven times, upon one close of the bar. Of course, I want to enter my clause only once, when the 5 minute bar closes on my 5 minute chart. How to do?

    Thanks,

    #2
    Hello,

    Thank you for the post.

    Could you provide an example that shows the series you are adding along with where this syntax is in your logic?

    I wouldn't be certain without seeing the whole script as to why this would execute multiple times. With further details, I will be happy to look further into this.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by quantismo, 04-17-2024, 05:13 PM
    3 responses
    25 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by ScottWalsh, 04-16-2024, 04:29 PM
    7 responses
    34 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by cls71, Today, 04:45 AM
    0 responses
    5 views
    0 likes
    Last Post cls71
    by cls71
     
    Started by mjairg, 07-20-2023, 11:57 PM
    3 responses
    215 views
    1 like
    Last Post PaulMohn  
    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
    4 responses
    549 views
    0 likes
    Last Post PaulMohn  
    Working...
    X