StopLoss initially set to 60 ticks, second target is 96 ticks. First target is 28 ticks, and if it reaches it, then it moves the SL to Breakeven + 1 tick.
I have NQ 1-min data loaded for 30 days. There are only 3 type of trades I should see.
When it wins both legs, it should look like this:
When it loses both, like this:
And when it wins first, and then hits breakeven, like this:
And most of the historical shows one of those. But then there are also periodic trades like this:
I'll use this last picture as an example.
I have added a great deal of logging code, and for that trade, it looks like this (comments in red, bold):
EA #000 - NQ 12-24 - [OnBarUpdate] - 19-Sep-24 11:16:00 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DOWNWARD CROSS OF 50-LEVEL (20150) on 11:16:00 Candle
ENTERING LONG LIMIT @ 20126
Placed the long limit order ok
EA #000 - NQ 12-24 - [OnExecutionUpdate] - 19-Sep-24 11:17:00 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
execution.IsEntryStrategy = True, execution.Order.OrderAction = Buy, MarketPosition = Long, marketPosition = Long, execution.Order.OrderAction = Buy, quantity = 2
Setting SL (60) for Entry @ 20126 to 20111
Setting TP1 (28) for Entry @ 20126 to 20133
Setting TP2 (96) for Entry @ 20126 to 20150
EA #000 - NQ 12-24 - [OnExecutionUpdate] - 19-Sep-24 11:17:00 - (hits TP1 on entry candle) - - - - - - - - - -
execution.IsEntryStrategy = False, execution.Order.OrderAction = Sell, MarketPosition = Long, marketPosition = Short, execution.Order.OrderAction = Sell, quantity = 1
TRADE CLOSED, price (param) = 20133
Last trade PnL: $136.9
Trade Closed; attempting to adjust SL order quantity to 1. stopOrder.StopPrice = 20111
I re-submit the SL order because one of the two contracts has closed, like this:
ExitLongStopMarket(0, true, Position.Quantity, stopOrder.StopPrice, "StopLoss", "Long");
EA #000 - NQ 12-24 - [OnBarUpdate] - 19-Sep-24 11:17:00 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Before: Stop Price = 20111
*MoveToBE TRIGGERED* because High[0] (20133.75) >= Trigger price @ 20132.75: newStopPrice set to 20126.25. Old stop price = 20111
Calling ExitLongStopMarket(), qty = 1, new SL = 20126.25
After: Stop Price = 20126.25
EA #000 - NQ 12-24 - [OnOrderUpdate] - 19-Sep-24 11:19:00 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(calls OnOrderUpdate 3 times cancelling TP2 before closing the second part of the order next)
OrderState = CancelPending, OrderAction = Sell, OrderType = Limit, limitPrice = 20150
OrderState = CancelSubmitted, OrderAction = Sell, OrderType = Limit, limitPrice = 20150
OrderState = Cancelled, OrderAction = Sell, OrderType = Limit, limitPrice = 20150
EA #000 - NQ 12-24 - [OnExecutionUpdate] - 19-Sep-24 11:19:00 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
execution.IsEntryStrategy = False, execution.Order.OrderAction = Sell, MarketPosition = Flat, marketPosition = Short, execution.Order.OrderAction = Sell, quantity = 1
TRADE CLOSED, price (param) = 20120.5
Closes trade at 20120.50; a price which has nothing to do with anything.
Can any one shed some light on what is happening here?
I have heard the tester on NT8 wasn't terribly accurate, but surely historical can't have that many flaws...?
Comment