View Full Version : Problem with orders
In my trading system I've buy/sell limit orders and only a stoploss and a takeprofit once the position is established.
So I expect to see only one order to buy or to sell and this is what usually happens on the system. The strange thing is that sometime it appears another order (close position, as you can see in the attachment) that duplicates my entry order without any reason.
What is the close position that is not in the code?
If you need I can send the full code in a private message.
Thanks.
NinjaTrader_Ray
01-03-2007, 01:23 AM
Max,
Send me privately the code and an image of the strategy dialogue window when applying the strategy to a chart. Also let me know the time frame (10 tick I think) and if this can be reproduced in backtest or only live trading. Thanks.
NinjaTrader_Ray
01-03-2007, 06:55 AM
Max,
After further review, the strategy is operating as designed. I will add some information to the documentation laterdown the road to better explain this.
For example:
Lets say your strategy is currently long and you have a stop and target working in the market.
Your strategy now generates a sell limit entry order. So you now have three working orders, stop/target to exit long position and a sell limit entry.
A) If the sell limit entry is filled, NT will cancel the stop/target and issue a "CLOSE" order to close the long position.
B) If the stop is filled, NT will cancel the target and leave your pending sell limit entry working
C) If the target is filled, NT will cancel teh stop and leave your pendign sell limit entry working
Hope that makes sense. If you are looking for a different behaviour, please let me know and I can provide some suggestions.
One tip: You do not need to check for market position since the method EnterLongLimit() already does that for you internally. If a long position already exists, this method just returns.
Ray
Thanks for the explanation.
One tip: You do not need to check for market position since the method EnterLongLimit() already does that for you internally. If a long position already exists, this method just returns.
Does this avoid to re-enter on the same bar if the position has been stopped out?
Thanks.
NinjaTrader_Ray
01-03-2007, 10:47 AM
Yes it would avoid re-entry on the same bar if your strategy is running with the property "Calculate on bar close = true". If set to false, system is evaluated tick by tick and signals can generate on the same bar.
Additional information: The properties "Entries per direction" and "Entry handling" control the internal logic of the Enter() methods.
Example 1:
Entries per direction = 1
Entry handling = AllEntries
Then EnterLongLimit() will be ignored if a long position already exists or if another entry order is pending.
Example 2:
Entries per direction = 1
Entry handling = UniqueEntries
Then EnterLongLimit() will be ignored if a long position already exists that was entered with the same signal name. So if you call the method twice each with unique signal name, then two entry orders can be generated.
Ray