Bad start for second week NT live.
After sorting trough the log I have the following questions.
I have a basic EMA crossover resulting in a EnterLong and a separate exit ExitLong tied to the EnterLong via the name Entry_L. (and similar setup for the short side)
if (A) -> EnterLong(1,DefaultQuantity, "Entry_L");
if (B) -> ExitLong(1, Position.Quantity, "Exit_L", "Entry_L");
if (C) -> EnterShort(1,DefaultQuantity, "Entry_S");
if (D) -> ExitShort(1, Position.Quantity, "Exit_S","Entry_S");
1. If I use 'calculate at bar close=true' apparently condition B and C can be hit at the same time or during the same bar.
Apparently NT started 3 actions (I see 3 submits in the log): a.Exit the long Exit_L, b.Close position Long and c.Entry_S order
This resulted in a double position short, although 'entries per direction=1.
Is this is normal behavior? Can 'entries per direction' see the other orders if they result from the same bar?
2. I tried using the MarketReplay and added market position statements (removed them last week as I thought they replicated the effect of 'entries per direction=1'.
if (A) && Position.MarketPosition != MarketPosition.Long -> EnterLong(1,DefaultQuantity, "Entry_L");
if (B) && Position.MarketPosition == MarketPosition.Long -> ExitLong(1, Position.Quantity, "Exit_L", "Entry_L");
if (C) && Position.MarketPosition != MarketPosition.Short -> EnterShort(1,DefaultQuantity, "Entry_S");
if (D) && Position.MarketPosition == MarketPosition.Short -> ExitLong(1, Position.Quantity, "Exit_S", "Entry_S");
However I get still instances in marketreplay with the double positions when using 'bar close true'.
So far I can see with 'bar close false' appears to be ok.... but the strategy is not backtested in that state.
Is it then that when the 'Market.Position-rules' for Band C are called at the same time, NT does not yet see the result of the closing of the position via rule C and also executes rule B which puts me on 2 positions short?
If so why is this not prevented via the 'Entries per direction=1'?
3. I use Position.Quantity in 'ExitLong(1, Position.Quantity, "Exit_L", "Entry_L")' to make the strategy exit the right number of shares.
If I don't use this the strategy will sell 1 share only as it sees the 1 of the addes BarsArray timeframe as number of shares.
Is this the right way or are there simpler methods to convey the number of shares bought via DefaultQuantity? Can you e.g. use " " or empty space between ,,?
4. In the logfile I see that the term position is used in two ways.
Position in the 'category-column' apparently sees the AccountPosition.
The statement under the 'message column' states the Market Position, e.g. MarketPosition=Long. I assume this is the state the strategy calculated it is in.
I see e.g an instance under message ... Quantity=0 Market position=Long. I assume caused by my start problem. Is there a way to check this?
I would see this as a potential internal check that if Quantity=0 and MarketPosition is NotFlat .... there is obviously something very wrong.
Can I check for this and is so via which code?
e.g. If AccountPosition=0 and MarketPosition != MarketPosition.Flat, return.
5. I see several "warnings related to outside trading hours" in the log. I read in older forum posts this does not influence the execution.
Ok, but my PC is on US time and the instruments concerned are ETF's at ARCA, so all is well within the normal trading hours. So why the warnings?
6. I a1so found yesterday I had bought 100 shared of PKD. I could not remember if I put a low-ball long term bid in for this, but the log is very weird.... why does the second line refer to SLW instead on PKD??
Do these numbers tell you if this comes from NT or was started by TWS??
21/2009 10:50 Execution Execution='PKD/00011fb1.49773a9e.01.01' Instrument='PKD' Account='U523265' Exchange=Nyse Price=2.55 Quantity=100 Market position=Long Operation=Insert Order='554773528' Time='1/21/2009 10:50:25 AM'
1/21/2009 10:50 Order Order='554773528/U523265' Name='External' New State=Filled Instrument='SLW' Action=Buy Limit price=2.55 Stop price=0 Quantity=100 Type=Limit Filled=100 Fill price=2.55 Error=NoError Native error=''
1/21/2009 10:50 Position Instrument='PKD' Account='U523265' Avg price=2.56 Quantity=100 Market position=Long Operation=Insert Currency=UsDollar
A big list, thanks.
Comment