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

NT7 to NT8 ISeries<double> Problem

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

    NT7 to NT8 ISeries<double> Problem

    Hey guys,

    I was wondering if anyone could help me figure how to change this over...i've tried several different things but since i'm very new to programming it's been quiet frustrating so any help would be GREATLY appreciated. Here is the NT7 code:

    RSIDelta.Set(Momentum(RSI(Close,14,3),9)[0]);
    RSIsma.Set(SMA(RSI(Close,3,3),3)[0]);

    Values[0].Set(RSIDelta[0] + RSIsma[0]);
    Values[1].Set(SMA(Values[0],13)[0]);
    Values[2].Set(SMA(Values[0],33)[0]);

    and here is what i've gotten so far, i can get all the way through Value[0] with no problems but Value[1] on gives an error b/c "Value[0]" is a double, while the SMA specifically requires it to be a ISeries<double>, which i can not for the life of me figure out how to circumvent even though i'm pretty sure it's going to be something pretty simple.

    RSIDelta[0] = Momentum(RSI(Close,14,3),9)[0];
    RSIsma[0] = SMA(RSI(Close,3,3),3)[0];

    Value[0] = (RSIDelta[0] + RSIsma[0]);
    Value[1] = SMA(Value[0],13)[0];
    Value[2] = SMA(Value[0],33)[0];

    if there is anything else you need please let me know and i'll get back with you asap, thanks again for the help

    #2
    Hello tlittle187,

    Thanks for your post.

    In your NinjaTrader8 code Value[1] and Value[2] need to be Values[1] and Values[2]
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your response Paul, but i have tried that to no avail...the error i receive are:
      "The best overload match for is ... contains some invalid arguments" CS1502
      "Cannot convert from 'double' to '...ISeries<double>' CS1503

      The problem lies within the fact that "Value[0]" is a 'double' value and not an 'ISeries<double>'...b/c the format that SMA requires is in the form (ISeries<double>,int)
      Last edited by tlittle187; 10-04-2016, 08:25 AM. Reason: added clarification on what i perceive as the problem

      Comment


        #4
        Hello tlittle187,

        Thanks for your reply.

        To assist further I would need to see your entire code. Please post the source code file (perhaps both NT7 and NT8) or if you prefer please e-mail to PlatFormSupport[at]Ninjatrader[dot]Com marked as Atten:Paul and a link to this thread.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          I have run into a similar issue. What I noticed is that apparently, the SMA method does not like the indexing of the ISeries<double>.

          I am using the following code.....

          Code:
          private Series<double> hlr;
          double avgRng;
          
          if (State == State.Configure)
          {
          	AddDataSeries(BarsPeriodType.Minute, 10);
          	hlr  = new Series<double>(this);
          }
          		
          
          protected override void OnBarUpdate()
          {
          	if (BarsInProgress == 1)
          	{
          		hlr[0] 		= Highs[1][0] - Lows[1][0];	
          		avgRng	        = SMA(hlr,2)[0];	 //notice I did not use SMA(hlr[0],2)
          		
                          Print(avgRng);
          	}
          }
          Although, this code compiles it does not provide the correct values. So, I did a little more testing and noticed something strange.

          In NT8 RC1,

          Using a 5min chart, I added a custom indicator with the following code...

          Code:
          private Series<double> hlr;
          double tenMinRange;
          
          if (State == State.Configure)
          {
          	AddDataSeries(BarsPeriodType.Minute, 10);
          	hlr  = new Series<double>(this);
          }
          		
          
          protected override void OnBarUpdate()
          {
          	if (BarsInProgress == 1)
          	{
          		hlr[0] 		= Highs[1][0] - Lows[1][0];	
          		tenMinRange	= SUM(hlr,2)[0];	
          		
                          Print(tenMinRange);
          	}
          }

          For whatever reason, the SUM method is not calculating my custom dataseries hlr across multiple periods. Instead, it just prints out a single range for the prior ten-minute period. Is this a bug or am I missing something?

          Comment


            #6
            So, I think I figured out the issue.

            In the following code....

            Code:
            private Series<double> hlr;
            double tenMinRange;
            
            if (State == State.Configure)
            {
            	AddDataSeries(BarsPeriodType.Minute, 10);
            	hlr  = new Series<double>(this);
            }
            		
            
            protected override void OnBarUpdate()
            {
            	if (BarsInProgress == 1)
            	{
            		hlr[0] 		= Highs[1][0] - Lows[1][0];	
            		tenMinRange	= SUM(hlr,2)[0];	
            		
                            Print(tenMinRange);
            	}
            }
            tenMinRange = SUM(hlr,2)[0];

            Is updating according to the number of periods for the primary data series. So, I am getting the SUM of the hlr for every two 5min bars instead of for every two 10min bars. I tested this out by changing the number of periods in the SUM method and it holds true that if I want the SUM of the last x number of 10 mins bars I would have to input twice the value of x.

            I found this to be true with the SMA and ATR methods as well.

            What am I missing in my code that these methods are referencing the primary data series instead of the secondary data series?

            Comment


              #7
              Hello Assiduous,

              Thanks for your posts.

              In Ninjatrader 8 release RC1, we have identified an issue with OnBarUpdate inconsistencies with added data series. This bug is related to tracking ID of NT8-10446. The fix will be available in the next release of NinjaTrader8. I cannot advise when the next release will occur.
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Upon downloading NT8 RC2, the issue I described above does not seem to be resolved. Also, I tried NT7 and I get the same result.

                What am I missing??

                Comment


                  #9
                  Hello Assiduous,

                  Thanks for your reply.

                  Please write into PlatformSupport[at]NinjaTrader[dot]Com mark the subject: Atten: Paul and a link to this thread.

                  In the e-mail please attach your code and examples outputs of your observations so I can investigate further.

                  Thank-you.
                  Paul H.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by DanielTynera, Today, 01:14 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post DanielTynera  
                  Started by yertle, 04-18-2024, 08:38 AM
                  9 responses
                  40 views
                  0 likes
                  Last Post yertle
                  by yertle
                   
                  Started by techgetgame, Yesterday, 11:42 PM
                  0 responses
                  12 views
                  0 likes
                  Last Post techgetgame  
                  Started by sephichapdson, Yesterday, 11:36 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post sephichapdson  
                  Started by bortz, 11-06-2023, 08:04 AM
                  47 responses
                  1,615 views
                  0 likes
                  Last Post aligator  
                  Working...
                  X