Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculate on each Tick with Multi TimeFrame get odd behavior

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

    Calculate on each Tick with Multi TimeFrame get odd behavior

    Hi,

    I have an indicator which is set to Calculate on EachTick. Also in my indicator, I add a DataSeries set to 1 Tick.

    So, my PRIMARY is 1 min and my SECONDARY is 1 tick.
    My code inside my indicator produce a slope calculated on every tick on a period set to 5 (which represent 5 minutes)
    In the code, I go through every tick and when the BarInProgress == 0 (Primary) , I do a check to see if the tick is "IsFirstTickOfBar". If yes, I put the "TickIndex - 1" into a variable List which store the tickIndex of the Last Tick of the previous 1 minute Bar.

    I use the the PLackBack connection to do my test.

    1) First test with PlackBack Connection:
    - Everything run smoothly when I start the connection and then loaded my indicator. All data is good.

    2) Second test is that I loaded my indicator but with the PlayConnection NOT started.
    - The data when I do this is shifted from the test 1.

    3) Third Test. I try to load my indicator on NinjaTrader FXCM Demo Connection but have not yet activate the connection. Result are also shifted as per test 2. See graph below. The blue dot have the right value but are not on the right bar. The complete left blue dot should be on the bar to the right and so on. All will come back to normal after 5 bars goes by (My period of 5 for the PRIMARY 1 minute). If my period would be 10 or 25, it would take 10 or 25 bars to come back to normal.

    When running test 1: My first TickIndex which correspond to a IsFirstTIckOfBar comes at TickIndex =10.
    When running test 2: My first TickIndex which correspond to a IsFirstTIckOfBar comes at TickIndex =9

    Output from TEST 1: Output from TEST 2:
    PRIMARY
    Bar Tick: 8

    SECONDARY
    Bar Tick: 8

    PRIMARY
    Bar Tick: 9

    SECONDARY
    Bar Tick: 9

    PRIMARY
    Bar Tick: 10
    First TICK OF BAR
    Main Primary Count Bar Index Before Add: 0

    SECONDARY
    Bar Tick: 10

    PRIMARY
    Bar Tick: 11
    SECONDARY
    Bar Tick: 8

    SECONDARY
    Bar Tick: 9

    PRIMARY
    Bar Tick: 9
    First TICK OF BAR
    Main Primary Count Bar Index Before Add: 0

    SECONDARY
    Bar Tick: 10

    SECONDARY
    Bar Tick: 11
    Click image for larger version

Name:	CaptureChart.PNG
Views:	548
Size:	9.4 KB
ID:	1097322


    Why this behavior? Is this normal?

    #2
    Hi SlickRick, thanks for your post.

    If you have an indicator that uses tick data and runs OnEachTick you should turn on Tick Replay for the historical calculation, otherwise, the first tick of the first real-time bar will show up on the actual fist real-time tick. Try enabling Tick Replay on the data series and run the test again.



    Please let me know if this does not resolve your inquiry.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    666 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    376 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    110 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    575 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    580 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X