Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    630 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    566 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X