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

Level II Strategy

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

    Level II Strategy

    Hi Professionals, I am having difficulty compiling the attached strategy to execute an entry order when level 2 volume for bid is twice as ask (for current price). Can anyone please help?
    Attached Files

    #2
    Hello shahabjet1,

    Are you getting an error message?
    if so, we focus on the error message. What is the full error message and on what line? (You can provide a screenshot if you would like)

    Taking a peak at the code, I have some confusion myself. The class type is strategy but there is indicator generated code at the bottom that can't exist for a strategy. If you are using the NinjaScript Editor to create scripts I wouldn't think this script would even be possible to make.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I have further updated the code, its a Strategy, but am getting errors still, please see the code and a picture of errors attached here, would appreciate any help:
      Attached Files

      Comment


        #4
        Hello shahabjet1,

        Thank you for providing the screenshot of the error messages.

        This is confirming that a strategy cannot have generated code for indicators. This script has generated code at the bottom that shouldn't exist.

        Is this actually a strategy and not an indicator?
        Was this strategy created as a new strategy in the NinjaScript Editor?
        Was this strategy created outside of NinjaTrader in a text editor?
        Have you copied invalid code from an indicator into this strategy?

        I recommend that you start again and make a new blank strategy in the NinjaScript Editor.

        Then only copy the logic from OnBarUpdate() to the new blank strategy.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi, I fixed it all and it was working; then I decided to add SMA indicator and now I am getting a minor error, I might be doing something tiny wrong, can you please check to see what's causing SMA indicator to give error please? Attached.
          Attached Files

          Comment


            #6
            Hello shahabjet1,

            Are you getting an error message?

            If so, what is the full error message and on what line?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Yes. Before adding using SMA indicator there is no problem, but after that it seems there is a minor problem, I attached the error message and highlighted the line...
              Attached Files

              Comment


                #8
                The code is also in my above message if needed... must be a simple error something obvious that I am doing wrong

                Comment


                  #9
                  Hello shahabjet1,

                  Is this the newly generated strategy I have advised you create?

                  Have the using statements at the top been modified in this newly generated script?

                  Is there a using statement for NinjaTrader.NinjaScript?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Yes all is fixed. Like I mentioned the code was working and only when I added using SMA check its giving me that error

                    Comment


                      #11
                      Hello shahabjet1,

                      I would not be expecting this error for a newly generated strategy. The using statements of a newly generated strategy should be correct in a new script and that error should not occur.

                      Are you 100% that you have generated a new strategy as I directed?

                      Can this be reproduced again when generating yet a another new strategy that has no code copied into it?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Can you help please with my question or no? Its a simple request!

                        Comment


                          #13
                          Hello shahabjet1,

                          I think that it's the using statements but i'm not sure.

                          We will know for sure if we schedule call if you create a new script, do not copy and paste any code, and just add private SMA SMA1; to it. If that new script is also effected, I will need to schedule a call with you so that I can investigate on your end. There might be missing files or something if new scripts are affected.
                          Chelsea B.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by funk10101, Today, 12:02 AM
                          1 response
                          10 views
                          0 likes
                          Last Post NinjaTrader_LuisH  
                          Started by GLFX005, Today, 03:23 AM
                          1 response
                          6 views
                          0 likes
                          Last Post NinjaTrader_Erick  
                          Started by nandhumca, Yesterday, 03:41 PM
                          1 response
                          12 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Started by The_Sec, Yesterday, 03:37 PM
                          1 response
                          11 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Started by vecnopus, Today, 06:15 AM
                          0 responses
                          1 view
                          0 likes
                          Last Post vecnopus  
                          Working...
                          X