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 nandhumca, Yesterday, 03:41 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by The_Sec, Yesterday, 03:37 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by vecnopus, Today, 06:15 AM
    0 responses
    1 view
    0 likes
    Last Post vecnopus  
    Started by Aviram Y, Today, 05:29 AM
    0 responses
    5 views
    0 likes
    Last Post Aviram Y  
    Started by quantismo, 04-17-2024, 05:13 PM
    3 responses
    27 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X