Context: Market Replay using simulated orders
Trade: Sell 1 EURJPY @ market (150.3) Stop Ticks 250, Target Ticks 600
Description: Trade entered successfully. The target was met at 149.7 using the bid price rather than the ask price.
I've included part of my log, the NT log and the output window. First up is my log which shows a sell entered using the bid price. To close the position the ask price should be used but for some reason it appears the NT uses the bid price. NB: Longs work correctly
My log file
17/9 21:15:00 Bid: 150.3, Ask: 150.36
17/9 21:15:00 Enter at: 21:15:00 Indicator: MySignal. Sell Entered: 150.3, Stop: 150.55, Limit: 149.7
[snip]
17/9 21:30:36 Bid: 149.74, Ask: 149.793
17/9 21:30:36 Target Price: 149.7, Ask: 149.793
17/9 21:30:37 Bid: 149.74, Ask: 149.79
17/9 21:30:37 Target Price: 149.7, Ask: 149.79
17/9 21:30:37 Bid: 149.74, Ask: 149.78
17/9 21:30:37 Target Price: 149.7, Ask: 149.78
17/9 21:30:37 Bid: 149.73, Ask: 149.78
17/9 21:30:37 Target Price: 149.7, Ask: 149.78
17/9 21:30:37 Bid: 149.73, Ask: 149.78
17/9 21:30:37 Target Price: 149.7, Ask: 149.78
17/9 21:30:37 Bid: 149.73, Ask: 149.77
17/9 21:30:37 Target Price: 149.7, Ask: 149.77
17/9 21:30:38 Bid: 149.72, Ask: 149.77
17/9 21:30:38 Target Price: 149.7, Ask: 149.77
17/9 21:30:38 Bid: 149.72, Ask: 149.76
17/9 21:30:38 Target Price: 149.7, Ask: 149.76
17/9 21:30:38 Bid: 149.7, Ask: 149.76
17/9 21:30:38 Target Price: 149.7, Ask: 149.76
17/9 21:30:38 Bid: 149.7, Ask: 149.76
17/9 21:30:38 Target Price: 149.7, Ask: 149.76
17/9 21:30:41 Bid: 149.7, Ask: 149.75
17/9 21:30:41 Target Price: 149.7, Ask: 149.75
17/9 21:30:41 Bid: 149.7, Ask: 149.75
17/9 21:30:41 Target Price: 149.7, Ask: 149.75
17/9 21:30:42 Bid: 149.7, Ask: 149.75 This is the time that NT says the position was closed. It incorrectly used the bid side
[snip]
17/9 22:07:32 Bid: 149.65, Ask: 149.76
17/9 22:07:32 Target Price: 149.7, Ask: 149.76
17/9 22:07:34 Bid: 149.64, Ask: 149.75
17/9 22:07:34 Target Price: 149.7, Ask: 149.75
17/9 22:07:51 Bid: 149.617, Ask: 149.71
17/9 22:07:51 Target Price: 149.7, Ask: 149.71
17/9 22:07:53 Bid: 149.6, Ask: 149.71
17/9 22:07:53 Target Price: 149.7, Ask: 149.71
17/9 22:07:54 Bid: 149.6, Ask: 149.698
17/9 22:07:54 Target Price: 149.7, Ask: 149.698
17/9 22:07:54 Exit Price: 149.698, Profit: 60.20, Duration: 0:52:54, Enter at: 21:15:00 Indicator: MySignal. Sell Entered: 150.3, Stop: 150.55, Limit: 149.7
This is the time my alog closed the postion
Here are the NT logs and output window to confirm the time the position was entered and closed (see the last line for the close time).
NT Log
04/10/2008 15:12:59|1|4|Simulation account 'Replay101' reset
04/10/2008 15:12:59|1|128|Starting NinjaScript strategy 'MyCustomStrategy/2908133e757d433393e4a1b8eb051263' : On starting a real-time strategy - StrategySync=SubmitLive EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=TakeNoAction ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy
04/10/2008 15:13:16|1|32|Order='738200ac33e843e5b9de46d83a775 a7f/Replay101' Name='MySignal' New State=PendingSubmit Instrument='$EURJPY' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:16|1|32|Order='738200ac33e843e5b9de46d83a775 a7f/Replay101' Name='MySignal' New State=Accepted Instrument='$EURJPY' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:16|1|32|Order='738200ac33e843e5b9de46d83a775 a7f/Replay101' Name='MySignal' New State=Working Instrument='$EURJPY' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:16|1|32|Order='738200ac33e843e5b9de46d83a775 a7f/Replay101' Name='MySignal' New State=Filled Instrument='$EURJPY' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=1 Fill price=150.3 Error=NoError Native error=''
04/10/2008 15:13:16|1|16|Execution='fa83979b845447d086eacaaa7 d488f21' Instrument='$EURJPY' Account='Replay101' Exchange=Default Price=150.3 Quantity=1 Market position=Short Operation=Insert Order='738200ac33e843e5b9de46d83a775a7f' Time='17/09/2008 21:15:00' Multiplier=0.001 Rate=0.00954608371915422
04/10/2008 15:13:16|1|64|Instrument='$EURJPY' Account='Replay101' Avg price=150.3 Quantity=1 Market position=Short Operation=Insert Currency=Unknown
04/10/2008 15:13:16|1|32|Order='74467fe38108437e9ef5af560e529 87a/Replay101' Name='Stop loss' New State=PendingSubmit Instrument='$EURJPY' Action=BuyToCover Limit price=0 Stop price=150.55 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:16|1|32|Order='74467fe38108437e9ef5af560e529 87a/Replay101' Name='Stop loss' New State=Accepted Instrument='$EURJPY' Action=BuyToCover Limit price=0 Stop price=150.55 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:16|1|32|Order='9a7173b5fb404bb395713174a51be b60/Replay101' Name='Profit target' New State=PendingSubmit Instrument='$EURJPY' Action=BuyToCover Limit price=149.7 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:16|1|32|Order='9a7173b5fb404bb395713174a51be b60/Replay101' Name='Profit target' New State=Accepted Instrument='$EURJPY' Action=BuyToCover Limit price=149.7 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:16|1|32|Order='9a7173b5fb404bb395713174a51be b60/Replay101' Name='Profit target' New State=Working Instrument='$EURJPY' Action=BuyToCover Limit price=149.7 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:18|1|32|Order='9a7173b5fb404bb395713174a51be b60/Replay101' Name='Profit target' New State=Filled Instrument='$EURJPY' Action=BuyToCover Limit price=149.7 Stop price=0 Quantity=1 Type=Limit Filled=1 Fill price=149.7 Error=NoError Native error=''
04/10/2008 15:13:18|1|32|Order='74467fe38108437e9ef5af560e529 87a/Replay101' Name='Stop loss' New State=PendingCancel Instrument='$EURJPY' Action=BuyToCover Limit price=0 Stop price=150.55 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:18|1|32|Order='74467fe38108437e9ef5af560e529 87a/Replay101' Name='Stop loss' New State=Cancelled Instrument='$EURJPY' Action=BuyToCover Limit price=0 Stop price=150.55 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
04/10/2008 15:13:18|1|16|Execution='6822526c88cc4ff69f6ca2567 339ad23' Instrument='$EURJPY' Account='Replay101' Exchange=Default Price=149.7 Quantity=1 Market position=Long Operation=Insert Order='9a7173b5fb404bb395713174a51beb60' Time='17/09/2008 21:30:42' Multiplier=0.001 Rate=0.00956480153036825
04/10/2008 15:13:18|1|64|Instrument='$EURJPY' Account='Replay101' Avg price=149.7 Quantity=0 Market position=Short Operation=Remove Currency=Unknown
Output Window
17/09/2008 21:15:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=250 Currency=0 Simulated=False
17/09/2008 21:15:00 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=600 Currency=0 Simulated=False
17/9 21:15:00 $EURJPY Sell 1 @ 150.3. Stop Tick: 250, Limit Tick: 600, Signal: MySignal
17/09/2008 21:15:00 Entered internal PlaceOrder() method at 17/09/2008 21:15:00: Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='MySignal' FromEntrySignal=''
17/9 21:15:00 $EURJPY Order: 738200ac33e843e5b9de46d83a775a7f, State: PendingSubmit
17/9 21:15:00 $EURJPY Order: 738200ac33e843e5b9de46d83a775a7f, State: Accepted
17/9 21:15:00 $EURJPY Order: 738200ac33e843e5b9de46d83a775a7f, State: Working
17/9 21:15:00 $EURJPY Order: 74467fe38108437e9ef5af560e52987a, State: PendingSubmit
17/9 21:15:00 $EURJPY Order: 74467fe38108437e9ef5af560e52987a, State: Accepted
17/9 21:15:00 $EURJPY Order: 9a7173b5fb404bb395713174a51beb60, State: PendingSubmit
17/9 21:15:00 $EURJPY Order: 9a7173b5fb404bb395713174a51beb60, State: Accepted
17/9 21:15:00 $EURJPY Order: 9a7173b5fb404bb395713174a51beb60, State: Working
17/9 21:15:00 $EURJPY Order: 738200ac33e843e5b9de46d83a775a7f, State: Filled
17/9 21:15:00 $EURJPY Fill: SellShort 1 @ 150.3, time: 21:15:00, order id:
17/9 21:30:42 $EURJPY Order: 74467fe38108437e9ef5af560e52987a, State: PendingCancel
17/9 21:30:42 $EURJPY Order: 74467fe38108437e9ef5af560e52987a, State: Cancelled
17/9 21:30:42 $EURJPY Order: 9a7173b5fb404bb395713174a51beb60, State: Filled
17/9 21:30:42 $EURJPY Fill: BuyToCover 1 @ 149.7, time: 21:30:42, order id: MySignal
Comment