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

Calling secondary Timeframe with variable?

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

    Calling secondary Timeframe with variable?

    Hi.
    I know that Multi-Timeframe Indicators (in addition to adding
    Code:
    Add (  PeriodType.XYZ,    VALUE);
    ) should use the structure like this, in order to correctly syncronize with 2nd timeframe:


    Code:
    .....
    price_O	= new DataSeries( SMA(BarsArray[1], 1) );
    price_H	= new DataSeries( SMA(BarsArray[1], 1) );
    price_L	= new DataSeries( SMA(BarsArray[1], 1) );
    price_C	= new DataSeries( SMA(BarsArray[1], 1) );
    .... 
    if(BarsInProgress == 1) price_C = Close[0];
    ....
    abc = price_C[5];   //this is  in secondary timeframe's 5 bars ago
    However, I am interested, is the below method exactly same, as above (+ making more resource-efficient, without loosing any functionlity):


    Code:
    .....
    SMA xyz = SMA(BarsArray[1], 1);
    price_O	= new DataSeries( xyz  );
    price_H	= new DataSeries( xyz );
    price_L	= new DataSeries( xyz  );
    price_C	= new DataSeries( xyz  );
    .... 
    ....
    will it loose the syncroniztion as opposed to 1st example, or everything will happen same as 1st example?
    for exmple, `abc = price_C[5]; ` in the last example, will be the same as in 1st example?

    (i ask this because i remember that in another platform this mattered).
    Last edited by ttodua; 01-24-2018, 11:19 AM.

    #2
    Hello TazoTodua,

    Thank you for your note.

    price_o is synced to xyz, which is synced to BarsArray[1], you could use either or and get the same result.

    I would not expect a measurable effect on performance.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,611 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
    22 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X