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
Can I Set a Target and Stop and than Switch to Trailing Stop?
Collapse
X
-
Can I Set a Target and Stop and than Switch to Trailing Stop?
Can I call the SetProfitTarget(CalculationMode.Ticks, 500) and set my stop to SetStopLoss(CalculationMode.Ticks, 200) and when I hit around let say 300 ticks in the profit area change my stop to SetTrailStop(CalculationMode.Ticks, 100)? Will this work properly managing the orders under the covers?
Tags: None
-
Hello dmisselhorn,
Yes that will work however you cannot combine SetStopLoss and SetTrailStop. You would need to call SetTrailStop from the beginning if you wanted to use that. If you call the Set methods again while they are already active that will update the existing targets. You would generally use the set methods directly from OnBarUpdate in that use case, for example calling the Set methods before the entry to configure them and then in some other condition that happens later you can call them again.
Code:if(entryCondition) { SetProfitTarget(CalculationMode.Ticks, 500) ; SetTrailStop(CalculationMode.Ticks, 200) EnterLong(); } if(someOtherCondition) { SetTrailStop(CalculationMode.Ticks, 100) }
JesseNinjaTrader Customer Service
-
Are Ninja's trailing stops managed synthetically or do they put actual stop market orders on the market natively as the price moves?
Comment
-
Since that's not exactly the same as I mentioned, if after a bar closes if I reissue a trailing stop, will that push the stop back down to it's original location if it has shifted up?
Comment
-
Hello dmisselhorn,
The stop order would be modified to the price supplied or distance from average entry price and would continue trailing from there.
As far as a stop that becomes a trailing stop later, you could achieve this using exit order methods (instead of set methods) and custom logic.
Chelsea B.NinjaTrader Customer Service
Comment
-
Could you provide an example, What I really want to do is Trail once I've achieved a portion of the target.
Comment
-
Hello dmisselhorn,
The ProfitChaseStopTrailExitOrdersExample linked from post # 6 demonstrates trailing logic.
On line 235 change this to set the currentSlPrice to the price you want the stop to initially be placed.
Keep the StopLossDistance at the price at which you want the trailing behavior to begin.
Chelsea B.NinjaTrader Customer Service
Comment
-
SetTrailStop(CalculationMode.Ticks, 100) further into the target run, each time you call it will it update the price with which it's trailing from. Like initially it trails from the position average price, but if you make subsequent calls to it, will it trail at a higher price, thus sliding the trail.
Comment
-
What will it reset to Position.AveragePrice - TrailAmount or when you call it downstream during OnBarUpdate() will it use the current Close[0]-TrailAmount? You didn't really answer my question
Comment
-
Originally posted by dmisselhorn View PostWhat will it reset to Position.AveragePrice - TrailAmount or when you call it downstream during OnBarUpdate() will it use the current Close[0]-TrailAmount? You didn't really answer my question
That ultimately depends on the CalculationMode being used when you call SetStopLoss() again. For example, if you use CalculationMode.Ticks, with the value set to TrailAmount, then it would be the average entry minus the TrailAmount of ticks. Otherwise, you could use CalculationMode.Price and explicitly set the price to Close[0] - TrailAmount * TIckSize, then it would be set to a price with an offset of TrailAmount from the close price of 0 barsAgo.
Please let us know if we may be of further assistance.Emily C.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by AaronKoRn, Today, 09:49 PM
|
0 responses
2 views
0 likes
|
Last Post
by AaronKoRn
Today, 09:49 PM
|
||
Started by carnitron, Today, 08:42 PM
|
0 responses
8 views
0 likes
|
Last Post
by carnitron
Today, 08:42 PM
|
||
Started by strategist007, Today, 07:51 PM
|
0 responses
9 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,975 views
3 likes
|
Last Post
by jhudas88
Today, 06:59 PM
|
||
Started by rbeckmann05, Today, 06:48 PM
|
0 responses
9 views
0 likes
|
Last Post
by rbeckmann05
Today, 06:48 PM
|
Comment