Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to ensure a time-based operation is performed when OnBarUpdate is not called

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

    #16
    In fact in the strategy right now BIP = 0 (daily) is only there for chart display and ignored in the code. Trades are taken on the 7th series... (subject to change)

    The idea to use a liquid instrument as a substitute for timer actually crossed my mind briefly at the start of this thread when I realized NT architecture will only call my code when there is trading activity and I was somewhat reluctant to use a timer at first. I didn't put too much thought into it for a number of reasons, data and other, I waited to see if there was an easier solution in code. Apparently for backtest there isn't, not without some pain involved, so I think I will actually go the liquid instrument way, seeing that you bring it up, not only does it help clear some hesitations I had and gives me the push, I take it also as specific advice to drop the look-ahead solution, which gladly I will.

    Really and sincerely many thanks!

    I believe ES e-mini is the most liquid instrument and can be used as a substitute for timer with 1-second time frame. It is traded almost around the clock and even going back a couple of decades it was liquid enough. There is still no guarantee that OnBarUpdate will be called every second, but for the times of day of my scheduled tasks I think it should be fine.

    This not only will allow for an easier implementation in backtest but will also allow preliminary testing in real time using the same version as in backtest. Once I see that it works I will go ahead and implement a timer, and by then there will be reference to compare to, so I'd know if something doesn't work it's not the strategy, it's because I messed up the code...

    I have to say I truly appreciate your kind help, taking the time to write and give advice for no incentive other than simply to help someone else. It's inspiring and sets an example.

    May the force be with you!

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X