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

BarrsInProgress == 1 not being activated

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

    #16
    Originally posted by sledge View Post
    How many days do you have to load for this? It looks like 24 days is necessary for a 60 minute chart and 1,440 days for a 1 minute chart.

    You'll see by changing your code to this, and why you aren't getting to here2 anytime soon.


    Code:
    			if (Bars.BarsPeriod.BarsPeriodType == BarsPeriodType.Minute)
    				{		
    					BarsRequired 		= 	(1440/Bars.BarsPeriod.Value);	//for 60 min chart = 24
    					barsinaperiod		=	(1440/Bars.BarsPeriod.Value)-1;	//for 60 min chart = 23
    					LineBegininBars		=	(1440/Bars.BarsPeriod.Value)-1;	//for 2 min chart = 23
    					barsPivotValidFor	=	((1440/Bars.BarsPeriod.Value)*(pivotValidFor-1));
    					
    					Print ( "CurrentBar=" + CurrentBar + " BarsRequired=" + BarsRequired );
    				}
    				else
    				{
    					Print ( "**** CurrentBar=" + CurrentBar + " BarsRequired=" + BarsRequired );//if (Bars.BarsPeriod.BarsPeriodType == BarsPeriodType.Day) return;
    				}
    							
    		if (CurrentBar <= BarsRequired) return;
    					 
    		if (BarsInProgress == 1)
    			{  Print("here2");
    Sledge,
    that is it! I was so focused on porting the code to NT8, i overlooked the simple settings. Thanks for your help!

    -Stearno

    Comment


      #17
      Originally posted by stearno View Post
      Sledge,
      that is it! I was so focused on porting the code to NT8, i overlooked the simple settings. Thanks for your help!

      -Stearno
      Okay, I found my next problem. It is drawing lines on teh chart, but they are not correct. So I think the problem is I used to use Values[0].Set(N,pivot); and Values[1].Set(N,pivot); to set the value N bars ago in plot 0 and plot 1.

      But I think I am doing that wrong in the NT8 code.

      Values[0][N] = pivot and Values[1][N] = pivot;.

      Is this correct? Or should it be:

      Values[N][0] = pivot and Values[N][1] = pivot;.

      ?

      Thanks.

      -Stearno

      Comment


        #18
        Values[0][N] = pivot and Values[1][N] = pivot;.
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment


          #19
          What's the difference?

          In NT8 RC1,

          On a 30 min chart, with days to load set to 10 and trading hours set to Nymex Energy RTH, the following code compiles and prints hourly highs to the output window.......

          Code:
           if (State == State.Configure)
          {
               AddDataSeries(BarsPeriodType.Minute,60);
          }
          
          protected override void OnBarUpdate()
          {
          			
          	if (BarsInProgress == 1)
          	{
          		if(CurrentBars[1] != 0)
          		{
          			Print(Highs[0][0]);	
          		}
          				
          	}
          }

          On the same 30 min chart, the following code compiles but does NOT print daily highs to the output window.......


          Code:
           if (State == State.Configure)
          {
               AddDataSeries(BarsPeriodType.Day,1);
          }
          
          protected override void OnBarUpdate()
          {
          			
          	if (BarsInProgress == 1)
          	{
          		if(CurrentBars[1] != 0)
          		{
          			Print(Highs[0][0]);	
          		}
          				
          	}
          }
          The only change was [AddDataSeries(BarsPeriodType.Minute,60);] changed to [AddDataSeries(BarsPeriodType.Day,1);]

          Either I am missing something incredibly simple or there is an issue with the virtual daily bars. Any input would be much appreciated.

          Comment


            #20
            OK Folks, I found my solution in the following thread......


            Seems that I was indeed missing something BUT in my opinion it wasn't so simple. Although the solution is simple (and even slightly intuitive), the help guide could use slightly better annotation.

            All I needed to do was go over to the historical data manager, go to the load tab, and under the Download section check the "Day" box for intervals. After downloading the historical data again, suddenly the output prints Daily Highs.

            To the NinjaTrader Support Team, I highly recommend adding a note within the "Multi-Time Frame & Instruments" section (image attached) referring to the Operations>Historical Data Manager>Importing section of the help guide.
            Attached Files

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cmtjoancolmenero, Yesterday, 03:58 PM
            10 responses
            36 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by DayTradingDEMON, Today, 09:28 AM
            4 responses
            24 views
            0 likes
            Last Post DayTradingDEMON  
            Started by geddyisodin, Yesterday, 05:20 AM
            9 responses
            50 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by George21, Today, 10:07 AM
            1 response
            15 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by Stanfillirenfro, Today, 07:23 AM
            9 responses
            24 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X