Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Take Profit executed one tick above price defined.

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

    Take Profit executed one tick above price defined.

    Hi,

    I am trying to set a take profit $0.01 above the buying price (for Long Positions). For this purpose I use the command
    SetProfitTarget(Close[0]+0.01). On execution the profit target is always activated and the position is always closed $0.02
    above the buying price. PS: This is being done in the strategy analyser while backtesting the strategy

    Please check the logs bellow:

    04/01/2018 14:59:49 CurrentBar: 174 Opening Long Position --> Close: 1,25 Previous Bar Close: 1,24 Entry Price: 1,24 Quantity: 806 Stop Loss: 1,23 Profit Target: 1,25
    04/01/2018 14:59:49 CurrentBar: 174 Order executed --> Quantity: 806 Filled: 806 Average Fill Price: 1,23 Action: Buy
    04/01/2018 14:59:49 CurrentBar: 174 Position --> Direction: Long Average Price: 1,23 Quantity: 806
    04/01/2018 14:59:49 CurrentBar: 174 Setting Stop Loss: 1,22
    04/01/2018 14:59:49 Strategy 'TickPreviewStrategyV2/-1': Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Price Value=1,22 IsSimulatedStop=False IsMarketIfTouched=False
    04/01/2018 14:59:49 CurrentBar: 174 Setting Profit Target: 1,24
    04/01/2018 14:59:49 Strategy 'TickPreviewStrategyV2/-1': Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Price Value=1,24 IsSimulatedStop=False IsMarketIfTouched=False
    04/01/2018 14:59:54 CurrentBar: 175 Closing Long Position without stop loss nor take profit! Exit Price: 1,23
    04/01/2018 14:59:54 CurrentBar: 176 Closing Long Position without stop loss nor take profit! Exit Price: 1,23
    04/01/2018 14:59:54 CurrentBar: 177 Closing Long Position without stop loss nor take profit! Exit Price: 1,23
    04/01/2018 14:59:55 CurrentBar: 178 Closing Long Position without stop loss nor take profit! Exit Price: 1,24
    04/01/2018 14:59:55 Strategy 'TickPreviewStrategyV2/-1: Cancelled pending exit order, since associated position is closed, orderId='NT-00011-287' account='Backtest' name='Stop loss' orderState=Working instrument='DELT' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=1.22 quantity=806 tif=Gtc oco='NT-00000-287' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2018-01-04 14:59:49' gtd='2099-12-01' statementDate='2018-01-15'
    04/01/2018 14:59:49 CurrentBar: 178 Order executed --> Quantity: 806 Filled: 806 Average Fill Price: 1,25 Action: Sell
    04/01/2018 14:59:49 CurrentBar: 178 Account: account='Backtest' accountItem=CashValue currency=UsDollar value=*****
    04/01/2018 14:59:55 CurrentBar: 178 Position --> Direction: Flat Average Price: 0 Quantity: 0
    Last edited by Joaquim Cipriano; 02-12-2018, 06:10 PM.

    #2
    Hello Joaquim Cipriano,

    Thanks for additional inquiry.

    This issue might be related to setting the Profit Target and Stop Loss before the entry is fired. I've gone a bit more into detail in your other thread here: https://ninjatrader.com/support/foru...d.php?t=107789

    Another item to note is if you are backtesting against a single tick data series or using High Order Fill Resolution to fill orders against a single tick data series. NinjaTrader will rely on a "tick through" to signal a bar close and this has the effect of having limit orders fill one additional tick in the favorable direction. This can be worked around with the option "Fill Limit Orders On Touch."

    Fill Limit Orders On Touch and other backtesting options can be referenced here: https://ninjatrader.com/support/help...testProperties

    If this information does not resolve your inquiry, could you provide a reduced strategy that only demonstrates the issue you are running into so we could give a clearer explanation of what you are encountering?
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks, Jim. Your answer was enough to solve my problem. Kind Regards.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by RubenCazorla, Today, 09:07 AM
      2 responses
      11 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by i019945nj, 12-14-2023, 06:41 AM
      7 responses
      81 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by timmbbo, 07-05-2023, 10:21 PM
      4 responses
      158 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by tkaboris, Today, 08:01 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Lumbeezl, 01-11-2022, 06:50 PM
      31 responses
      818 views
      1 like
      Last Post NinjaTrader_Adrian  
      Working...
      X