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 cmtjoancolmenero, Yesterday, 03:58 PM
    3 responses
    23 views
    0 likes
    Last Post cmtjoancolmenero  
    Started by Brevo, Today, 01:45 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by rjbtrade1, 11-30-2023, 04:38 PM
    2 responses
    72 views
    0 likes
    Last Post DavidHP
    by DavidHP
     
    Started by suroot, 04-10-2017, 02:18 AM
    5 responses
    3,021 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Stanfillirenfro, Today, 07:23 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X