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

How to ignore signal if order is pending from bar[1]

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

    How to ignore signal if order is pending from bar[1]

    Guys,

    Rarely my strategy gives signals on two adjacent bars. My entries are with the default liveUntilCancelled (false), but my trace orders yields this:

    1/4/2009 7:35:00 PM Entered internal PlaceOrder() method at 1/4/2009 7:35:00 PM: Action=SellShort OrderType=Limit Quantity=0.02M LimitPrice=1.3924 StopPrice=0 SignalName='ShortX' FromEntrySignal=''
    1/4/2009 7:36:00 PM Entered internal PlaceOrder() method at 1/4/2009 7:36:00 PM: Action=SellShort OrderType=Limit Quantity=0.02M LimitPrice=1.3922 StopPrice=0 SignalName='ShortX' FromEntrySignal=''
    1/4/2009 7:36:00 PM Amended open order: Action=SellShort OrderType=Limit Quantity=20000 LimitPrice=1.3922 StopPrice=0 SignalName=ShortX' FromEntrySignal=''
    1

    i.e., my strategy is sending two orders. I trap for MarketPosition.Position == (long or short) to prevent this, but when I get two signals on adjacent bars, the first order isn't automatically cancelled yet by NT, and when it's not filled, I get a second order because there is no position. Is there anyway to prevent the second order or to cancel the first? I'd like to know how to do both because theoretically, the first would be a better price most of the time.

    Please advise, thanks.
    Last edited by crmcwi; 09-22-2009, 08:36 PM. Reason: inserted word "automatically"

    #2
    crmcwi, this is expected behavior, pending orders would be amended / updates if resubmitted as in your case. You can check with IOrders if the there are currently pending / working orders in your strategy -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      check EntryOrder == null?

      Thanks Bertrand, but the issue is not the auto-amending, but the "duplication" of the order. I only want one order to be placed. I thought EntriesPerDirection = 1 would prevent the second entry, but may be not if the first order hasn't been filled.

      So, please tell me, will EntriesPerDirection = 1 keep the second order from being placed even if the first hasn't been filled?

      I think I can absolutely keep the second from being placed if I use the amend my condition with " && EntryOrder == null", yes?

      Comment


        #4
        crmcwi, then please use the EntryOrder == null check, as an entry is not 'counted' if sitting there unfilled.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          thanks Bertrand, just to be sure, once I submit an entryOrder, it will not be null until it is filled or cancelled, yes?

          Comment


            #6
            Correct, once triggered it will be an active object.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Thank you Bertrand.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DustyContrer, Today, 04:02 AM
              0 responses
              3 views
              0 likes
              Last Post DustyContrer  
              Started by ETFVoyageur, Today, 02:15 AM
              0 responses
              11 views
              0 likes
              Last Post ETFVoyageur  
              Started by Board game geek, Today, 01:34 AM
              0 responses
              9 views
              0 likes
              Last Post Board game geek  
              Started by morrnel, 05-12-2024, 06:07 PM
              3 responses
              44 views
              0 likes
              Last Post wzgy0920  
              Started by FishTrade, Yesterday, 11:11 PM
              0 responses
              7 views
              0 likes
              Last Post FishTrade  
              Working...
              X