Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue with SetProfitTarget

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

    Issue with SetProfitTarget

    Hi,

    I send a market order at the begining of the last 15 min bar of yesterday, with a setprofitarget of 50 points. If today the session starts with a big gap (more than 50 points), shouldn't the order be closed at the open price? For some reason is closed at 50 points (in the middle of the gap)

    I use exitonclose =false;

    Please, check the chart.


    Thanks in advanced
    Attached Files

    #2
    Hello "CJS",

    Thank you for your post.

    Please send me your log and trace files for today so that I may look into what occurred.

    You can do this by going to the Control Center-> Help-> Mail to Support.

    Please put 'ATTN: Patrick' in the subject line and reference this thread in the body of the email: http://www.ninjatrader.com/support/f...ad.php?t=55754

    I look forward to your response.

    Comment


      #3
      Hi,

      Thanks for the reply.

      This is a back test (not live trading). What do I have to do to send you the log and trace files?. You mean I put the TraceOrders=true; in the initialize() and send you the text file?

      Thanks

      Comment


        #4
        ok, I follow your instructions and I sent them to you,



        Thanks

        Comment


          #5
          Hello "CJS",

          Thank you for those files.

          In the Strategy Analyzer can you take a screenshot of the Trades tab with the trade shown so I may investigate this matter further? Make sure the Entry and Exit Price columns in view and the prices are clearly listed.

          I look forward to your response.

          Comment


            #6
            Hi,

            Here it is a chart with the trade of the 16/02/2012.
            I have include the trades tab.

            The weird thing is that the issue only happens with the SetProfitTarget, the SetStopLoss is working fine.


            Thanks in advanced
            Attached Files

            Comment


              #7
              Hello "CJS",

              Thank you for your response.

              I will respond to your e-mail to support[at]ninjatrader[dot]com requesting a toy version of your script and your database file.

              I look forward to assisting you further.

              Comment


                #8
                Hello "CJS",

                Thank you for your patience.

                I was unable to test this instrument on your strategy on my end as I do have the historical data for this instrument.

                However, this may come down to the Historical Fill Processing setting for the Backtest. On your Backtest settings are you using Liberal or Default? If you are using Default for the Historical Fill Processing please switch to Liberal.

                For information on Default and Liberal Historical Fill Processing please visit the following link and the 'Understanding historical processing options' section: http://www.ninjatrader.com/support/h...a_strategy.htm

                Please let me know if I may be fo further assistance.

                Comment


                  #9
                  Hi,

                  Thanks for your valuable time.

                  I have test the strategy against the FDAX and the problem persists.

                  I don't understant why this is happening. Clearly, is s filltype issue. Change from deffault to liberal is not good enought, since trigguers right at the low of the next bar. Sometimes, that low is quite far from de open (level at which should triggers).

                  Well, I'll try to create a custom filltype. However, it seems that this shuold be solved easily.

                  Could be a bug of the plattform?

                  Comment


                    #10
                    Hello "CJS",

                    Thank you for your response.

                    This would not be bug in the fill algorithm, this is designed behavior from within the @DefaultFillType.cs and the @LiberalFillType.cs.

                    You can view this code by going to the following directory on your PC > (My) Documents\NinjaTrader 7\bin\Custom\Type > open the '@DefaultFillType.cs' file or '@LiberalFillType.cs' file to view it's code.

                    The first item you ran into was designed to behave that way as you can see within the @DefaultFillType.cs file:
                    Code:
                    else if (order.OrderType == OrderType.Limit)
                    			{
                    				// Orders are filled when traded through the limit price not at the limit price
                    				double nextLow	= NextLow;
                    				double nextHigh = NextHigh;
                    				if ((order.OrderAction == Cbi.OrderAction.Buy					&& order.LimitPrice > nextLow + epsilon)
                    						|| (order.OrderAction == Cbi.OrderAction.BuyToCover	&& order.LimitPrice > nextLow + epsilon)
                    						|| (order.OrderAction == Cbi.OrderAction.Sell			&& order.LimitPrice < nextHigh - epsilon)
                    						|| (order.OrderAction == Cbi.OrderAction.SellShort	&& order.LimitPrice < nextHigh - epsilon))
                    					FillPrice = order.LimitPrice;
                    Then when you switched to Liberal you experienced the following designed behavior:
                    Code:
                    else if (order.OrderType == OrderType.Limit)
                    			{
                    				// Orders are filled when traded through the limit price not at the limit price
                    				double nextLow	= NextLow;
                    				double nextHigh = NextHigh;
                    				if ((order.OrderAction == Cbi.OrderAction.Buy					&& order.LimitPrice >= nextLow - epsilon)
                    						|| (order.OrderAction == Cbi.OrderAction.BuyToCover	&& order.LimitPrice >= nextLow - epsilon)
                    						|| (order.OrderAction == Cbi.OrderAction.Sell			&& order.LimitPrice <= nextHigh + epsilon)
                    						|| (order.OrderAction == Cbi.OrderAction.SellShort	&& order.LimitPrice <= nextHigh + epsilon))
                    					FillPrice = (order.OrderAction == Cbi.OrderAction.Buy || order.OrderAction == Cbi.OrderAction.BuyToCover) ? Math.Min(order.LimitPrice, nextHigh) : Math.Max(order.LimitPrice, nextLow);
                    If you wish to create your own custom fill algorithm please visit the following link: http://www.ninjatrader.com/support/h...fill_types.htm

                    Please let me know if I may be of further assistance.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    670 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    379 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    111 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
                    582 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X