Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

unwanted entry and exit order

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

    unwanted entry and exit order

    Hello,
    I have automated strategy and I found a problem with unwanted entries and exits. Lets see a picture one. On graph you can see my entry and exit as I planned. It is one trade.

    However, if I open account performance and trades (last 2 trades), you can see, that there are two trades (2 entries at the same entry time). Unwanted Close position order...

    They started at the same time, but finish in different time too? Why I have this Close position order there if I have no such an order in my strategy? And why I can not see it on chart at least? Will be glad for any advices.

    Thanks Tomas
    Attached Files

    #2
    Hello Tomass,

    Thank you for your post.

    The Account Performance will tie each trade together based solely on execution. This means it does not tie trades together based on the order name (such as "Close position", or "Profit Target").
    This means that it ties the trades together by the sequence in which they were received.

    This can complicate performance view of strategies on the Account Performance as it does not tie trades together based on the automated trading strategy's entries and exits.
    Instead, you want to go to the Strategies tab of the Control Center > right click on the Strategy > select Strategy Performance > select Realtime (NOT Historical or Historical & Realtime). This will provide you with the trades that occurred on the account the strategy is assigned to (Replay101 in this case) and only those that were placed by that strategy. This ties the trades together as intended.

    Please let me know if you have any questions.

    Comment


      #3
      Thank you for your answer. I tried it as you said, but I still can see a problem.

      Somehow my "stoplossshort" (which is just ExitShort order), is used as an entry order? How is it possible? It makes unwanted trade.
      I thought that order "ExitShort" can be triggered only if there is EntryShort order, as a way how to exit trade? How to prevent ExitShort order being triggered as an Entry Order please?
      Attached Files

      Comment


        #4
        I think I found the problem.

        Lets say I have to Exit conditions from same entry. Condition A and ConditionB.

        If condition A appears, trade is closed. If condition B appears, trade is closed. I have also rule, that condition A and B can not appear on the same bar.

        But - I am using renko charts. And sometimes it happens that 2 bars appears at the same time.

        In this case, suddenly appears at the same time bar with conditionA and bar with conditionB together. What happens after that, is a situation, that on next bar, Both exit orders are triggered together and that is the problem, because one f them closes the position, but the second works as entry order.

        Is there any way to prevent this situation? What to do if 2 bars with exit conditions appear at the same time? How to make it work, that if one is triggered, second is cancelled?

        Comment


          #5
          Hello Tomass,

          Thank you for your response.

          Can you give an example of the conditions that could trigger in this case?

          Comment


            #6
            Lets say I have one entry (just example):

            (if price CrossAbove EMA 200 -> Enter Long "longtrade")

            and two exits for this entry:

            Exit 1if Close(0)< Close(1) and (!(if EMA100<EMA 200))-> Exit Long"longtrade")

            Exit2if EMA100<EMA 200 and(!(if Close(0)< (Close(1)) -> Exit Long "longtrade")...

            Two different exits for same entry, which can not happen at the same bar. On minute chart it works great. If you meet a bar which meet one of those conditions, trade is closed and second condition is automaticaly cancelled.

            But problem is with Renko chart and wtih situation which sometimes happens - That if market moves too fast, more Renko bars can appear at the same time.

            Imagine situation : In one second, Renko chart makes 10 bars together at the same time...Bar number 1 meets the condition for Exit1. Bar number 8 meets the condition for Exit2. These exits can not normallyhappen at the same time, but because more bars appeared at the same time (and both conditions are met on 2 different bars at the same time), Ninja takes both conditions equally and trigger them both.... Result is, that trade is closed for example by Exit1, but Exit2 is not cancelled, even worse - it is triggerred as an entry signal now... Is there any solution for these situations?

            Comment


              #7
              Hello Tomass,

              Thank you for your explanation.

              Essentially a race condition here with the multiple bars in a quick succession. So as you suggested you can implement logic to check for the orders before submitting the other.
              This requires using the IOrder objects so that you tie an order to an object that can then be checked for null. This means it is not null when active and is set to null in your code when it fills.

              Please take a look at the following link for more information: http://ninjatrader.com/support/helpG...nt7/iorder.htm

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Jon17, Today, 04:33 PM
              0 responses
              1 view
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              5 views
              0 likes
              Last Post Javierw.ok  
              Started by timmbbo, Today, 08:59 AM
              2 responses
              10 views
              0 likes
              Last Post bltdavid  
              Started by alifarahani, Today, 09:40 AM
              6 responses
              41 views
              0 likes
              Last Post alifarahani  
              Started by Waxavi, Today, 02:10 AM
              1 response
              20 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Working...
              X