Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Long order followed by Shot order
Collapse
X
-
solved! i didn't wait enough for confirmation...
i wait for Position.Flat and then transmit the opposite command and now woks well !
Thank you
- Likes 1
-
Hello orenytz ,
Thanks for your post.
With reference to: "when i submit the LONG order and while it's still active i transmit the SHORT order - it ignores the SHORT order and printout: An Enter() method to submit an entry order at '30/09/2019 07:45:00' has been ignored. "
I'm not certain if you are advising that the LONG order was filled and you are in a long position or if the LONG order was waiting to be filled. In either case you would be violating the internal order handling rules:
In the case of the strategy is in a Long position: Here is the internal order handling rule that has been violated: Methods that generate orders to enter a position will be ignored if: A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
In the case where the strategy is flat and the LONG order is not yet filled: Here is the internal order handling rule that has been violated: Methods that generate orders to enter a position will be ignored if: The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
Reference: Please see "Internal Order Handling Rules that Reduce Unwanted Positions" on this page: https://ninjatrader.com/support/help...d_approach.htm
Leave a comment:
-
Long order followed by Shot order
Hello
when is submit the LONG order and the SHORT order separately it works well.
but when i submit the LONG order and while it's still active i transmit the SHORT order - it ignores the SHORT order and printout:
An Enter() method to submit an entry order at '30/09/2019 07:45:00' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.
and the output is wrong. (see attachment: "long and short.png")
In the Managed Approach section you wrote: Entry() methods will reverse the position automatically. For example if you are in a 1 contract long position and now call EnterShort() -> you will see 2 executions, one to close the prior long position and the other to get you into the desired 1 contract short position.
so i expected that the LONG order will be closed immidiatly when the SHORT order will be transmitted. (see attachment: "expected.png")
LONG: (see attachment: "LONG.png")
SetProfitTarget("Long1", CalculationMode.Price, tMngTrade.tBidFactor.dProfitTragetPrice, true);
SetStopLoss("", CalculationMode.Price, tMngTrade.tBidFactor.dStopLossPrice, true);
EnterLongLimit(DefaultQuantity, tMngTrade.tBidFactor.dTradeEntryLimitVal, "Long1"); // meet the profit target
EnterLongLimit(DefaultQuantity, tMngTrade.tBidFactor.dTradeEntryLimitVal, "Long2"); // stay opened while short get in
SHORT: (see attachment: "short.png")
SetProfitTarget("Short1", CalculationMode.Price, tMngTrade.tBidFactor.dProfitTragetPrice, true);
SetStopLoss("", CalculationMode.Price, tMngTrade.tBidFactor.dStopLossPrice, true);
EnterShortLimit(DefaultQuantity, tMngTrade.tBidFactor.dTradeEntryLimitVal, "Short1");
EnterShortLimit(DefaultQuantity, tMngTrade.tBidFactor.dTradeEntryLimitVal, "Short2");
what am i doing wrong ?
Thasnks
Oren
Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pechtri, 06-22-2023, 02:31 AM
|
10 responses
124 views
0 likes
|
Last Post Today, 12:03 AM | ||
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
59 views
0 likes
|
Last Post
by DynamicTest
Yesterday, 08:25 PM
|
||
Started by ScottWalsh, Yesterday, 06:52 PM
|
4 responses
36 views
0 likes
|
Last Post
by ScottWalsh
Yesterday, 07:40 PM
|
||
Started by olisav57, Yesterday, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Yesterday, 07:39 PM
|
||
Started by trilliantrader, Yesterday, 03:01 PM
|
2 responses
22 views
0 likes
|
Last Post
by helpwanted
Yesterday, 07:25 PM
|
Leave a comment: