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 Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        30 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        943 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        9 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by rocketman7, Today, 01:00 AM
        0 responses
        7 views
        0 likes
        Last Post rocketman7  
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        28 views
        0 likes
        Last Post wzgy0920  
        Working...
        X