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 andrewtrades, Today, 04:57 PM
    0 responses
    1 view
    0 likes
    Last Post andrewtrades  
    Started by chbruno, Today, 04:10 PM
    0 responses
    3 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    6 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X