Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time issue in the strategy

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

    Time issue in the strategy

    Hello,

    I use NT7 managed approach. I enabled a strategy on time based bars (1 hour). I use market reply to test it initially. However, within the strategy Time[0] always has the end time of the bar, and not the actual time while the bar is being built. So, even though the time is 1.05pm, Time[0] has 2pm on every tick.

    How can I retrieve the actual time?

    Thanks,
    redduke

    #2
    Hello RedDuke,

    You would need to add a 1 tick series to the script to have the times of each individual tick as the primary series will only have a bar closing each hour.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thanks for a reply. Do you mean adding something like this:

      Add(PeriodType.Tick, 1);

      If yes, this would degrade the performance of the strategy as it would need to processes additional data series. Is there any other way to get the current (correct) time stamp?

      Thanks

      Comment


        #4
        Hello RedDuke,

        Yes, this would add a 1 tick series.

        The logic in the code also needs to be altered so that the code is processed on a specific BarsInProgress.

        for example:
        if (BarsInProgress == 0)
        {
        // execute entry logic
        }

        if (BarsInProgress == 1)
        {
        // print time of tick
        }

        The example linked in the post demonstrates.
        You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        80 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X