Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automated Limit Order Problem

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

    Automated Limit Order Problem

    Hello,

    I have a intraday strategy that trades the oil futures between regular trading hours (9-2:30est). At first, I set my order entry to just enter on the open of the next bar after the trigger bar. However, although over time the strategy was profitable, I noticed that usually after I got in, the trade would at least go against me by more than 10 ticks. So in the ninja script, I edited enter at market, to enter 10 ticks below the close of the trigger bar for longs, and for shorts vice versa. However as I ran the strategy once more, I noticed that it would only trigger on the NEXT bar, no bars after that. So basically, if I got a trigger at $95.00 to buy, the next bar would have to at least touch $94.90 to trigger my entry. However, if the next bar did NOT fill me, the order would not fill on the other bars, even if no other signal to buy or sell was produced, and it went below $94.90. (See picture attached for more.)

    Basically what I would like is for when I get a buy or sell order (10 cents above or below the trigger bar close, depending on if its a buy or sell), I would like the order to stay in place UNTIL A OPPOSITE signal is created.

    For example, lets say we get a trigger at $95.00 on the close to BUY. My order to BUY would be at $94.90. I would like that order to remain active UNTIL I get a trigger to sell.

    Thank you in advance for your help!

    Julian
    Attached Files

    #2
    Hi Julian,

    Order methods have a signature available that allows you to specify liveUntilCancelled = true. You will have to use this advanced signature, and also consider that you may have to manually cancel at a later point.

    Here is method signature:
    EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName)

    For help cancelling orders, this reference sample is available:
    When using NinjaTrader's Enter() and Exit() methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      lol unfortunately I have no programming experience so I have no idea what you mean. Where can I specify True for liveUntilCancelled

      Comment


        #4
        This scenario requires custom programming to set the liveUntilCancelled. An example would be something like this:

        EnterLongLimit(0, true, 1, Low[0] - TickSize * 10, "");

        To get the control needed for cancelling a liveUntilCancelled order, you have to work with advanced NinjaScript order handling. This link can help with this:
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          ok but how would I go about makign my order a live until cancelled.

          Comment


            #6
            You specify true where it's expected, like in the last two examples. Unfortunately can't get around that this requires custom programming. If you have limited time or programming experience, a NinjaScript consultant can assist to develop a strategy to your specifications.

            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            2 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            1 view
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            6 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            10 views
            0 likes
            Last Post bltdavid  
            Working...
            X