The other way is to use Unmanaged Orders, in which case, one can pretty much do whatever one wants with orders. Be warned: if you use Unmanaged Orders, you must take care of all possible scenarios, or blowing up the account is a real, undesired, possible outcome.
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
How to avoid EnterShort/EnterLong closing Long/Short position?
Collapse
X
-
Originally posted by janseun View Post
The other way is to use Unmanaged Orders, in which case, one can pretty much do whatever one wants with orders. Be warned: if you use Unmanaged Orders, you must take care of all possible scenarios, or blowing up the account is a real, undesired, possible outcome.
-
koganam, can you explain more?
I did not think this is possible - simultaneously holding long and short positions in the same instrument?
Leave a comment:
-
Originally posted by NinjaTrader_Jesse View PostHello,
Thank you for the post.
In general, we wouldn't suggest using two strategies for a long and short side as there would be a disconnect between the two strategies. A strategy has a virtual position and is not aware of what the other strategy may be doing which can cause lapses in logic.
For this, I would suggest using the Position object to know when you are in a position to prevent the opposite order logic from happening.
In your conditions to enter, you could do something like the following:
Code:if(Position == MarketPosition.Flat) { // place entry logic here }
I look forward to being of further assistance.
Leave a comment:
-
Hello,
Thank you for the post.
In general, we wouldn't suggest using two strategies for a long and short side as there would be a disconnect between the two strategies. A strategy has a virtual position and is not aware of what the other strategy may be doing which can cause lapses in logic.
For this, I would suggest using the Position object to know when you are in a position to prevent the opposite order logic from happening.
In your conditions to enter, you could do something like the following:
Code:if(Position == MarketPosition.Flat) { // place entry logic here }
I look forward to being of further assistance.
Leave a comment:
-
Originally posted by mic414 View PostI have two criteria in my script, one for going long, one for going short on the same instrument. I want my positions only closed when they reach profit target or stop loss.
Let's say Long Criteria was triggered and I have a long position. At a later point in time, the Short Criteria is triggered, and EnterShort is being executed. The problem is that EnterShort will fully close my previous Long position, and then open the Short position in full too. I do not want my Long position closed, since it hasn't reached profit target or stop loss yet.
How do I solve that within the same strategy? As a workaround, I could create two strategies, they would run independently. I'd like to implement it though in a single strategy, so that I could get more accurate backtest statistics on drawdown etc. of the combined strategy.
When using unmanaged orders, you have complete control. Just remember that you also have none of the safety built-in to NT's managed methods, so you have to take care yourself of everything; especially of everything that can possibly go wrong.
Leave a comment:
-
How to avoid EnterShort/EnterLong closing Long/Short position?
I have two criteria in my script, one for going long, one for going short on the same instrument. I want my positions only closed when they reach profit target or stop loss.
Let's say Long Criteria was triggered and I have a long position. At a later point in time, the Short Criteria is triggered, and EnterShort is being executed. The problem is that EnterShort will fully close my previous Long position, and then open the Short position in full too. I do not want my Long position closed, since it hasn't reached profit target or stop loss yet.
How do I solve that within the same strategy? As a workaround, I could create two strategies, they would run independently. I'd like to implement it though in a single strategy, so that I could get more accurate backtest statistics on drawdown etc. of the combined strategy.Tags: None
- Likes 1
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by zstheorist, Today, 07:52 PM
|
0 responses
6 views
0 likes
|
Last Post
by zstheorist
Today, 07:52 PM
|
||
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
150 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
||
Started by mattbsea, Today, 05:44 PM
|
0 responses
6 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
33 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
6 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
Leave a comment: