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

Creating Stochastics of CCI

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

    Creating Stochastics of CCI

    I am trying to create an indicator of an indicato and cant figure it out I followed the example of the SMA of Volume but would like help on the Wizzard.
    Thanks

    #2
    Hi designer,

    Thanks for the post. Please tell us at what step you run into trouble following the tutorial and we will gladly assist you. Here is the tutorial link - http://www.ninjatrader-support.com/H...verview22.html
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh,
      I am trying to create an indicator which is the Stochastics of the CCI. I was able to create all the parameters from the wizzard but when I get to the code portion i'm not sure where to insert the code from the CCI and the Stochastics. I guess I have to insert the CCI code...
      Thanks

      Comment


        #4
        Hi designer,
        First you will have to create a DataSeries object, because the Stochastics takes only a DataSeries input. In the Variables section add

        Code:
         private new DataSeries cciValue;
        Then in the Initialize add

        Code:
         cciValue = new DataSeries(this);
        Then you can use the Set() method to fill the DataSeries in the OnBarUpdate section

        Code:
         cciValue.Set(CCI(Close, MyPeriod)[0]);
        Finally you can create your Stochastic CCI calculation

        Code:
         double stochCCI = Stochastics(cciValue, MyPeriodD, MyPeriodK, MySmoothingPeriod)[0];
        Please also review this link -
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks,
          Do you suggest a similar indicator I can use as a template for the NT code?

          Comment


            #6
            Hi designer,

            Please check out the following thread, the indicator posted there should give a good starting point for what you want to do -




            Originally posted by designer View Post
            Thanks,
            Do you suggest a similar indicator I can use as a template for the NT code?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Would I be able to use the StochRSI code (attached)and just replace RSI with CCI in the code?
              Thanks
              Attached Files

              Comment


                #8
                I don't see why not. It should work fine. I have replaced RSI with CCI in indicators before and it was very simple and effective.

                Comment


                  #9
                  Hi,

                  Yes, this indicator can easily be modified to produce a Stochastic CCI.

                  Your minimum, maximum and rsi sets would then look like this -

                  Code:
                  [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]minimum.Set( MIN(CCI(PeriodRsi), LookBack)[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]]);[/SIZE][/FONT]
                  [SIZE=2][FONT=Courier New]maximum.Set( MAX(CCI(PeriodRsi), LookBack)[[/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]]);[/SIZE][/FONT]
                  [SIZE=2][FONT=Courier New]rsi.Set( CCI(PeriodRsi)[[/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]]);[/SIZE][/FONT]
                  [/SIZE][/FONT]
                  Of course for better style you would want to change the PeriodRSI variable name into PeriodCCI (in the Variables and Properties sections), same with the rsi.Set dataseries.


                  Originally posted by Elliott Wave View Post
                  I don't see why not. It should work fine. I have replaced RSI with CCI in indicators before and it was very simple and effective.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Thanks,
                    I was able to paste your CCI code as shown below (see attachment) then i saved it but when I try to import the saved file into the chart i do not see it in the Indicators list...please check if i placed in the right location.
                    Thanks
                    Attached Files

                    Comment


                      #11
                      Save this file in

                      My Documents\NinjaTrader 6.5\bin\Custom\Indicator

                      Then in NT select, Tools > Edit NinjaScript > Indicator and select this indicator.
                      Then compile it by pressing the F5 key in the Editor.
                      Now this indicator will be available in NT.
                      RayNinjaTrader Customer Service

                      Comment


                        #12
                        Ray thanks I did as sugested but get the following errors in lines 50-56
                        Error CS0103

                        Thanks

                        Comment


                          #13
                          You would then have to debug the error, I would not know what the problem is since its not my code.

                          Here is a help resource that may provide some guidance - http://www.ninjatrader-support2.com/...ead.php?t=3418
                          RayNinjaTrader Customer Service

                          Comment


                            #14
                            Hi designer,

                            Please check out this debugged and commented code of the StocCCI and let me know if you have questions.


                            Originally posted by designer View Post
                            Ray thanks I did as sugested but get the following errors in lines 50-56
                            Error CS0103

                            Thanks
                            Attached Files
                            BertrandNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by CortexZenUSA, Today, 12:53 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post CortexZenUSA  
                            Started by CortexZenUSA, Today, 12:46 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post CortexZenUSA  
                            Started by usazencortex, Today, 12:43 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post usazencortex  
                            Started by sidlercom80, 10-28-2023, 08:49 AM
                            168 responses
                            2,265 views
                            0 likes
                            Last Post sidlercom80  
                            Started by Barry Milan, Yesterday, 10:35 PM
                            3 responses
                            12 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Working...
                            X