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 fwendolynlpxz, Today, 05:19 AM
    0 responses
    3 views
    0 likes
    Last Post fwendolynlpxz  
    Started by traderqz, Yesterday, 12:06 AM
    11 responses
    28 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by PaulMohn, Today, 03:49 AM
    0 responses
    8 views
    0 likes
    Last Post PaulMohn  
    Started by inanazsocial, Today, 01:15 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by rocketman7, Today, 02:12 AM
    0 responses
    11 views
    0 likes
    Last Post rocketman7  
    Working...
    X