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

Cancel EnterLongStopMarket order if it is not triggered after 5 bars

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

    #16
    I watched the screencast video and will try to make something with Visual studio tomorrow. But I still don't understand. If it stops the script at breakpoints, how would I know which part contains an error? If I don't set the breakpoint at "correct" (i.e. containing an error) location, it would just run and that's it?

    So I am left with using prints after almost every single line? Previously, my code worked. But with added code from manual, it started to fail. If you could load it up in your system and run, maybe you as an expert could spot a problem much easier than I would.

    Comment


      #17
      Hello UltraNIX,

      The break points would let you step through parts of the code. If you hit a break point and the script is still running, the code up to that break point was not the cause and ran without issue, then it gets to the next break point, and the next, until the error occurs and we know the code in between two break points is the issue.

      Using prints we would be seeing the prints appear and know the code before the print is ok. When the prints stop appearing and the error occurs, we know the code below the last print is where the issue is.

      Yes, using prints and debugging is also the process we all use to find issues.
      (This is why I put together videos that demonstrate the process we use to find issues)


      I am not able to debug a script on your behalf.

      Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.

      That said, I am happy to answer any questions you may have about NinjaScript if you decide to continue.

      You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Correct me if i am wrong, but I suppose those "educational as well as consulting services" are paid? If yes, then I am not there yet, as I've said in previous replies. If not, I would be happy to get additional help.

        Comment


          #19
          Hello UltraNIX,

          Yes, the affiliate 3rd party consultants do charge for their work.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_ChelseaB View Post
            I am not able to debug a script on your behalf.

            Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.

            That said, I am happy to answer any questions you may have about NinjaScript if you decide to continue.
            Maybe we could do this the other way around. I've seen in the forums that support department members set up example files that address the issue a forum member is having. Could you do an example file with "SampleMACrossOver" strategy, but instead of EnterLong() you would use EnterLongStopMarket(1, (High[0] + TickSize) , "Long Entry") and add funcionality to auto-cancel the EnterLongStopMarket order, if it is not filled within 2 bars. I hope you could do that.

            I am sure that other people would also benefit from this technique and could use in their solutions.

            By the way, I downloaded 74 strategies from this site for NinjaTrader 8 and NONE use any CancelOrder method.

            I again searched in Google, searched in this forum, found couple other topics, tried to adapt the code, still nothing is working. And it's so painful.

            Comment


              #21
              Hello UltraNIX,

              We have a sample of using CancelOrder in the help guide reference samples area, you can see it here: https://ninjatrader.com/support/help...thod_to_ca.htm

              This specifically uses an EnterLongLimit but otherwise contains what you are asking to do. You could modify this to use a stop market if you would like to see that happen.

              I would suggest to review all of the reference samples we have in the help guide. We have most of the basic concepts surrounding common tasks so they can be very useful starting points or can be used to copy/paste concepts into your script.

              I look forward to being of further assistance.




              JesseNinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_Jesse View Post
                Hello UltraNIX,

                We have a sample of using CancelOrder in the help guide reference samples area, you can see it here: https://ninjatrader.com/support/help...thod_to_ca.htm

                This specifically uses an EnterLongLimit but otherwise contains what you are asking to do. You could modify this to use a stop market if you would like to see that happen.

                I would suggest to review all of the reference samples we have in the help guide. We have most of the basic concepts surrounding common tasks so they can be very useful starting points or can be used to copy/paste concepts into your script.

                I look forward to being of further assistance.



                Yes, I downloaded it 2 days ago and tried to adapt the code, but it didn't work as expected. I think I am running out of options.

                Comment


                  #23
                  Hello UltraNIX,

                  If you tried something that didn't work out we generally suggest to make a post about that and include a sample of what you tried with the steps to see the problem. We can only assist if we know what problem you are having and because you made modifications we won't know what you did there.

                  The sample is intended to work as is but if you start making modifications that could certainly prevent it from working. We generally would suggest to use Prints regularly in your code to make sure the code is executing as you expect it to. If its not the prints can help to highlight that as a debugging step. I saw that you were trying to use visual studio to debug it however we won't be able to assist with that specifically so Prints are a good alternative so that we can assist.

                  Please let me know if I may be of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by yertle, Yesterday, 08:38 AM
                  7 responses
                  28 views
                  0 likes
                  Last Post yertle
                  by yertle
                   
                  Started by bmartz, 03-12-2024, 06:12 AM
                  2 responses
                  20 views
                  0 likes
                  Last Post bmartz
                  by bmartz
                   
                  Started by funk10101, Today, 12:02 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post funk10101  
                  Started by gravdigaz6, Yesterday, 11:40 PM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by MarianApalaghiei, Yesterday, 10:49 PM
                  3 responses
                  10 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X