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

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 bortz, 11-06-2023, 08:04 AM
        47 responses
        1,607 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        9 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        19 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        6 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        15 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X