Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Steps for Intrabar Functionality

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

    Steps for Intrabar Functionality

    Hello support staff and helpful readers,

    I am looking to find out specifically what steps I need to take in order to give my script the ability to execute trades in the middle of a 15-minute bar, triggered by conditions set on a tick series or range(1) series.

    I have added the data series I want to use like so..
    [CODE/]
    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Tick, 1);
    }
    [/CODE]

    I need to change the following code to accommodate a secondary series I think, but to what?
    [CODE/]
    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;
    [/CODE]

    And do I need to sync the secondary series in DataLoaded? I'm not even entirely sure what is meant by this, but it kept coming up.

    From the research I've done in other relevant posts, it seems like in order to call the secondary series for an indicator calculation, the BarsArray is used, but for my condition I need to call the Close of the secondary series. In the posts I found it stated that this can be done by something like this "Close[1][0]" which would call the close of the secondary series current/last bar. But all of this literature was from NT7, would the same syntax be used for NT8? How would I implement it so that it's functional?

    THE RELEVANT PART OF THE CONDITION WOULD JUST TRIGGER AN ACTION WHEN THE CLOSE OF THE TICK SERIES IS ABOVE THE CLOSE OF THE PRIOR 15 MINUTE BAR(primary series). Sorry for caps, but that is really, broad strokes, all I am trying to do, so if you can walk me through that without any additional information, then you can probably ignore the rest of my post.

    Any specified help you can offer would be greatly appreciated, as well as any reference to detailed literature regarding the implementation of intrabar functionality/granularity in NT8.

    Thank you!

    #2
    Hello lunardiplomacy,

    Thank you for your post.

    You're on the right general track, but here's a few resources that should help:

    This example from our help guide illustrates how to enter on one time frame and exit on another - this could easily be modified to do all your exits and entries on the secondary series.



    This help guide article goes into detail on making sure you have enough bars of both series to process correctly.



    Last, here's a link to our help guide on Multi-series scripts:



    The section on "Accessing the Price Data in a Multi-Bars NinjaScript" may be particularly helpful.

    To specifically answer your question as to how to trigger an action when the close of the tick series is above the close of the prior 15 minute bar, you could do something like below:


    Code:
    protected override voide OnBarUpdate()
    {
         // check to make sure we're processing the secondary tick series currently
         if (BarsInProgress == 1)
         {
             // if the close of the currently forming tick bar is greater than the close of the prior 15 minute bar, then do something
             if (Closes[1][0] > Closes[0][1])
             {
                  // do something here
             }
    
         }
    }
    Please let us know if we may be of further assistance to you.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    51 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    128 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X