Depends on who you are connected to. Please see this article: http://www.ninjatrader-support2.com/...ead.php?t=5349
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
Trailing Stop
Collapse
X
-
TrailStop
thank you for your email. I´ll work with Mirus (Zen-Fire). Is a trailstop in a strategy an "accepted" or "working" order? And is the trailstop in its new position after being changed an "accepted" or "working" order (and because of this on the exchange)? If so, then the last trailstop becomes a "normal" stoploss in its position of the last change before broken internetconnection?
Think we got it then.
Thank you.
Tony
Comment
-
Stoploss
Hi Josh, Bertrand and everyone
thank you for your sending the link for "SamplePriceModification". Referring to this sample I tried to push forward stoploss each time the price has risen 10 ticks - it doesn´t work. THANK YOU!
protected override void Initialize()
{
SetStopLoss("", CalculationMode.Ticks, 10, true);
CalculateOnBarClose = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (Position.MarketPosition == MarketPosition.Flat)
{
SetStopLoss(CalculationMode.Ticks, 10);
}
else if (Position.MarketPosition == MarketPosition.Long)
{
if (Close[0] > Position.AvgPrice + 9 * TickSize)
{
SetStopLoss(CalculationMode.Ticks, -9);
}
}
else if (Position.MarketPosition == MarketPosition.Short)
{
if (Close[0] < Position.AvgPrice - 9 * TickSize)
{
SetStopLoss(CalculationMode.Ticks, -9);
}
}
else if (Position.MarketPosition == MarketPosition.Long)
{
if (Close[0] > Position.AvgPrice + 19 * TickSize)
{
SetStopLoss(CalculationMode.Ticks, -19);
}
}
else if (Position.MarketPosition == MarketPosition.Short)
{
if (Close[0] < Position.AvgPrice - 19 * TickSize)
{
SetStopLoss(CalculationMode.Ticks, -19);
}
Comment
-
Stoploss
Hi Josh, Bertrand, Jason, Ray....
now I see my posted reply and it seems strange. To avoid misunderstanding I want to add that my "THANK YOU" is not the answer as my strategy doesn´t work with your sample, I said "Thank you" in advance for your answer and help to the code I´ve sent to you. NinjaTrader has the best support!
Comment
-
SetStopLoss
Hello,
I try to change StopLoss referring to the change of price but it doesn´t work and I can´t find the error. Referring to the "SamplePriceModification" my 8 ticks in the stoploss refer to the entryprice or to the new price when stoploss has been changed? Otherwise - as the stoploss is at a higher value (Entry-Price + 16 - 8 = -8) if it refers to the origin entryprice it must be written negative (-8)? (I´ve seen the certain information in the help guide but this doesn´t explain how to change one stoploss for another (or I can´t understand)
Thank you.
protectedoverridevoid Initialize()
{
SetStopLoss("", CalculationMode.Ticks, 10, true);
CalculateOnBarClose = true;
}
protectedoverridevoid OnBarUpdate()
{
if (Position.MarketPosition == MarketPosition.Flat)
{
SetStopLoss(CalculationMode.Ticks, 10);
}
elseif (Position.MarketPosition == MarketPosition.Long)
{
if (Close[0] > Position.AvgPrice + 16 * TickSize)
{
SetStopLoss(CalculationMode.Ticks,8);
}
}
elseif (Position.MarketPosition == MarketPosition.Short)
{
if (Close[0] < Position.AvgPrice - 16 * TickSize)
{
SetStopLoss(CalculationMode.Ticks,8);
}
}
Comment
-
tonynt,
When you call SetStopLoss(), any tick value you pass in is always based off of your original entry price for the position. If you are trying to move it up a few ticks you would simply decrease the ticks you submit the new stop loss at.
Say originally you submit a 10 tick stop loss, after x ticks in profit, you can then resubmit the stop loss at 8 ticks to raise it by 2.Josh P.NinjaTrader Customer Service
Comment
-
SetStopLoss
Hello Josh,
thank you for your information - this is theoretically 100% clear. But as I wanted to show in my code: how to bring the stoploss ABOVE the entry price? In the code StopLoss starts with 10, then the price rises 16 ticks and I want to set the StopLoss 8 ticks below this price (= 8 ticks above entry price). This doesn´t work.
Thank you and best regards.
Tony
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Jonker, Today, 01:19 PM
|
0 responses
1 view
0 likes
|
Last Post
by Jonker
Today, 01:19 PM
|
||
Started by futtrader, Today, 01:16 PM
|
0 responses
4 views
0 likes
|
Last Post
by futtrader
Today, 01:16 PM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
14 responses
1,789 views
0 likes
|
Last Post
by aligator
Today, 11:47 AM
|
||
Started by Jimmyk, 01-26-2018, 05:19 AM
|
6 responses
838 views
0 likes
|
Last Post
by emuns
Today, 11:27 AM
|
||
Started by jxs_xrj, 01-12-2020, 09:49 AM
|
6 responses
3,294 views
1 like
|
Last Post
by jgualdronc
Today, 10:56 AM
|
Comment