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
Comment