• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buy/Sell 4 ticks below/above entry order

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

    Buy/Sell 4 ticks below/above entry order

    Hello,

    My strategy (already coded) buys/sells when stochastics is below 10 or above 90 respectively, what would be the code to insert if I want the strategy to actually buy 4 ticks below the actual order or sell 4 ticks above.

    Could anybody give me a hint?

    Thanks,

    Alan

    #2
    futuros, you mean then to have a price move confirm or deny the signal? So placing for example a StopMarket / StopLimit order 4 ticks above or below the signal bar extremes?

    The different order types and Enter() methods for using those would be discussed in this tip -

    http://www.ninjatrader.com/support/f...ead.php?t=3271
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      Yes, exactly, StopLimit order 4 ticks above or below the signal bar extremes...do you have an example (already coded in some other strategy) that I can use?

      Thanks...

      Comment


        #4
        I have attached a small example for you, this will place a stop limit order for the next bar after our condition to enter (here close crossing the prior day high) occurred. If it would not fill on the bar it was submitted on > it would expire. If you want to persist the order longer you can unlock the wizard code and use liveUntilCancelled and then CancelOrder() after a certain # of bars. The following sample will show how that could be approached -

        http://www.ninjatrader.com/support/f...ad.php?t=18890
        Attached Files
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Bertrand, in this example that you sent me is my understanding that the strategy is buying X amount of ticks above the signal? (High[0] + Offset * TickSize)

          What I actually want is to buy x amount of ticks below the signal bar, so my code would be: EnterLongLimit(DefaultQuantity, Low[0] - Offset * TickSize, Low[0] - Offset * TickSize, "EnterLSL");

          Am I right?

          Thanks for your help...

          Comment


            #6
            Your understanding is correct for my example given. You can then instead work with a normal limit (EnterLongLimit) order that you place for the entry then at Low[0] - your offset (4 * TickSize).

            The same order expiration considerations would apply though (for any non market order in our managed mode).
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Bertrand, what is the "offset" refers to? can I avoid the offset? Like this maybe:

              EnterLongLimit(DefaultQuantity, Low[0] - 4 * TickSize, Low[0] - 4 * TickSize, "EnterLong");

              or if I have to "keep" the offset, can I place your same code in the properties region?

              [Description("StopLimitOffset")]
              [GridCategory("Parameters")]
              public int Offset
              {
              get { return offset; }
              set { offset = Math.Max(0, value); }
              }

              Comment


                #8
                You can rename the offset also to something else if you wanted. The limit order will only have one component, the limit price. With the offset you would setup how many ticks away from the signal bars high / low you want the order to be placed then.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Bertrand I don't want to bother you all day, just one last question, if I don't want the "offset" is this line of code correct? : EnterLongLimit(DefaultQuantity, Low[0] - 4 * TickSize, Low[0] - 4 * TickSize, "EnterLong");

                  Comment


                    #10
                    No worries, for the normal limit order use -

                    EnterLongLimit(DefaultQuantity, Low[0] - 4 * TickSize, "EnterLong");

                    There's no stop and limit price here, just the limit price.

                    http://www.ninjatrader.com/support/h...rlonglimit.htm
                    BertrandNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Newtrader101, 02-13-2020, 05:59 PM
                    4 responses
                    34 views
                    0 likes
                    Last Post Newtrader101  
                    Started by tgn55, Today, 09:14 AM
                    0 responses
                    7 views
                    0 likes
                    Last Post tgn55
                    by tgn55
                     
                    Started by mrwarkhan, Yesterday, 03:45 PM
                    1 response
                    23 views
                    0 likes
                    Last Post koganam
                    by koganam
                     
                    Started by onevefiefe, Today, 07:42 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post onevefiefe  
                    Started by J_o_s, Today, 06:09 AM
                    0 responses
                    12 views
                    0 likes
                    Last Post J_o_s
                    by J_o_s
                     
                    Working...
                    X