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

Strategy submitting opposite orders

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

    Strategy submitting opposite orders

    Hi all,

    So I'm trying to build a simple MA strategy which is based on a Fast Ma crossing a Slow Ma, then a buy/sell on a Mid Ma.
    Now the strategy is working but sometimes the automated strategy submits the order in the opposite direction.

    Here are the inputs for going long, the same but then opposite for going short.
    Also a screenshot of the order going the wrong direction, Ma's going short but the strategy submits a long order.

    Can anyone help me figuring out why it does that?




    #2
    Hello Lotyok,

    Thanks for your post.

    Based on the screenshots provided, there is not enough information presented to help in understanding why your strategy performs as it does.

    As you have 4 sets, what I recommend is that in each set you draw an object on the chart representing the set so that when the conditions of that set are true, a draw object will show. In this way, you can do visual debugging which may help clarify how your strategy is performing. You might be surprised at how often a set may or may not be true and this is one way to indicate that. In the actions of each set, you can select Drawing> and then choose from dots, arrows, diamonds, etc.

    By default, the draw objects will only show the latest occurrence. You will need to change the "tag name" of the objects so you can see all occurrences. Also, you will need to specify the "Y" value which really means what price level to show them on the chart. The easiest way to do this is to use the price of the bars and then add an offset so that the draw object does not cover the bar. As you have 4 sets you will want to offset each progressively higher or lower so that if all 4 happened to be true on the same bar, you would be able to see all four. When going short, I typically will place the objects a few ticks above the High of the bar, when going short a few ticks below the Low of the bar.

    Here is a short video to help understand how to create unique tag names and how to offset draw objects: https://paul-ninjatrader.tinytake.co...MF8xMTMwNTc0MA

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Are you waiting for a bar to close?

      Comment


        #4
        NinjaTrader_PaulH Thanks for your reply, the 2 other sets are just for closing the long or short position, they do function.
        The weird thing is that the long positions alway function correctly, the strategy only messes up the short orders.

        sledge Yes I am waiting for the bar to close when going below (short order) the Mid Ma.

        Comment


          #5
          Hello Lotyok,

          Thanks for your reply.

          I would still suggest using the drawing objects as previously advised as it can be informative to see when the sets are true compared to when you think they are true.

          You are using limit orders. In the Strategy Builder, limit orders are automatically canceled if not filled in the bar that they are submitted in. Limit order would need to be resubmitted to keep them active on a bar by bar basis.

          You may want to temporarily replace the limit orders with market orders to see if the strategy then performs according to your expectations.

          Paul H.NinjaTrader Customer Service

          Comment


            #6
            NinjaTrader_PaulH Alright I will try the suggestion you posted and see if that will bring out the problem.
            Thanks again!

            Comment


              #7
              NinjaTrader_PaulH Hi, so I tried your suggestion adding drawing to the strategy. When looking at the backtest it won't show any drawings, the orders are put in though. Market orders are not solving the issue either. I'm a bit lost on how to solve this now.

              Comment


                #8
                Hello Lotyok,

                Thanks for your reply.

                Please post a screenshot(s) of your set(s) that shows the drawing you used.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  NinjaTrader_PaulH While I was running the strategy live I got this error message. Could this be what is causing it to submit the wrong order? (Changed the limit orders to Market orders)

                  Comment


                    #10
                    Hello Lotyok,

                    Thanks for your reply.

                    There is not enough information to assist you through the forum posts.

                    Please send an e-mail to PlatformSupport[at]NinjaTrader[dot]com. Mark the e-mail Atten Paul, Ticket # 2642820.

                    In the body of the e-mail, 1) include a link to this thread and:
                    2) Add your strategy file, found in Documents>NinjaTrader8>bin>Custom>Strategies> it will be a .cs type with the name of the strategy.
                    3) Add your log and trace files
                    Please follow the steps below to manually attach your log and trace files to your e-mail
                    • Open your NinjaTrader folder under, "Documents" (sometimes called, "My Documents")
                    • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
                    • Send the 2 compressed folders as attachments to the email.
                    • Once complete, you can delete these compressed folders.
                    Paul H.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Tim-c, Today, 03:54 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post Tim-c
                    by Tim-c
                     
                    Started by FrancisMorro, Today, 03:24 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post FrancisMorro  
                    Started by Segwin, 05-07-2018, 02:15 PM
                    10 responses
                    1,771 views
                    0 likes
                    Last Post Leafcutter  
                    Started by Rapine Heihei, 04-23-2024, 07:51 PM
                    2 responses
                    31 views
                    0 likes
                    Last Post Max238
                    by Max238
                     
                    Started by Shansen, 08-30-2019, 10:18 PM
                    24 responses
                    945 views
                    0 likes
                    Last Post spwizard  
                    Working...
                    X