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

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 junkone, 04-21-2024, 07:17 AM
    9 responses
    67 views
    0 likes
    Last Post jeronymite  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    4 responses
    18 views
    0 likes
    Last Post trilliantrader  
    Started by mgco4you, Today, 09:46 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by wzgy0920, Today, 09:53 PM
    0 responses
    10 views
    0 likes
    Last Post wzgy0920  
    Started by Rapine Heihei, Today, 08:19 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X