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

Issues with Order Entry on my Strategy

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

    Issues with Order Entry on my Strategy

    Hi,

    I'm not a coder and have been learning how to use strategy builder and playing with it for a little while, but I just can't seem to get it right. What I want to do is trade based on reversals and have setup a simple strategy that I thought should be the base I could build off, but it's not quite working as it should.

    I have 2 sets for entering a long position and 2 sets for entering a short position which are basically opposite. What I want it to do at this point is to enter long as soon as the price is above the high of the last bar [1] if the last bar [1] had a lower high and lower low than the prior bar [2] or if it was an inside bar of the prior [2] (lower high and higher low). I also want to be in a trade if it turns to an outside bar (breaks the high of the prior bar after having already broken the low or vice versa) and thought this would do it.

    It seems to work alright sometimes, but then at other times what is happening is I will occasionally get a random entry a little while after it has already broken the prior bar high/low. I will sometimes also get a couple of separate entries at levels that make no sense back to back as soon as the first was stopped out. I noticed this happen on an ouside bar (one that broke both the high and low of the prior bar [1]. After it broke the other side it was entering a trade opposite of what I desired. For example, if it had broken the low of the prior bar, then came back up and broke the high, it sold a contract rather than buying one like I would desire.


    I'm really stumped on this stuff. Any help would be greatly appreciated.

    Thank you,
    Lester
    Last edited by LesterC01; 08-10-2021, 07:28 AM. Reason: Editing to remove a portion of the post that I think I figured out

    #2
    Hello LesterC01,

    Thank you for your post.

    The first thing I would recommend would be to turn on the Order Trace function:

    Strategy Builder > Default Properties > More Properties > Trace Orders

    Once you then recompile the strategy, you can open a new NinjaScript Output window under New > NinjaScript Output. This will print a log of any orders submitted by the strategy during while it's running, along with any ignored orders. You can then look through and see what may be occurring.

    Here is a link to our help guide that goes into more detail on tracing orders:

    https://ninjatrader.com/support/help...aceorders2.htm

    Trace orders alone may not give you the full picture of whether or not a trade should have been entered on a given bar, so adding prints to your strategy that will show in the NinjaScript Output window, with information on what the variables you're using for your conditions are on a particular bar, can be helpful.

    This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.

    https://ninjatrader.com/support/foru...ns-not-working

    If you run into issues like we saw here, the above information will allow you to print out all values used in the condition in question that may be evaluating differently. With the printout information you can assess what is different between the two. What I would suggest is to print the values you're using in the entry conditions for each bar so you can identify when they are becoming true, and compare that with the orders you're seeing from trace orders/on the chart.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your response Kate.

      I am seeing some of the issues now and think they will be solved if I can limit it to one order per bar per direction. I know I have seen a post on this before, but am having trouble finding it again. Do you happen to have a link to that available?

      Thank you,
      Lester

      Comment


        #4
        Hello LesterC01,

        Thank you for your reply.

        I'm unsure exactly which post you're referring to, but this post by one of my colleagues has some options:

        Hello everyone, first of all, my strategy in the strategy builder already says, "only one trade per direction". And, the higher I go with the minutes in the chart, the more I get this error. Is there a way in the strategy builder to say him, he has to do one trade per 10 minutes or similar? Or can I really say at


        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Yes, that's similar to the post I had seen. Thank you Kate. I'll work on that

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by WHICKED, Today, 12:56 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cre8able, Today, 01:16 PM
          0 responses
          1 view
          0 likes
          Last Post cre8able  
          Started by chbruno, 04-24-2024, 04:10 PM
          2 responses
          47 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by WHICKED, Today, 12:45 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by samish18, Today, 01:01 PM
          0 responses
          5 views
          0 likes
          Last Post samish18  
          Working...
          X