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

Multi timeframe strategy - IsFirstTickOfBar of non-processing BarsArray

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

    Multi timeframe strategy - IsFirstTickOfBar of non-processing BarsArray

    Within a multi timeframe Strategy, is it possible to access IsFirstTickOfBar for a BarsArray that is not currently processing?

    For example, where a Strategy has two BarsArrays, while the Primary BarsArray is processing (BarsInProgress == 0) accessing IsFirstTickOfBar of the Secondary BarsArray? Illustrated by the below (non-functioning) snippet.
    Code:
    protected override void OnBarUpdate()
    {
      if (BarsInProgress != 0) return;
      var secondaryBarsArrayFirstTickOfBar = [B]BarsArray[1].IsFirstTickOfBar[/B];
    }
    While the above example is simple, I require IsFirstTickOfBar from multiple BarArrays accessible from BarsArray[0].

    #2
    Hello Shansen,

    The IsFirstTickOfBar is a bool that is only true when the first tick of a bar (for the processing series) triggers OnBarUpdate.

    This would not allow for checking to see if a specific historical bar was the first tick of the bar (for any series).

    I will submit a feature request on your behalf for the NinjaTrader Development to consider creating the IsFirstTickOfBar as a method that accepts a barsAgo value.

    Once I have a tracking ID for this request I will forward this to you for future reference.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      For clarity, I am chasing IsFirstTickOfBar for the CurrentBar of a BarsArray at a point where the BarsArray is not processing (i.e. BarsInProgress).

      In pseudo-code I am chasing "BarsArray[1].IsFirstTickOfBar" which is accessible at a point where BarsArray 1 is not processing (where BarsArray[1] could be BarArray[x]).
      I am not chasing IsFirstTickOfBar for a historical bar, in pseudo-code "IsFirstTickOfBar[1]" (with a barsAgo parameter of 1).

      Comment


        #4
        Hi Shansen,

        Thanks for clarifying.

        I've submitted a request for a IsFirstTickOfBarByIndex method that would allow other bars in progress to check if the most recently processed tick was the first tick of the bar for that series.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello Shansen,

          Your request for IsFirstTickOfBarByIndex method to allow bars in progress to check recent processed first ticks for a bar for that series is being tracked with ID #SFT-3085.

          Please note it is up to the NinjaTrader Development to decide if and when a request will be implemented.

          Thank you for your suggestion.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Nice notice. However, the solution seems to use something like this;

            Code:
            OnBarUpdate()
            {
               if(BarsInProgress==0)   isFirstTk = IsFirstTickOfBar;
            
               if (BarsInProgress != 0) return;    ...
               ...
            
               if (BIP==1 && isFirstTk ) ....
            
            }
            Last edited by ttodua; 02-05-2019, 07:57 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by pechtri, 06-22-2023, 02:31 AM
            9 responses
            122 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by frankthearm, 04-18-2024, 09:08 AM
            16 responses
            66 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by habeebft, Today, 01:18 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by benmarkal, Today, 12:52 PM
            2 responses
            14 views
            0 likes
            Last Post benmarkal  
            Started by f.saeidi, Today, 01:38 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X