Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry Offset

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

    #31
    I corrected my post to refer to a sell. The trigger bar is always the most recent closed one. I turned off backtesting as I was having issues with synchronization.

    I'm very new to this and completely lost. All I know is that I can do what I want (place a buy or sell order at the Close price of a trigger bar) 100% of the time using the SuperDom but can't seem to get anything to work using NinjaScript.

    Using NinjaScript, I can place for example place sell orders if the building bar overlaps the Close of the trigger bar but not in the case where the high of the building bar is equal to the Close of the trigger bar.

    I appreciate your patience.

    Comment


      #32
      Jerry, then you would need to analyze closely what you're doing manually and trying to replicate each step in NinjaScript, being able to execute something manually and then programming this with hard set rules can be quite a task sometimes in the trading arena...have you considered addressing both situations with two different entry order scenarios?

      Comment


        #33
        Bertrand,

        This is my step by step analysis of the SuperDom methodology (it results in a single line of code):

        To Buy - execute a Stop Limit Long order
        • Center click on the Buy Column at a value which is one tick above the Close Price of the trigger bar
        (This is the price that the StopLimit order will be submitted at)
        • Set the Offset value to -1. (This is the number of ticks away for the Limit Price)
        • Click on the check mark to accept the order
        • This works in all cases where the Low of the building bar is less than or equal to the Close of the trigger bar.
        • I believe that the NinjaScript equivalent is:
        EnterLongStopLimit(Close[0] + TickSize, Close[0]);
        With the trigger bars Close price at 1089.00:
        Get Error "stop or buy stoplimit orders can't be placed below the market.
        Affected order: Buy 1 stoplimit @ 1089 x 1089.25" The Strategy was automatically removed from the Indicator on closing the above message.
        The Output Window Shows:
        11/20/2009 6:32:48 AM Entered internal PlaceOrder() method at 11/20/2009 6:32:48 AM: Action=Buy
        OrderType=StopLimit Quantity=1 LimitPrice=1089.25 StopPrice=1089.00 SignalName='' FromEntrySignal='' 11/20/2009 6:32:48 AM CancelAllOrders: BarsInProgress=0 11/20/2009 6:32:48 AM CancelAllOrders: BarsInProgress=0
        • Using the code:
        EnterLongLimit(Close[0]);
        works for the case where the High of the building bar overlaps the Close of the trigger bar but I believe not in the case where they are equal (haven't had a test case as in below)

        To Sell - execute a Stop Limit Short order
        • Center click on the Sell Column at a value which is one tick below the Close Price of the trigger bar
        (This is the price that the StopLimit order will be submitted at)
        • Set the Offset value to -1. (This is the number of ticks away for the Limit Price)
        • Click on the check mark to accept the order
        • This works in all cases where the High of the building bar is greater than or equal to the Close of the trigger bar.
        • I believe that the NinjaScript equivalent is:
        EnterShortStopLimit(Close[0] - TickSize, Close[0]);
        • Using this script with the Trigger Bar Close at 1089.50 The order isn't executed and times out.
        The Output Window Shows:
        11/20/2009 7:05:18 AM Entered internal PlaceOrder() method at 11/20/2009 7:05:18 AM: Action=SellShort OrderType=Limit Quantity=1 LimitPrice=1088.50 StopPrice=0 SignalName='' FromEntrySignal='' 11/20/2009 7:05:18 AM Entered internal PlaceOrder() method at 11/20/2009 7:05:18 AM: Action=SellShort OrderType=StopLimit Quantity=1 LimitPrice=1088.75 StopPrice=1088.50 SignalName='' FromEntrySignal='' 11/20/2009 7:05:18 AM Ignored PlaceOrder() method at 11/20/2009 7:05:18 AM: Action=SellShort OrderType=StopLimit Quantity=1 LimitPrice=1088.75 StopPrice=1088.50 SignalName='Sell short' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties' 11/20/2009 7:05:50 AM Cancelled expired order: BarsInProgress=0: Order='fdb5887efc6444e4a3216d4a9b4a73a6/Sim101' Name='Sell short' State=Working Instrument='ES 12-09' Action=SellShort Limit price=1088.5 Stop price=0 Quantity=1 Strategy='GVsLynnDeesCriteria4RB1C9S8T' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='fdb5887efc6444e4a3216d4a9b4a73a6' Gtd='12/1/2099 12:00:00 AM'
        • Using the code:
        EnterShortLimit(Close[0]);
        works for the case where the High of the building bar overlaps the Close of the trigger bar doesn't place an order if the High of the building bar is equal to the Close of the trigger bar.
        Last edited by jerryvellutini; 11-20-2009, 06:46 PM.

        Comment


          #34
          Jerry, I followed your steps and noticed simple. Please review the attached screenshot and observe how the limit price is less than the stop price for longs (vice-versa for shorts).

          I believe the following code will do what you're looking for:
          Code:
          EnterLongStopLimit(Close[0] - TickSize, Close[0]);
          EDIT: I just re-read the thread and saw you've already tried that. Maybe something like this?
          Code:
          EnterLongStopLimit(GetCurrentBid(), GetCurrentAsk());
          Or even:
          Code:
          EnterLongStopLimit(GetCurrentAsk(), GetCurrentAsk() + TickSize));
          Point is: long stop orders need to be placed above the current market.
          Attached Files
          Last edited by NinjaTrader_Austin; 11-20-2009, 05:54 PM.
          AustinNinjaTrader Customer Service

          Comment


            #35
            EnterShortStopLimit(GetCurrentBid(), GetCurrentAsk()); Sells at Close of trigger bar minus 1 tick for both cases.

            EnterShortStopLimit(GetCurrentAsk(), GetCurrentAsk() - TickSize); Gives error "Limit price can't be greater than stop price" in both cases.

            I want to sell at Close of trigger bar for both cases (case1 is High of building bar > Close of trigger bar, case2 is High of trigger bar = Close of trigger bar) as is done with the SuperDom.

            I fixed my previous post - had error long vs short in code for sell.

            Comment


              #36
              Originally posted by jerryvellutini View Post
              EnterShortStopLimit(GetCurrentAsk(), GetCurrentAsk() - TickSize);
              If you're looking to short, you would need to use bid prices instead of ask prices:
              Code:
              EnterShortStopLimit(GetCurrentBid(), GetCurrentBid() - TickSize);
              AustinNinjaTrader Customer Service

              Comment


                #37
                EnterShortStopLimit(GetCurrentBid(), GetCurrentBid() - TickSize);

                Gives an error: "Limit price can't be greater than stop price" in both cases

                Comment


                  #38
                  Originally posted by jerryvellutini View Post
                  EnterShortStopLimit(GetCurrentBid(), GetCurrentBid() - TickSize);

                  Gives an error: "Limit price can't be greater than stop price" in both cases
                  My mistake, try:
                  Code:
                  EnterShortStopLimit(GetCurrentBid() - TickSize, GetCurrentBid());
                  AustinNinjaTrader Customer Service

                  Comment


                    #39
                    EnterShortStopLimit(GetCurrentBid() - TickSize, GetCurrentBid());

                    This sells at the Close price of the trigger bar minus one tick for both cases.

                    I want to sell at the Close price of the trigger bar

                    Comment


                      #40
                      Hello,

                      I will have someone reply to you on Monday. Thank you for your patience.
                      DenNinjaTrader Customer Service

                      Comment


                        #41
                        To recap I want to emulate in NinjaScript the following SuperDom actions:

                        For a Buy Trigger
                        • Center click on the Buy Column at a value which is one tick above the Close Price of the trigger bar
                        • Set the Offset value to -1
                        • Click on the check mark to accept the order

                        For a Sell Trigger
                        • Center click on the Sell Column at a value which is one tick below the Close Price of the trigger bar
                        • Set the Offset value to -1
                        • Click on the check mark to accept the order

                        Once the stop price is reached a limit order is placed and filled at the close price of the trigger bar.

                        There was a similar issue in this thread:

                        The solution seemed to be "Limit if Touched"


                        I'm not smart enough to understand it. Is there really no way to do this in NinjaScript?
                        Is his MarketDataType.Ask the same as GetCurrentAsk()?
                        Last edited by jerryvellutini; 11-22-2009, 06:03 PM.

                        Comment


                          #42
                          Jerry, thanks for clarifying - those negative stop limit orders are unfortunately not supported per NinjaScript - you would need to program the order placement in your code manually to submit the correct order at the appropriate time then.

                          Comment


                            #43
                            Bertrand,

                            I think this simulates the SuperDom StopLimit order.

                            if (BuyTrigger == true & (GetCurrentAsk() >= Close[1] + TickSize) )
                            {EnterLongLimit(Close[1]);}
                            if (SellTrigger == true & (GetCurrentBid() <= Close[1] - TickSize))
                            {EnterShortLimit(Close[1]);}


                            Do you agree? See any issues?

                            I'm a Green Horn and feeling insecure.


                            Thanks
                            Last edited by jerryvellutini; 11-23-2009, 04:41 PM.

                            Comment


                              #44
                              Jerry,

                              Close[1] is referring to the previous bar as opposed to the close of the current bar. Not sure if that was intentional or not.
                              Josh P.NinjaTrader Customer Service

                              Comment


                                #45
                                Yes, I have CalculateOnBarClose set to false and want to enter at the close price of the trigger bar (closed)

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                663 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                376 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
                                575 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                580 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X