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 sjsj2732, 03-23-2026, 04:31 AM
          0 responses
          76 views
          0 likes
          Last Post sjsj2732  
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          313 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          312 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          149 views
          1 like
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          113 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Working...
          X