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

Slope CCI Max error

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

    Slope CCI Max error

    Hi

    Can you please tell me why I have an error Type:The best overloaded method match for 'NinjaTrader.Indicator.Indicator.MAX(NinjaTrader.D ata.IDataSeries, int)' has some invalid arguments on this code?


    // Max Slope CCI
    slopeMax = MAX(Slope(CCI(period),barsAgoSwingH,0),barsAgo_ext remesXup)[Math.Min(CurrentBar, 1)];


    I have this code similar that is ok, why? The only thing different is CCI(period) was changed by Slope(CCI(period),barsAgoSwingH,0) on the code before.

    // Max CCI
    swingHigh = MAX(CCI(period),barsAgo_extremesXup)[Math.Min(CurrentBar, 1)];

    Thanks

    #2
    Rita, Slope would just return a single double value and not a dataseries value as your CCI, however MAX expects a series input and hence the compiler throws an error. You would need to create a custom series containing the slope for each bar and then feeding this into the MAX() method -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks again Bertrand

      Now I only have 2 errors: ";" expected on 3th DataSeries and invalid ")" , on same line, I can not understand this in my opinion all ";" and ")" are correct. Can you please tell me what is incorrect? Only has errors on the 3th line of DataSeries - 1st and 2nd seems ok probably 4th line will be error as well

      Thanks

      Code

      // Calculate the DataSeries of the current bar and set the value
      slopeMaxCCIDataSeries.Set(Slope(CCI(period),barsAg oSwingH,0));
      slopeMinCCIDataSeries.Set(Slope(CCI(period),barsAg oSwingL,0));
      slopeMaxTurboDataSeries.Set((CCI(turbo)[0] - CCI(period)[barsAgoSwingH]) / barsAgoSwingH);
      slopeMinTurboDataSeries.Set((CCI(turbo)[0] - CCI(period)[barsAgoSwingL]) / barsAgoSwingL);

      Comment


        #4
        Rita, are turbo, period and barsAgoSwingHL all defined as Int's?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks Bertrand

          The errors disaoeared after compile without change anything!

          Thanks

          Comment


            #6
            Can you please tell me why next code give me always 2 bars with No.1 first bar and bar before first bar? (I see this if I print it to output window)

            I tried use a Swing CCI High data series insted CCI(period) [0] but densn't work ( on Print if I do Print(cciSwingHighDataSeries [0] == swingHigh); give me "true" if I change CCI(period) [0] by cciSwingHighDataSeries [0] on the next code the indicator desapear , show me nothing )


            int barsAgoSwingH = MRO(delegate{return CCI(period) [0] == swingHigh;},1,CurrentBar);


            Thanks

            Comment


              #7
              Rita, how are you defining the swingHigh - would that update to include the most recent completed bar in your calculations?
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Thanks Bertrand

                swingHigh is like this:


                swingHigh = MAX(CCI(period),barsAgo_extremesXup)[Math.Min(CurrentBar, 0)];




                barsAgo_extremesXup = MRO(delegate{return (CCI(period)[0] > extremes
                && (CCI(period)[Math.Min(CurrentBar, 1)]==0 ?
                CCI(period)[Math.Min(CurrentBar, 2)]<extremes
                : CCI(period)[Math.Min(CurrentBar, 1)]<extremes));},1,CurrentBar) +1;


                Thanks

                Comment


                  #9
                  Rita, ok thanks - please print the associated values in your calculations and also those you feed into other methods so you compare them for accuracy and returning expected results. Your MAX call likely includes the most recent high created as you move forward, as your lookback includes the CurrentBar.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Bertrand

                    I already print all values that I working on. My problem is I don't know how I find Min ValueSlope >0 and Max ValueSlope <0.

                    I'm using (slopeMax = MAX(slopeMaxCCIDataSeries,barsAgoSwingH)[Math.Min(CurrentBar, 0)]; ____ And____slopeMin = MIN(slopeMinCCIDataSeries,(barsAgoSwingL))[Math.Min(CurrentBar, 0)]; )

                    When I use a dataserie to find the slope than I find Min/Max of dataserie, but on Swings usually there are 2 bars No.1 because if we have 2 consecutive match point of dataserie with Min ValueSlope but next on is my point. This happen because I didn't separete MinValueSlope>0 from MaxValueSlope<0

                    It could be samething like: (slopeMax =slopeMaxCCIDataSeries[0]<0? MAX(slopeMaxCCIDataSeries,(barsAgoSwingH))[Math.Min(CurrentBar, 0)]:-9999; ) but NT show me nothing of nothing.

                    Can you tell me please how I fix this?

                    Thanks

                    Comment


                      #11
                      Rita, I believe the easiest would be if you record the min / max slope yourself in 2 variables activated by the slope being positive or negative. Just initialize your min holding variable for example with a very high value like 9999 and then record the current slope if it's smaller than previous min value, if's not then just keep the prior saved value - your min. Same would apply to finding the max.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        Thanks Bertrand it worked fine.

                        Can you please tell me what I have to do for a DrawArrowUp stay on the indicator panel?

                        My indicator is on panel 2 but Arrow goes to panel 1.

                        Thanks

                        Comment


                          #13
                          Great Rita - you could set DrawOnPricePanel to false in your indicator's Initialize().
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            Thanks Bertrand

                            After to do a compline ok I opaned the add indicators to do ok. NT had a crach in this point. than I restarted the pc and NT opened but no grafics have show. I did a NT repair on control panel add and remove programs.

                            Now I open NT and it donsn't show the grafics is open but in crach no reacting. What do I do now?


                            Thanks

                            Comment


                              #15
                              Ria, can you please direct the trace / logs from the crash via Help > Mail to Support to me for review?

                              It sounds like the crash unfortunately corrupted your workspace, have you tried using a brand new one already?

                              Thanks
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Aviram Y, Today, 05:29 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post Aviram Y  
                              Started by quantismo, 04-17-2024, 05:13 PM
                              3 responses
                              25 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by ScottWalsh, 04-16-2024, 04:29 PM
                              7 responses
                              34 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by cls71, Today, 04:45 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post cls71
                              by cls71
                               
                              Started by mjairg, 07-20-2023, 11:57 PM
                              3 responses
                              216 views
                              1 like
                              Last Post PaulMohn  
                              Working...
                              X