I have certain trades in which I would like to change the exit conditions during the trade according to market conditions. So I have two trading ideas x & y. I enter a trade with idea x and price continues to move in my direction until the entry condition for idea y is triggered. Instead of a new entry I'd like to "blend" idea x into idea y and use idea y's exit conditions. Any suggestions on how that would be accomplished? Thanks.
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
"blending" trades
Collapse
X
-
"blending" trades
Hello,
I have certain trades in which I would like to change the exit conditions during the trade according to market conditions. So I have two trading ideas x & y. I enter a trade with idea x and price continues to move in my direction until the entry condition for idea y is triggered. Instead of a new entry I'd like to "blend" idea x into idea y and use idea y's exit conditions. Any suggestions on how that would be accomplished? Thanks.Tags: None
-
CaptainAmericaXX,
Thank you for your post.
If I am following you correctly, you should be able to accomplish this by using a different stop strategy with each condition.
Here is some pseudo code to help you get started...
if (MyXCondition)
//doMyXExit
if (MyYCondition)
//doMyYExit
As long as your Y condition is true, it will use the Y exit.MatthewNinjaTrader Product Management
-
So if I understand you correctly your saying that if I'm in x trade and the conditions for y become true, the y trade will not fire and the x trade exit conditions will be automatically disregarded in favor of the y exit?
In my experience both trades will fire independently with the separate exit working as well. If there are unique names for the conditions one exit will not recognize the other.
Comment
-
So I would need to say something like:
if(x trade == true)
Exit conditions
else(x trade == true
&& y conditions == true)
Exit(with y condition)
is this correct?
Comment
-
Assuming you are going long...
Code:// In variables section above Initialize() private bool useYExits = false; // In OnBarUpdate() if (x trade entry conditions == true) EnterLong(); if (Position.MarketPosition == MarketPosition.Long) { if (y entry conditions == true) useYExits = true; if (useYExits == false && x exit conditions == true) ExitLong(); else if (useYExits == true && y exit conditions == true) ExitLong(); } if (Position.MarketPosition == MarketPosition.Flat && useYExits == true) useYExits = false;
Josh P.NinjaTrader Customer Service
Comment
-
Sweet!
Thanks Josh and thank you to everyone at NT. A year ago I had absolutely no clue how to program.(I"m still very green) The staff at NT has been a huge help to me. Thanks for everything! I don't know how else to send a "Thank you" card. I know I'll still need a lot of help before my ideas materialize, but I wanted to take a moment and thank you all.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by helpwanted, Today, 03:06 AM
|
1 response
11 views
0 likes
|
Last Post Today, 03:35 AM | ||
Started by Brevo, Today, 01:45 AM
|
0 responses
9 views
0 likes
|
Last Post
by Brevo
Today, 01:45 AM
|
||
Started by aussugardefender, Today, 01:07 AM
|
0 responses
5 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
242 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
387 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
Comment