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 helpwanted, Today, 03:06 AM
    1 response
    5 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    7 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    5 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    384 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X