Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnterLongLimit... and keep updating that order!

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

    EnterLongLimit... and keep updating that order!

    Hi Ninja Team,

    This one has me scratching my head. I want to EnterLongLimit at the EMA, and have my Limit order update if the EMA rises.

    PHP Code:
    if (goLong)
        {
        
    EnterLongLimit(EMA(8)[0], "Long 1a");
         {
         if (
    Position.MarketPosition == MarketPosition.Flat && EMA(8)[0] > EMA(8)[1])  EnterLongLimit(EMA(8)[0], "Long 1a"); 
         }
     
        } 
    That code doesn't look right... and isn't working. Is there a simple way to do this without going the IOrders route? What I don't want is to cancel/replace on every bar, but instead only cancel/replace the limit entry to the new EMA level if the EMA is rising.

    Thanks!

    #2
    MXASJ, per default orders expire at the next OnBarUpdate(), however you can also send liveUntilCancelled and then just update / resubmit if needed (your limit price changing and still not in position) -

    EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice,string signalName)

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand!

      What's doing my head in is this:

      PHP Code:
      if (goLong)
      {
      EnterLongLimit(0trueposSizeEMA(8)[0], "Long 1a");


      Should work (testing it now), but the EnterLongLimit price will not be resubmitted until goLong == true again, even if the EMA has risen in the mean time. Its like I need seperate logic where:

      if a working limit order is in place and the current EMA(8) is greater than that limit order price, new limit order price = EMA(8)[0].

      That's where I'm wading out of my depth and am open to any and all suggestions. The logic of "if a working order is in place" is where I'm stumbling.

      Thanks.

      Comment


        #4
        I'm not sure how you've setup your GoLong condition, but couldn't perhaps use two conditions, one for the initial setup, and one to adjust then if the EMA value changes - if you submit the limit order again (old one working) it would just amend / change the already working order.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Danke Bertrand,

          I understand and have already been playing with a new "beLong" as well as the existing "goLong" condition.

          One last question though... if my EMA/limit is at, say 1.2575 and on the next bar it is still at 1.2575, will it cancel/replace at the same price (sending me to the back of the queue) or will it be smart enough to know the price has not changed and not cancel/replace?

          I've tried looking at the logs to check the behavior if the bar-to-bar EMA/Limit price remains unchanged but its hard work. Many thanks for your time.

          Comment


            #6
            You're welcome, it should not replace this order then, as there's already an identical one working I believe - best is to enable TraceOrders to look under the 'hood' and debug your individual order behaviour -

            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Graci117, Today, 11:40 PM
            0 responses
            3 views
            0 likes
            Last Post Graci117  
            Started by BIOK.NT, Today, 01:56 PM
            2 responses
            11 views
            0 likes
            Last Post BIOK.NT
            by BIOK.NT
             
            Started by i2ogu3, Today, 11:31 PM
            0 responses
            4 views
            0 likes
            Last Post i2ogu3
            by i2ogu3
             
            Started by RDTrader16, Today, 10:19 PM
            0 responses
            8 views
            0 likes
            Last Post RDTrader16  
            Started by gemify, 03-08-2023, 08:02 AM
            9 responses
            150 views
            0 likes
            Last Post culpepper  
            Working...
            X