Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Any shortcut to EnterLong/EnterShort?

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

    Any shortcut to EnterLong/EnterShort?

    `SubmitOrder` has a nice feature, to pass variables, like



    oAction= condition ? orderAction.Buy : orderAction.Sell;
    SubmitOrder(.... oAction ... )..

    I want to achieve similar with managed orders, so, there should be need to use separate functions (like I am using at this moment):
    Code:
    if( Condition) {
        EnterLong(....); // <------  "long" appears inside FUNCTION name
    }
    else {
        EnterShort(....); // <------ "short" appears inside FUNCTION name
    }
    is there any built-in function to solve that (i know that i can create a hard-coded my custom method, but i wish built-in alternative), like i could:

    i.e.
    action = "enter";
    direction= "short";
    ExecuteTrade(action , direction ) ; // instead of EnterShort()
    Last edited by ttodua; 09-10-2017, 07:30 AM.

    #2
    Hello selnomeria,

    OrderAction is an enum. Use this as you would any other enum.

    Code:
    OrderAction  ordersAction = OrderAction.Buy;
    
    SubmitOrder(0, [B]ordersAction[/B], OrderType.Market, 1, 0, 0, string.Empty, string.Empty);
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello selnomeria,

      OrderAction is an enum. Use this as you would any other enum.

      Code:
      OrderAction  ordersAction = OrderAction.Buy;
      
      SubmitOrder(0, [B]ordersAction[/B], OrderType.Market, 1, 0, 0, string.Empty, string.Empty);
      But i say that I want to do like that variable with MANAGED orders, and SubmitOrder is for Unmanaged orders, right?

      Comment


        #4
        Hi selnomeria,

        Yes, SubmitOrder() is used for the unmanaged approach and cannot be used with the managed approach.

        With the managed approach the OrderAction is not used at all.

        Simply call the method you want to use to place an order with such as EnterLong() or EnterShort().

        Below are publicly available links to the help guide.



        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          i know them, thanks.
          i just wanted to know if there was available what i wanted, however, you could simple say "no", and that could be enough for me. thanks! I will create a custom method, which will execute specific function with passed string argument, like: MyOrdderFunc("long",....)

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          566 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          329 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          547 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          548 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X