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

Stochastic indicator, Need some help!

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

    Stochastic indicator, Need some help!

    I simple want to use a stochastic indicator that gives a arrow signal when the two lines cross
    Struggled yesterday by making it my self with the wizard option, but it does not seem to work for me.
    If someone could show me the details, i can spot were i'm making the mistake

    Using the
    PeriodD 3
    PeriodK 14
    Smooth 3

    Regards,

    Bas

    #2
    Hello,

    Thanks for your post and welcome to the NinjaTrader forums.

    I'd be happy to give you a few pointers.

    May I have an export of your script as it is now?

    To export your script do the following:
    1. Click File -> Utilities -> Export NinjaScript
    2. Enter a unique name for the file in the value for 'File name:'
    3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
    4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


    Below is a link to the help guide on Exporting NinjaScripts.
    http://www.ninjatrader.com/support/h...nt7/export.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      Im getting an error when i want to export the ninjascript archive file.
      maby it helps if i send some screenshots with this message.

      If that does not work I would like to ask if you have a simmilar indicator which shows arrows on buy/sell signals that i could look into and learn from that.

      Regards,

      Bas
      Attached Files

      Comment


        #4
        Hello Inter20,

        Thanks for your note.

        The SampleMACrossOver is a strategy that uses the SMA similar to how you are trying to use the Stochastics indicator.

        This sample script does not open in the Strategy Wizard however.

        I think you are on the right track. I think it would be helpful to show these indicators on the chart when you have added the strategy.

        To do this, click the ellipses button "..." to modify the crossover condition you have. In the condition builder, on both sides scroll to the bottom of the parameters for the chosen Stochastics indicator and find the Plot on chart option and set this to true. This will allow you to visually see when the crossover has taken place.
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Dear Chelsea,

          Thanks for the information
          Unfortunately I already had the Plot on chart options set to true.
          Is there a stochastic indicator that you currently use which do contain the arrow signals?

          Regards,

          Bas

          Comment


            #6
            Hi Inter20,

            May I have a screenshot of the compile errors you are receiving?

            If we can resolve these, you can export your script so that I may test it.

            To view compile errors:
            • Click Tools -> Edit NinjaScript -> select Indicator... -> select ADL -> click OK
            • Right-click the code in the NinjaScript Code Editor -> select Compile
            • Take a screenshot of the errors below with the error column fully expanded


            To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CRTL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

            We have also collected more comprehensive steps for resolving NinjaScript programming errors in this tip on our forums - http://www.ninjatrader.com/support/f...ead.php?t=4678
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Dear Chelsea,

              Its not the indicator which is giving problems, but its the inability of getting an buy/sell signal with my strategy were i use the indicator with.
              The compiling error, is from exporting the strategy.
              The strategy code is also posted to this message.

              Trying to figure out how to use the stochastic indicator and when the two lines cross (cross above, or cross below), a signal needs to be given. I tried this by creating a strategy

              Regards and thanks for all the assistance!

              Bas
              Attached Files

              Comment


                #8
                Originally posted by Inter20 View Post
                Dear Chelsea,

                Its not the indicator which is giving problems, but its the inability of getting an buy/sell signal with my strategy were i use the indicator with.
                The compiling error, is from exporting the strategy.
                The strategy code is also posted to this message.

                Trying to figure out how to use the stochastic indicator and when the two lines cross (cross above, or cross below), a signal needs to be given. I tried this by creating a strategy

                Regards and thanks for all the assistance!

                Bas
                Looking at your Stochastic statements, you are comparing the D plot to itself, so it can never be true, as no line can cross above or below itself. You need to make your code reflect your intent. Examine Plot K crossing Plot D, not Plot D crossing Plot D.
                Attached Files
                Last edited by koganam; 01-09-2014, 11:05 AM. Reason: Corrected spelling.

                Comment


                  #9
                  Osikani,

                  Thanks for the heads up, i changed one Plot to K, so it sais K and D now.
                  Still, its not giving the right result.
                  I posted some screenshots in this message, so the error i made might be seen

                  Also for the Log file when i want to export the stratergy (ill translate it in english) is reads. Error CS0118: NinjaTrader.Indicator.Stochastic is a type but is used as a variable. Maybe the answer of the problem lies in the logfile?

                  Also i get 2 stochastic indicators underneath each other, this might be because i used 2 sets, for conditions and actions. (cross above Set 1. And Cross Below Set 2)

                  Regards,

                  Bas
                  Attached Files
                  Last edited by Inter20; 01-09-2014, 10:10 AM.

                  Comment


                    #10
                    Hello Inter20,

                    Thanks for your post.

                    First, I want to ask what you are intending to do here. The Stochastics when applied to a chart has two plots, a D plot and a K plot.

                    Are you want to see when these plots cross using the same period?

                    Are you wanting to see when Stochastics with different periods have each of their D lines cross?

                    Regarding the error message, you may need to add the @Stochastics indicator to your export package.

                    To do this in the 'Export NinjaScript Archive File (.zip)' window:
                    • Select your strategy that you would like to export and click the right facing arrow
                    • Next from the Export objects drop-down select System indicators
                    • From the list select @Stochastics -> click the right facing arrow to add this
                    • Click the Export button
                    Last edited by NinjaTrader_ChelseaB; 01-09-2014, 10:37 AM.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hi Chelsea,

                      I want the standard stochastic indicator to give me a signal when the two lines cross.
                      Only 1 stochastic indicator were the D line crosses the K line and viseversa.

                      Exporting the indicator keeps giving trouble, going to try out some other stratergies to export

                      Regards,

                      Bas

                      Comment


                        #12
                        Hello Inter20,

                        Thanks for that information.

                        I have noticed that you are using a different Period d value for your comparisons.
                        The Period k does not change. 3, 14, 3 for the left side of the comparison and 7, 14, 3 for the right side of the comparison.

                        This should still work as the d line will have 3 and the k line 14, however, I just wanted to make you aware of this.


                        Regarding the export, did you attempt to add the @Stochastics indicator to your export package from my previous instructions? Did you receive an error message when trying to do this?
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Hi Chelsea,

                          I followed your instructions regarding the export, it worked for an other strategy so i am trying to compare those to see the issue.

                          I might know were the problem lies. But that means i need to understand one thing first. If possible, please explain the following:
                          When making a strategy and using the wizard, I come across the User Defined Inputs section. Is it correct that you define specific parameters in here that you can (later on) select if needed? I did not used this section because i chose already existing Stochastic parameters in the Conditions and Actions section.

                          The next section shows the conditions and actions, were i just picked existing indicators and no USER DEFINED inputs.

                          The strategy that exported correctly, was using the user defined inputs ( i downloaded it)
                          The strategy that could not be exported was NOT using the User defined inputs.

                          What does the user defined input panel actually means and do? in my opinion, i do not need it but I guess i'm wrong

                          Comment


                            #14
                            Hello Inter20,

                            The User Defined Inputs are parameters that can be changed by the user when adding the strategy to a chart or to the Strategies tab. Commonly, this is used to change the period used for indicators.

                            User Defined Inputs will not affect the ability to export the script.

                            The issue that is appearing in the screenshot you have provided is saying that the @Stochastics indicator is not added to the export package.

                            Where you able to add this @Stochastics indicator manually to the package (by selecting it and clicking the right facing arrow)? (There should be two files in the package, the strategy and this indicator)

                            If so, let me know and I will have you write in to our support so that I may assist you with this via remote support.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Hi, Chelsea

                              Thanks for the explanation about the user defined input section

                              For the issue with exporting the script, i followed your guidelines and the two present filed (@stochastic indicator and strategy) are still giving an error when trying to export

                              Remote assistance could help allot i think.


                              Regards,

                              Bas

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by burtoninlondon, Today, 12:38 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post burtoninlondon  
                              Started by AaronKoRn, Yesterday, 09:49 PM
                              0 responses
                              12 views
                              0 likes
                              Last Post AaronKoRn  
                              Started by carnitron, Yesterday, 08:42 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post carnitron  
                              Started by strategist007, Yesterday, 07:51 PM
                              0 responses
                              13 views
                              0 likes
                              Last Post strategist007  
                              Started by StockTrader88, 03-06-2021, 08:58 AM
                              44 responses
                              3,982 views
                              3 likes
                              Last Post jhudas88  
                              Working...
                              X