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

Multiple Time Frame. Reference correspondent Close value through the loop

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

    Multiple Time Frame. Reference correspondent Close value through the loop

    Hi,
    Is it possible to access correspondent Close value of another time frame, going through the loop on the master time frame. Example:

    double closeArray0 = 0;
    double closeArray1 = 0;
    for (int i = 0; i < 100; i++)
    {
    if (Closes[0][i] < Closes[0][i + 1])
    {
    closeArray0 = Closes[0][i];
    closeArray1 = Closes[1][?];
    break;
    }
    }

    Thank you

    #2
    Hello Tatiana,

    Thank you for your post.

    Can you clarify what you mean by the corresponding close for the secondary series?
    Would this be the close at the same time or the same price?

    Comment


      #3
      Yes, I mean correspondent by the same time

      Comment


        #4
        Hello Tatiana,

        Thank you for your response.

        What are the two series in this case? Are they time based like Minute or Day? Or tick based like Tick, Range or Renko?

        The tick based bars have no set time to close so this calculation would be a bit more complicated. If it was a time based bar the calculation would be the following:
        Code:
        			if(CurrentBars[0] <= 100 || CurrentBars[1] <= 100)
        				return;
        			
        			double closeArray0 = 0;
        			double closeArray1 = 0;
        			for (int i = 0; i < 100; i++)
        			{
        				if (Closes[0][i] < Closes[0][i + 1])
        				{
        					closeArray0 = Closes[0][i];
        					for (int j = 0; j < CurrentBars[1]; j++)
        					{
        						if(Times[0][i] == Times[1][j])
        						{
        							closeArray1 = Closes[1][j];
        							break;
        						}
        					}
        					break;
        				}

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by f.saeidi, Today, 11:02 AM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by geotrades1, Today, 10:02 AM
        4 responses
        12 views
        0 likes
        Last Post geotrades1  
        Started by rajendrasubedi2023, Today, 09:50 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by lorem, Today, 09:18 AM
        2 responses
        11 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by geddyisodin, Today, 05:20 AM
        4 responses
        30 views
        0 likes
        Last Post geddyisodin  
        Working...
        X