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

getatm - mulitple entries

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

    getatm - mulitple entries

    Hello,

    I´m doing a script based on the sampeatmstrategy. The script is running cobc==false.

    With every entry there appears also a new entrylimit. I added the flat condition to the conditon from the sample:

    if(orderId.Length == 0 && atmStrategyId.Length == 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
    then do limit

    But there shouldnt be an additional entry also without (....Flat) because the atmStrategyId.Length is reset to 0 only with (...length>0 and Flat). Strange. I have in the code in onbarupdate same as in the sample.

    Why is there with the entry a new entrylimit when I have the condition flat please?

    Thank you!
    Tony
    Attached Files
    Last edited by tonynt; 07-27-2017, 08:48 AM. Reason: translation error, clearifying

    #2
    Hello tonynt,

    Without the full code I can only speculate on the issue.

    I have created a demonstration going over how I have applied this modification and the behavior I see: https://www.screencast.com/t/b9fRjcwEKtDp

    If part of your logic is in question, you will need to add prints to display the values of the variables used in your conditions or comment out sections of code to understand why something has occurred. This process would tell you the reason why your logic is processing the way it is.

    Here is a link for tips when debugging NinjaScript code - http://ninjatrader.com/support/forum...ead.php?t=3418
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply. Good idea to show with video.

      So, here is my 3-min-video where you can see that it is correct with cobc=true but when I enable with cobc=false there is immediately with the trade a new limitentry order.




      Thank you!
      Tony
      Attached Files

      Comment


        #4
        Hello Tony,

        We observed a working case in which you may reference to troubleshoot your code further.

        To understand why your entry conditions are becoming true and constantly allowing you to enter, you will have to debug the strategy with Prints to observe the values that allow those conditions come true. From there, you will need to follow the code for how those variables get modified to verify and correct your logic.

        You may also wish to start a fresh modification of SampleAtmStrategy applying the changes demonstrated to observe the behavior before incorporating into a larger strategy.

        We do not provide debugging assistance in the Support Department at NinjaTrader, this is so we can maintain a high level of service for our clients as well as our vendors. If you would like to get connected with a certified NinjaScript Consultant, you can write in to platformsupport[at]ninjatrader[dot]com and I can connect you with a member of our Business Development team who can provide you further information.

        If that is the case, please write in with the thread ID and text "Attention Jim."
        JimNinjaTrader Customer Service

        Comment


          #5
          Hello,

          a question before preparing for all the code print statements.

          I have enabled only one strategy for testing. But in the output window appear so many lines all the time. I see SetStopTarget()method from entrysignals with names from other scripts that are not enabled. Why do they appear in the output window, when the scripts are not enabled? I dont have another workspace open, only the chart with one script testing the atm.

          Thank you!
          Tony

          Comment


            #6
            Hello Tony,

            If you clear the output window and still see prints from other NinjaScripts, that would mean those NinjaScripts are running somewhere on the platform. I would advise to open NinjaTrader with a blank workspace, as well as confirming if you have TraceOrders enabled or not.

            It might be useful to disable TraceOrders so you can focus on the prints that you place in the logic.

            Please follow the directions here to test in a blank workspace:
            • Shut down NinjaTrader
            • Navigate to (My) Documents\NinjaTrader 7\workspaces
            • Delete the file named "_Workspaces.XML". DO NOT delete the 'workspaces' folder - only delete the '_Workspaces.XML' file within the 'workspaces' folder
            • After deleting this file, restart NinjaTrader which should start up without any workspaces.
            • *Please note this will not delete your workspace however the new blank workspace will be named Untitled1. If you have a workspace already named "Untitled1," however, you will not want to save the workspace when exiting NinjaTrader, otherwise, it will overwrite it.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hello,

              thank you for your reply. I know about creating a new workspace, but what I´m surprised is that "NinjaScripts are running somewhere on the platform". What? Where? How? Why?

              Yes, I have traceorders enabled in many scripts. Shouldn´t I have this? This will write in the output window, even when scripts not enabled?

              Thank you!
              Tony

              Comment


                #8
                Hello Tony,

                Could you provide some more information as to where these prints are coming from? I have outlined some steps you can take to check where prints are occurring so we can troubleshoot further.

                When you test with blank workspaces following the steps in my last post, and open a NinjaScript Output window before opening any other window, do you see prints?

                How about after connecting to the simulated data feed?

                Open a chart after that, do you see prints?

                After the chart is open, apply your NinjaScript. Are any other prints visible?

                A print will only occur if a NinjaScript is running and executed the Print() method. This applies to TraceOrders as well, which will print information when order methods are executed for that strategy.

                TraceOrders will tell you information about the order that was submitted. If you are debugging your logic, you are looking at the conditions that allow these order methods to execute and not the actual orders themselves. TraceOrders will tell you when an order occurred, but the order method knows nothing about the conditions used to submit it.

                I look forward to being of further assistance.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Hello Jim,

                  thank you for your reply. I have done ref. your instructions:

                  after deleting the workspace.xml re-started NT
                  • output window, no prints
                  • connected to sim datafeed, no prints
                  • open CL chart 1min, 3 days to load, no prints

                  Then right click on chart to select a strategy to apply, immediately appear many prints. As you see in the screenshot, already before applying a script: “7/28/2017 4:05:46 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='iSb' Mode=Ticks Value=5 Currency=0 Simulated=False” ...........

                  So the prints occur when a NT-script is not running yet! ("A print will only occur if a NinjaScript is running and executed the Print() method")


                  Thank you for your support!


                  Tony
                  Attached Files

                  Comment


                    #10
                    Hello Tony,

                    Thanks for providing that detail.

                    Those entries in the NinjaScript output window are coming from one or more strategies that have TraceOrders enabled. When you open the Strategies or Indicators window, the NinjaScripts contained will call Initialize() and will reach the TraceOrders = true; line. After Initialize() completes TraceOrders will begin outputting to the NinjaScript window.

                    To prevent seeing these lines in the output window, please make sure TraceOrders is disabled for any strategy you have on the platform.
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      Hello Jim,

                      thank you for your reply. I think it will be more easy to do a new installation instead of going over all the strategies (>80). How do I make a new "NinjaTrader 7" beside my existing and renamed prior ones please. By running an installation file or delete or rename any folder? I dont remember how I had done before.

                      Thank you!
                      Tony
                      Attached Files

                      Comment


                        #12
                        Hello Tony,

                        To create another instance of the platform on your PC,
                        1. Close NinjaTrader 7, and rename the "NinjaTrader 7" folder in My Documents to something like: "NinjaTrader 7 OLD"
                        2. Uninstall NinjaTrader from the Windows Control Panel and reinstall using the installer from http://ninjatrader.com/PlatformDirect
                        3. You can switch platforms by closing NinjaTrader and renaming the platform folder you want to open with to "NinjaTrader 7"


                        I would advise to make sure the platform is up to date to avoid issues between the two platform folders. NinjaTrader 7 is currently at Release 35.
                        JimNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by michi08, 10-05-2018, 09:31 AM
                        5 responses
                        741 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Started by The_Sec, Today, 02:29 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post The_Sec
                        by The_Sec
                         
                        Started by tsantospinto, 04-12-2024, 07:04 PM
                        4 responses
                        62 views
                        0 likes
                        Last Post aligator  
                        Started by sightcareclickhere, Today, 01:55 PM
                        0 responses
                        1 view
                        0 likes
                        Last Post sightcareclickhere  
                        Started by Mindset, 05-06-2023, 09:03 PM
                        9 responses
                        259 views
                        0 likes
                        Last Post ender_wiggum  
                        Working...
                        X