Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Orders with time limit

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

    Orders with time limit

    Hello,

    I am creating my strategy. After my coditions are true I want to place a stop order to open transaction but with time limit. The order must be valid only one bar after conditions are true. I don't know how to do that. Can I do that in strategy wizard? If yes, can you help me?

    #2
    Hello DanielJ,

    This is the default behavior for stop orders. They are cancelled if they are not filled on the bar they're submitted on.

    If you wanted to change this behavior and issue cancel commands manually, you must work with code and this is considered advanced programming. A sample on this is available here:
    Strategy: Using CancelOrder() method to cancel orders
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ok,

      can you help me with this. I have created simply strategy based on insidebar and violating high of the insidebar. After violating I want to open stop order one tick above high of the insidebar. The problem is the orders aren't place but they should be.


      This is the code of this simply strategy.



      This is the code:

      protected override void Initialize()
      {
      SetStopLoss("", CalculationMode.Ticks, 100, true);
      SetProfitTarget("", CalculationMode.Ticks, 100);

      CalculateOnBarClose = true;
      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {
      // Condition set 1
      if (High[1] < High[2]
      && Low[1] > Low[2])
      {
      EnterLongStop(DefaultQuantity, High[1] + 1 * TickSize, "");
      }
      }

      Comment


        #4
        Sorry for question, it is working now.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,789 views
        0 likes
        Last Post aligator  
        Started by Jimmyk, 01-26-2018, 05:19 AM
        6 responses
        837 views
        0 likes
        Last Post emuns
        by emuns
         
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,293 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        13 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        63 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X