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 sidlercom80, 10-28-2023, 08:49 AM
        166 responses
        2,233 views
        0 likes
        Last Post sidlercom80  
        Started by thread, Yesterday, 11:58 PM
        0 responses
        1 view
        0 likes
        Last Post thread
        by thread
         
        Started by jclose, Yesterday, 09:37 PM
        0 responses
        6 views
        0 likes
        Last Post jclose
        by jclose
         
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        10 responses
        1,414 views
        0 likes
        Last Post Traderontheroad  
        Started by firefoxforum12, Yesterday, 08:53 PM
        0 responses
        11 views
        0 likes
        Last Post firefoxforum12  
        Working...
        X