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

Two Variable Crossovers: Unique

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

    Two Variable Crossovers: Unique

    Haven't figured out why no one has implemented a two variable time check. Set the timer to seconds or minutes, and check the two variables in relation to each other. Like a 5 second time check.

    Variable A = Fixed/static Variable
    Variable B = last bar close

    If B is above A after 5 seconds, do this.....C

    If B is below A after 5 seconds, do this.... D


    If C is already done than don't do C again, If D is already done don't do D again..keep checking every 5 seconds if the states are true or false.

    #2
    Hello Kubera2024,

    Thank you for your post.

    Are you trying to figure how to develop such a condition in a strategy?

    I look forward to your response.

    Comment


      #3
      yes, ...

      basically:

      Variable A: 2360 (support/resistance)
      Variable B: Last Bar Close
      Timercheck: 5 seconds
      TimecheckPosition: 1 minute
      Initial Position Size: 1
      Increment Position Size:1
      Max Position Size: 5
      Trend: True/False

      Every 5 seconds the Strategy checks to see if current price is greater or less than the Variable A. Then if Trend is set to true, it enters a long or short if price is below Variable A. If trend is set to false it does the opposite.. Or sell above Variable A or buys below Variable A. At one minute mark the position is added to by Increment Position Size.

      Comment


        #4
        Also you can have the Strat set the Trend filter, based on defined indicator. Instead of manually setting it.

        Comment


          #5
          Hello Kubera2024,

          Thanks for providing us that information.

          This strategy can be created using the Strategy Builder.I have created a brief video that demonstrates how you can do this.

          Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


          I would suggest to also check out the Strategy Builder 301 webinar for further understanding how to create strategies using the Strategy Builder. You may register for a live webinar as well where you may ask questions to a live presenter regarding the Strategy Builder.

          Strategy Builder 301 webinar - http://ninjatrader.com/Webinar/Strategy-Builder-301
          Strategy Builder 301 recording - https://www.youtube.com/watch?v=HCyt90GAs9k

          Please let us know if we may be of further assistance.
          JimNinjaTrader Customer Service

          Comment


            #6
            How is the time check done.. the position rules need redundancy. That's why a traditional crossover study is not enough. Lets say you implemented moving average study, and power goes out, and system comes back online.. while power was out, a long was triggered but was never triggered in brokerage account. When system is turned back on, it immediately checks itself to buy a long.
            Last edited by Kubera2024; 03-14-2017, 05:52 PM.

            Comment


              #7
              Hello Kubera2024,

              Thanks for replying.

              In order to have your strategy's logic process every 5 seconds, you want to have the primary data series set to 5 seconds. You can create a condition that checks if 12 bars have been iterated to create a condition that occurs every 60 seconds.

              Currently, there is no feature to set a variable to its current value with a mathematical offset within the Strategy Builder. If you would like, I may submit a feature request on your behalf to add this ability to the Strategy Builder.

              I will provide some sample code that describes how this can be done in NinjaScript, but I will not be able to provide assistance in developing your strategy or debugging your code. If you are looking for those services, you can write in to platformsupport[at]ninjatrader[dot]com with the ticket number "1676289" and the text "Attention Jim." I will be able to get you connected with a member of our Business Development team who can provide a list of NinjaScript Consultants who would be happy to develop and debug your code.

              Sample code for checking if 12 bars have passed (60 seconds on a 5 second primary data series) is as follows:

              Code:
              if (BarsIterated >= BarsToWait)
              {
              	// your logic here
              	BarsIterated = 0;
              }
              BarsIterated++;
              You will need to create 2 integer variables for BarsToWait and BarsIterated.

              Please let me know if you would like me to submit a feature request for adding this functionality to the Strategy Builder.
              JimNinjaTrader Customer Service

              Comment


                #8
                Feature Request:

                1) Strategy check of last signal to see if current position matches last signal.
                2) Ninjatrader Servers to transfer Strats to run on their own.
                3) Prototype Hedge Fund Group - Pooling knowledge and resources where people come together to design strategies, where Ninjatrader itself would be considered 'one person'. Coders and alpha generators come together to succeed. The group splits the profits when they vote to 'distribute' or not.
                4) Groups can compete, and a rankings list is maintained.

                Comment


                  #9
                  Hello Kubera2024,

                  Thanks for providing that feedback.

                  For your first feature request, this sort of thing is left to the design of your NinjaScript Strategy and falls outside the design of the Strategy Builder or the NinjaTrader Platform. The strategy you described can be programmed by you, but it cannot be made in the Strategy Builder unless a feature to "set a variable to its current value with a mathematical offset" is implemented first. I could submit a feature request for this and you will be able to create this functionality using the Strategy Builder.

                  For your second feature request, this isn't an issue we are currently tracking, but this would be possible by setting up your own private server to host your NinjaTrader platform along with your strategies.

                  As for your 3rd and 4th suggestions, these sorts of suggestions fall outside of the scope of the NinjaTrader platform, so there is not a space where I may suggest this "feature." However, there is nothing stopping you or another user to create these spaces on the internet.

                  Please let me know if you would like me to submit a feature request for the Strategy Builder to "set a variable to its current value with a mathematical offset" if you would like to have this ability to build your strategy in the Strategy Builder.
                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    notice how it fails to respect the the direction, that's why a error checking mechanism is needed for crossover generated orders.
                    Attached Files

                    Comment


                      #11
                      Hello Kubera2024,

                      Thanks for the reply.

                      The CrossAbove and CrossBelow functions are meant to be basic and simple. Error checking will always be subjective to each user's implementation in their strategy or indicator. As such, this is a matter that is best handled by each individual programmer to use the tools available to create the functionality they desire. Error checking is a regular task programmers have to look into when developing code.

                      The Strategy Builder is designed to create basic NinjaScript code within the confines of its interface. I believe the feature I mentioned will assist you and others to create robust strategies and the necessary error checking to make these strategies more powerful without having to unlock and program manually. I will go ahead and submit the feature request.

                      The feature request is being tracked with ticket ID SFT-2059 and can be seen in the Release Notes of the version of NinjaTrader 8 that contains the feature request's implementation. You can use the link below to view the Release Notes page of the help guide.

                      Release Notes: http://ninjatrader.com/support/helpG...ease_notes.htm

                      You may also writing in to platformsupport[at]ninjatrader[dot]com to ask a technician on the status of the ticket ID.

                      As far as the error checking you are describing, what is the expected behavior that you would like to see? We may be able to provide a solution for you using the Strategy Builder.

                      Could you also elaborate on "how it fails to respect the the direction?" The strategy's chart is appearing to enter Long and enter Short when after a cross over occurs.

                      Please provide the associated logic with the behavior that you are describing. You can send me screenshots of the Strategy Builder or copy the unlocked code and place it in [CODE] blocks in your reply.

                      To send a screenshot with Windows 7 or newer, we recommend using Window's Snipping Tool.

                      Click here for instructions

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

                      Click here for detailed instruction


                      Please provide me answers to the above questions so I may assist you further.
                      Last edited by NinjaTrader_Jim; 03-22-2017, 11:36 AM.
                      JimNinjaTrader Customer Service

                      Comment


                        #12
                        The green line is the static variable, either from indicator or preset manually by user. Notice the last 3 bars are below the variable but the system still stayed long. And if price escapes the zone, the system will have huge drawdown.
                        Attached Files

                        Comment


                          #13
                          Here is how it looks on another platform. This one doesn't have error checking either. So some crosses are missed and manual injection/fix is needed.
                          Attached Files

                          Comment


                            #14
                            Here is another variation.
                            Attached Files

                            Comment


                              #15
                              Post PT hit.
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by RubenCazorla, Today, 09:07 AM
                              1 response
                              5 views
                              0 likes
                              Last Post RubenCazorla  
                              Started by Irukandji, Today, 09:34 AM
                              1 response
                              3 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by TraderBCL, Today, 04:38 AM
                              3 responses
                              25 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by WeyldFalcon, 08-07-2020, 06:13 AM
                              11 responses
                              1,423 views
                              0 likes
                              Last Post jculp
                              by jculp
                               
                              Started by BarzTrading, Today, 07:25 AM
                              2 responses
                              29 views
                              1 like
                              Last Post BarzTrading  
                              Working...
                              X