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

2 orders on consecutive bars not working

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

    2 orders on consecutive bars not working

    I am trying to implement this to try to minimize slippage but NT7 does not seem to be able to process it.
    I am trying to understand why and if there is a solution:

    This is in a strategy. I am using UpdateOnBarClose = true.
    It is doing entries doing reversal orders ie long then short then long

    1) I have a short position.
    2) signal to go long occurs on bar 0
    3) I issue first a limit order :
    Lorder01 = EnterLongLimit(0,false,tradesize,Close[0],"L01");

    4) a condition checks if on bar 1 I am in a long position or not (ie I got reversed or not)
    5) if not then I issue a market order at close of bar 1 :
    Lorder01 = EnterLong(0,tradesize,"L01"); // on bar 1 close

    Result from testing : the second market order is never executed by NT as if like it was never issued or accepted ... I do not see it anywhere in the orders tab. or excution tab.


    So trying to troubleshoot I made a small change :

    6) I change the condition to issue the market order on bar 2 if I am in a long position (ie if I got reversed or not) instead of on bar 1 :
    Lorder01 = EnterLong(0,tradesize,"L01"); //on bar 2 close

    Result from testing : suddenly everything works as intended but on 1 bar later than I want.

    Can you help me understand why is this happening ? it seems to be NT7 internal functionning somehow that does not permit this.

    Thanks

    #2
    qewcool, please rerun your testings with the TraceOrders feature on - http://www.ninjatrader.com/support/f...ead.php?t=3627

    You're likely running into the order handling rules of the Managed Approach here:

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      qewcool, please rerun your testings with the TraceOrders feature on - http://www.ninjatrader.com/support/f...ead.php?t=3627

      You're likely running into the order handling rules of the Managed Approach here:

      http://www.ninjatrader.com/support/h...d_approach.htm

      getting this error on that 2nd market order :

      4/8/2011 5:00:00 AM Ignored PlaceOrder() method at 4/8/2011 5:00:00 AM: Action=SellShort OrderType=Market Quantity=2 LimitPrice=0 StopPrice=0 SignalName='SE01' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'

      so I tried 3 things :
      1) cancelling the limit order before issuing the market order didnt help either.
      2) tried putting EntriesperDirection = 2 but that didnt reverse the position .... it just executed the market order and brought the total position to flat.

      3) So i put EntriesperDirection = 2 and increase the quantity of the market order by 2 like this :
      LEorder01 = EnterLong(0,tradesize*2,"LE01");

      and it is doing what I intended but its a bit unorthodox solution since it doesnt show a "close position" reverse anymore and basically just shows en entry for double the strategy custom quantity.


      woud this solution be ok or does it have unforeseen/unintended consequences ?
      Last edited by qewcool; 06-23-2011, 05:16 PM.

      Comment


        #4
        I think I found some unintended consequences ... cant optimize it
        optimization only do orders for a few days and stop

        1 question : does the stategy slippage applies on limit orders ? or just on market orders when calculating strategy performance ?
        I would guess only on market orders but just want to confirm
        Last edited by qewcool; 06-23-2011, 05:33 PM.

        Comment


          #5
          Slippage would only be applied to market orders, not to limit orders, they get filled at your price or better, so there's no slippage here. For the no trade issues: are you resetting the iorders properly in your strategy after an order reached terminate state?
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Bertrand View Post
            Slippage would only be applied to market orders, not to limit orders, they get filled at your price or better, so there's no slippage here. For the no trade issues: are you resetting the iorders properly in your strategy after an order reached terminate state?
            Yes I am resetting the iorder back to null after filled, cancelled etc ...

            Comment


              #7
              qewcool, I'll have Bertrand get back to you on Monday.
              AustinNinjaTrader Customer Service

              Comment


                #8
                Then you would need to debug the code carefully and simplify it down to the bare essentials to understand where it exactly breaks.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by quantismo, 04-17-2024, 05:13 PM
                4 responses
                30 views
                0 likes
                Last Post quantismo  
                Started by love2code2trade, 04-17-2024, 01:45 PM
                4 responses
                31 views
                0 likes
                Last Post love2code2trade  
                Started by cls71, Today, 04:45 AM
                2 responses
                10 views
                0 likes
                Last Post eDanny
                by eDanny
                 
                Started by proptrade13, Today, 11:06 AM
                0 responses
                5 views
                0 likes
                Last Post proptrade13  
                Started by kulwinder73, Today, 10:31 AM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Erick  
                Working...
                X