Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

if (Order is filled) then

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

    if (Order is filled) then

    Hey @ll,

    i try do do something when at least one EnterLongStop was filled. Multiple entries are fine

    i added:

    private IOrder entryOrder = null;

    and i connect "entryOrder" with the EnterLongStop via

    entryOrder = EnterLongStop(1,X,"Signal Name");

    How can I do smth when the EnterLongStop is filled?

    if (
    entryOrder != null
    && entryOrder.OrderState == OrderState.Filled
    )
    {
    Print("entryOrder " + entryOrder.ToString());
    }


    Can anybody help? Thanks a lot!

    #2
    Originally posted by eNhale View Post
    Hey @ll,

    i try do do something when at least one EnterLongStop was filled. Multiple entries are fine

    i added:

    private IOrder entryOrder = null;

    and i connect "entryOrder" with the EnterLongStop via

    entryOrder = EnterLongStop(1,X,"Signal Name");

    How can I do smth when the EnterLongStop is filled?

    if (
    entryOrder != null
    && entryOrder.OrderState == OrderState.Filled
    )
    {
    Print("entryOrder " + entryOrder.ToString());
    }


    Can anybody help? Thanks a lot!
    Use the OnExecution() handler.

    Comment


      #3
      Hello eNhale,

      Thank you for your post.

      koganam is correct, you would use the OnExecution() method to check when the order filled. For information on OnExecution() please visit the following link: http://www.ninjatrader.com/support/h...nexecution.htm

      Comment


        #4
        Ok i managed that more and less and everything is working fine...

        the only problem:

        - i allow my system to open max 3x2 positions with a break between of 20 bars
        - i am using multiple timeframes so i guess the system is running the OnBarUpdate like a for() loop so the system is using the limit more than once so i have 2x2 or 2x3 positions opened.

        cancel the order with a new if() or whatever would be nice, but i am sitting the enterlongstop on every bar update so it stays alive....

        is it possible to ask something like

        if (entryOrder != execution.Order)

        in the bar update or check if a order with name == xy is filled? or maybe check if last filled was like at least 20 bars ago?

        Comment


          #5
          Originally posted by eNhale View Post
          Ok i managed that more and less and everything is working fine...

          the only problem:

          - i allow my system to open max 3x2 positions with a break between of 20 bars
          - i am using multiple timeframes so i guess the system is running the OnBarUpdate like a for() loop so the system is using the limit more than once so i have 2x2 or 2x3 positions opened.

          cancel the order with a new if() or whatever would be nice, but i am sitting the enterlongstop on every bar update so it stays alive....

          is it possible to ask something like

          if (entryOrder != execution.Order)

          in the bar update or check if a order with name == xy is filled? or maybe check if last filled was like at least 20 bars ago?
          Yes, you can do all that. Those are standard logic operations.

          Comment


            #6
            can u help me with the way to write it?

            (entryOrder.Filled == 0)

            is the correct one?

            and if i send a new entryOrder = EnterStopLong(Whatever2)

            the .Filled is back to 0?

            Comment


              #7
              Originally posted by eNhale View Post
              can u help me with the way to write it?

              (entryOrder.Filled == 0)

              is the correct one?

              and if i send a new entryOrder = EnterStopLong(Whatever2)

              the .Filled is back to 0?
              Those are statements in a vacuum. Without knowing the overarching logic of what you want to do, it is impossible to put those statements in context.

              Comment


                #8
                I just wanted to check if the Order which is sendet few times OnBarUpdate got is filled/pending and how i can get be sure that every order exactly gets one fill and not 2 or 3 like i have it at the moment.

                Comment


                  #9
                  Originally posted by eNhale View Post
                  I just wanted to check if the Order which is sendet few times OnBarUpdate got is filled/pending and how i can get be sure that every order exactly gets one fill and not 2 or 3 like i have it at the moment.
                  Sorry, I am not understanding. You do not control your fills. How you get filled depends on the market and the exchange. So you cannot make sure of anything about your fills. You can determine what to do after the fills.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by pechtri, 06-22-2023, 02:31 AM
                  9 responses
                  122 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by frankthearm, 04-18-2024, 09:08 AM
                  16 responses
                  66 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by habeebft, Today, 01:18 PM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by benmarkal, Today, 12:52 PM
                  2 responses
                  14 views
                  0 likes
                  Last Post benmarkal  
                  Started by f.saeidi, Today, 01:38 PM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Working...
                  X