Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

after compile a new strategy, it doesn't appear as available!

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

    #16
    Hello Anquirk,

    The issue appears to be that the strategy is not in the strategies namespace.

    Was this strategy created with the NinjaScript Editor? (Strategies created in NinjaTrader automatically have the correct namespace generated)

    I recommend you create a new strategy with the NinjaScript Editor, do not change the namespace, and copy the logic and properties into the new script.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Anquirk,

      The issue appears to be that the strategy is not in the strategies namespace.

      Was this strategy created with the NinjaScript Editor? (Strategies created in NinjaTrader automatically have the correct namespace generated)

      I recommend you create a new strategy with the NinjaScript Editor, do not change the namespace, and copy the logic and properties into the new script.
      Yes the strategy created with script editor and I did not change any namespace it was generated automatically like MyCustomStrategy

      Comment


        #18
        Hello Anquirk,

        Please create a new strategy (not a copy but a new strategy) from the NinjaScript Editor.

        Are you seeing the namespace generated with the default generated structure code?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #19
          [QUOTE=NinjaTrader_ChelseaB;n1288865]Hello Anquirk,

          Please create a new strategy (not a copy but a new strategy) from the NinjaScript Editor.

          I did and now I can see a strategy on the chart settings. The strategy added enabled and connection is on but no any trade were executed. Also my strategy analyzer looks weird so I can't change any settings (see attachment please) Click image for larger version

Name:	image.png
Views:	47
Size:	75.0 KB
ID:	1288871

          Comment


            #20
            Hello Anquirk,

            If there is no logic to place orders then no orders will be placed. After you have copied the logic and properties to the new script the logic would be there to place orders.

            May I first confirm that the new strategy has the default namespace properly added? (This would further suggest your original script was either not created with the NinjaScript Editor or the namespace was manually removed)

            With the strategy parameters area missing, this could mean a script is causing an issue, and this might be the original script.
            Try Excluding this from compilation and see if the behavior continues.

            Chelsea B.NinjaTrader Customer Service

            Comment


              #21
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello Anquirk,

              If there is no logic to place orders then no orders will be placed. After you have copied the logic and properties to the new script the logic would be there to place orders.

              May I first confirm that the new strategy has the default namespace properly added? (This would further suggest your original script was either not created with the NinjaScript Editor or the namespace was manually removed)

              With the strategy parameters area missing, this could mean a script is causing an issue, and this might be the original script.
              Try Excluding this from compilation and see if the behavior continues.
              Yes the new strategy name added properly could be deleted before occasionally. And the logic to open a trade is here:

              if (ToTime(Time[0]) >= 160000 || ToTime(Time[0]) < 93000)
              {
              sessionHigh = Math.Max(sessionHigh, High[0]);
              }

              // Trade logic
              if (!tradeExecutedToday && sessionHigh != double.MinValue && Close[0] > sessionHigh)
              {
              EnterLong("LongPosition");
              tradeExecutedToday = true;

              Still can't het why I can't see any executed trades.

              Comment


                #22
                Hello Anquirk,

                If the strategy is applied to a chart, is there data with new bars appearing on the chart the Strategy is applied to?

                Is the strategy showing as enabled on the Strategies tab of the Control Center?

                If the strategy is in the Strategy Analyzer, is there data appearing on the Chart Display of the Strategy Analyzer?

                Importantly, are there errors appearing on the Log tab of the Control Center?


                Try testing the Sample MA Crossover strategy included with NinjaTrader on the same chart or Strategy Analyzer using the same instrument, bar type, interval, and date range.

                Do you see results with the Sample MA Crossover strategy? (This would confirm for us data is available and the issue is with the logic in the custom script)


                If the strategy is getting data and the strategy is enabled or a backtest is run with no errors in the Log tab of the Control Center, and the Sample MA Crossover is returning results, then would likely indicate the logic conditions in the custom strategy did not evaluate as true or orders are being ignored or cancelled.

                In order to better understand how the code is working, it will be necessary to use Print to see how the conditions are evaluating and enable TraceOrders to see if orders are being submitted, ignored, rejected, or cancelled.

                Below is a link to a forum post that demonstrates using prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.


                Enable TraceOrders, print the time of the bar and all values used in the conditions that submit entry orders. Include labels for all values and comparison operators.

                Let me know if you need any assistance creating a print or enabling TraceOrders.

                Save the output from the output window to a text file and provide this with your reply.

                I'll be happy to assist with analyzing the output.​
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #23
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hello Anquirk,

                  If the strategy is applied to a chart, is there data with new bars appearing on the chart the Strategy is applied to?

                  Is the strategy showing as enabled on the Strategies tab of the Control Center?

                  If the strategy is in the Strategy Analyzer, is there data appearing on the Chart Display of the Strategy Analyzer?

                  Importantly, are there errors appearing on the Log tab of the Control Center?


                  Try testing the Sample MA Crossover strategy included with NinjaTrader on the same chart or Strategy Analyzer using the same instrument, bar type, interval, and date range.

                  Do you see results with the Sample MA Crossover strategy? (This would confirm for us data is available and the issue is with the logic in the custom script)


                  If the strategy is getting data and the strategy is enabled or a backtest is run with no errors in the Log tab of the Control Center, and the Sample MA Crossover is returning results, then would likely indicate the logic conditions in the custom strategy did not evaluate as true or orders are being ignored or cancelled.

                  In order to better understand how the code is working, it will be necessary to use Print to see how the conditions are evaluating and enable TraceOrders to see if orders are being submitted, ignored, rejected, or cancelled.

                  Below is a link to a forum post that demonstrates using prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.


                  Enable TraceOrders, print the time of the bar and all values used in the conditions that submit entry orders. Include labels for all values and comparison operators.

                  Let me know if you need any assistance creating a print or enabling TraceOrders.

                  Save the output from the output window to a text file and provide this with your reply.

                  I'll be happy to assist with analyzing the output.​
                  I have a feeling that we are marking time in one place. Sorry. I said earlier that I only see the strategy in the Script Editor lists and in the chart settings when I try to apply the strategy. I do not see a strategy in Strategy analyzer, nor do I see the Strategy Analyzer settings themselves (see screenshot above), Just as no executed trades appear on the chart itself and the strategy performance function called from the graph shows 0 trades.
                  There are no errors appearing on the Log tab of the Control Center.
                  Do you mind to check the code on your end and help me to fix it please?
                  Here is the code attached below
                  Attached Files

                  Comment


                    #24
                    Hello Anquirk,

                    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
                    1. Click Tools -> Export -> NinjaScript Add-on...
                    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
                    3. Click the 'Export' button
                    4. Enter the script name in the value for 'File name:'
                    5. Choose a save location -> click Save
                    6. Click OK to clear the export location message
                    By default your exported file will be in the following location:
                    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
                    Below is a link to the help guide on Exporting NinjaScripts.



                    Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services or one on one educational support in our NinjaScript Support department. This is so that we can maintain a high level of service for all of our clients as well as our associates.

                    That said, through email or on the forum we are happy to answer any questions you may have about NinjaScript if you decide to code this yourself. We are also happy to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior.

                    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 a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.


                    If you are interested in debugging the script yourself with direction, I am happy to keep assisting.​


                    That said, is this the new script I have directed you to make?

                    Have you modified the curly braces and spacing?

                    Did you copy the class declaration twice on lines 8 and 12?

                    I feel like this cannot be a new script created with the NinjaScript Editor. There are things in this script that cannot have been done by the NinjaScript Editor.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #25
                      Originally posted by NinjaTrader_ChelseaB View Post
                      Hello Anquirk,




                      Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients.
                      I got it but I'm not asking to create or modify I just need to know what's wrong with my strategy.
                      Btw I just uploaded exported file below

                      Comment


                        #26
                        Hello Anquirk,

                        I feel that this is not a script made by the NinjaScript Editor or has been edited with mistakes.

                        See post # 24 with my observations.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #27
                          Originally posted by NinjaTrader_ChelseaB View Post
                          Hello Anquirk,

                          I feel that this is not a script made by the NinjaScript Editor or has been edited with mistakes.

                          See post # 24 with my observations.
                          Do I understand correctly that you are not able to directly point out the errors in my script that you are talking about?

                          Originally posted by NinjaTrader_ChelseaB View Post
                          There are things in this script that cannot have been done by the NinjaScript Editor.
                          Would you mind to explain what do you mean by that please

                          Comment


                            #28
                            Hello Anquirk,

                            You have a class inheriting from the strategy class within the scope of a class inheriting from the strategy class. That isn't going to work.
                            The filename does not match the class name.
                            The spacing is not following the C# standards of nested objects being 1 tab indented.
                            This is leading me to believe this is not the new script I have directed you to create. (A new script should have all of the default structure correct)

                            Please answer the following:

                            Is this the new script I have directed you to make?

                            Have you modified the curly braces and spacing of this new script?

                            Did you copy the class declaration and duplicate line 8 on line 12 in this new script?​
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #29
                              Originally posted by NinjaTrader_ChelseaB View Post
                              Hello Anquirk,



                              Please answer the following:

                              Is this the new script I have directed you to make?

                              Have you modified the curly braces and spacing of this new script?

                              Did you copy the class declaration and duplicate line 8 on line 12 in this new script?​
                              1. Sorry no. But I just did it and insert the trade logic in there
                              2. Not modified with new strategy just created
                              3. Please see new attachment
                              Attached Files

                              Comment


                                #30
                                Hello Anquirk,

                                This is not the strategy whom's text was provided in post # 23.
                                The code in this script is very different.

                                I was able to import this script and this is loading in the Strategy Analyzer and the parameters area is showing.
                                Click image for larger version

Name:	2024-01-30_13-17-19.png
Views:	74
Size:	77.6 KB
ID:	1288943

                                Likely that issue is not related to this new specific script.

                                Have you excluded the original script from compilation as directed in post # 20?
                                If so, try excluding all other custom scripts (other than this one), and then restart NinjaTrader.
                                Chelsea B.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by fx.practic, 10-15-2013, 12:53 AM
                                5 responses
                                5,404 views
                                0 likes
                                Last Post Bidder
                                by Bidder
                                 
                                Started by Shai Samuel, 07-02-2022, 02:46 PM
                                4 responses
                                95 views
                                0 likes
                                Last Post Bidder
                                by Bidder
                                 
                                Started by DJ888, Yesterday, 10:57 PM
                                0 responses
                                8 views
                                0 likes
                                Last Post DJ888
                                by DJ888
                                 
                                Started by MacDad, 02-25-2024, 11:48 PM
                                7 responses
                                160 views
                                0 likes
                                Last Post loganjarosz123  
                                Started by Belfortbucks, Yesterday, 09:29 PM
                                0 responses
                                9 views
                                0 likes
                                Last Post Belfortbucks  
                                Working...
                                X