Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry Offset

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

    Entry Offset

    Is it possible to program a NinjaScript strategy to enter with a specified offset as can be done with the SuperDom?

    #2
    jerryvellutini,

    That would need to be programmed into the strategy logic with limit prices.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      can you give me a clue? This is what I have:

      // Condition set 1
      if (GVsLynnDeesCriteria().Plot0[0] > 0.5)
      {
      EnterLong();
      }

      // Condition set 2
      if (GVsLynnDeesCriteria().Plot1[0] > 0.5)
      {
      EnterShort();
      }

      Comment


        #4
        Please describe exactly what you want offset and offset from what to what?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I'm using range bars. The way the current code works is it enters the trade at the close value of the trigger bar + 1 tick for buy orders and - one tick for sell orders. I want the order to be placed at the close price. This is done in the SuperDom by entering to buy at the close price + 0.25 with an offset 0f -1 and entering to sell at the close price - 0.25 with an offset of -1.

          Comment


            #6
            Jerry, for this you would need to place a stop limit order in your strategy where you can then designate at which price to place / park the order -

            Comment


              #7
              I can't get this to work. I'm still working with range bars and trying to emulate manual trading with the SuperDom where I buy at the close of the trigger bar + 0.25 with an offset of -1. The order gets placed at the close of the trigger bar price.

              I've tried things like:

              EnterLongStopLimit(Close[0] - TickSize, Close[0]);

              Nothing works.

              Comment


                #8
                I'm not sure I exactly follow what 'does not work' as you would expect - are you getting any errors or is it not placing the order you would expect in your scenario? In backtesting orders would be placed for the next bar after the condition the triggered...please post the code you used and clarify you would expect it to achieve. Thanks

                Comment


                  #9
                  I'm trying to buy at the close price of the trigger bar, emulating how I would buy manually using the SuperDom. This is the code. I really don't understand this. Get error: Stop limit generatated error "Order Rejected"

                  // This namespace holds all strategies and is required. Do not change it.
                  namespace NinjaTrader.Strategy
                  {
                  /// <summary>
                  /// Triggers a buy when Lynn Dees buy criteria are met
                  /// Triggers a sell when Lynn Dees sel criteria are met
                  /// </summary>
                  [Description("Triggers a buy when Lynn Dees buy criteria are met, a sell when sell criteria are met")]
                  public class GVsToPost : Strategy
                  {
                  #region Variables
                  // Wizard generated variables
                  // User defined variables (add any user defined variables below)
                  #endregion

                  /// <summary>
                  /// This method is used to configure the strategy and is called once before any strategy method is called.
                  /// </summary>
                  protected override void Initialize()
                  {
                  SetStopLoss(CalculationMode.Ticks, 9);
                  SetProfitTarget(CalculationMode.Ticks, 8);

                  CalculateOnBarClose = true;
                  }

                  /// <summary>
                  /// Called on each bar update event (incoming tick)
                  /// </summary>
                  protected override void OnBarUpdate()
                  {
                  // Condition set 1
                  if (GVsLynnDeesCriteria().Plot0[0] > 0.5)
                  {

                  EnterLongStopLimit(Close[0] + TickSize, Close[0]);

                  }

                  // Condition set 2
                  //if (GVsLynnDeesCriteria().Plot1[0] > 0.5)
                  {
                  //EnterShort();
                  }
                  }

                  #region Properties
                  #endregion
                  }
                  }
                  Last edited by jerryvellutini; 11-18-2009, 06:26 AM.

                  Comment


                    #10
                    Jerry can you please provide the full error? It will usually give a reason why it was rejected.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      I thought I replied but I don't see it.

                      The error says:

                      Buy stop or buy stop limit orders can't ne placed below the market.
                      Affected Order: Buy 1 StopLimit @ 1105.25x1105.5

                      The close of the trigger bar was at 1105.25

                      Comment


                        #12
                        Jerry,

                        The reason you are getting that message is because your stop price cannot be below the market. You need the stop price to be submitted above the market.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          My problem is I'm trying to automate what I do all day manually using the SuperDom. I thought this was the right command but obviously not. Can you tell me how you would do it?

                          Thanks

                          Comment


                            #14
                            Jerry,

                            You should not be able to place stop-limit orders with the stop price below the market price even in the DOM. You need to check in your code for valid submission prices. If you go Close[0] + TickSize it is possible in fast markets for the market to move up and make that price you submitted an invalid price below the market. You should not be placing orders so close to the market as this can occur.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              I've been ringing this out with a test case using the Market Replay Connection. If I execute this order manually using the SuperDom it works. The log says Buy
                              Limit Price = 1105.25
                              Stop Price = 1105.50
                              Clearly the Limit Price is less than the Stop Price.

                              I've used this methodology on hundreds of trades and trust me - it works.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              660 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              375 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              110 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              574 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              579 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X