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 RookieTrader, Today, 09:37 AM
    4 responses
    17 views
    0 likes
    Last Post RookieTrader  
    Started by PaulMohn, Today, 12:36 PM
    0 responses
    2 views
    0 likes
    Last Post PaulMohn  
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    38 views
    0 likes
    Last Post love2code2trade  
    Started by alifarahani, Today, 09:40 AM
    3 responses
    15 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by junkone, Today, 11:37 AM
    3 responses
    22 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X