Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Error on trailing stop - order above market price reject!
Collapse
X
-
Hello EvergreenGain,
The profit target and stop loss use OCO.
The stop loss was rejected because this was a sell order with the stop price equal to or above the current bid.
The profit target was rejected because it was using the same OCO ID as the stop loss, and the stop loss was rejected.
OCO is One-Cancels-Others. When an OCOID is used on an order, this will cause any other orders using the same OCOID to be cancelled when the order fills, is rejected, or is cancelled.
-
Leave a comment:
-
ChelseaB,
Look up for my update!!! It's working very nicely now!
// Once at breakeven wait till trailProfitTrigger is reached before advancing stop loss by trailStepTicks size step
else if (previousPrice != 0) // StopLoss is at breakeven
{
if (GetCurrentBid() > previousPrice + trailProfitTrigger * TickSize){newPrice = previousPrice + trailStepTicks * TickSize; // Calculate trail stop adjustmentif (newPrice >= GetCurrentBid()) // Ensure newPrice is below the current asknewPrice = GetCurrentBid() - TickSize;}
SetStopLoss(CalculationMode.Price, newPrice); // Readjust stoploss level
previousPrice = newPrice; // save for price adjustment on next candle
stopPlot = newPrice; // save to adjust plot line
I hope that support ticket can help another!
Thank you so much again.
Cheers!
Leave a comment:
-
Hello EvergreenGain,
As you are using SetStopLoss() you can disregard the information about using isLiveUntilCancelled.
Ensure that you are resetting SetStopLoss() when flat to a valid price (or number of ticks) before placing a new entry, as demonstrated in the ProfitChaseStopTrailSetMethodsExample on line 103.
Ensure that your newPrice is a valid price below the bid.
newPrice = previousPrice + trailStepTicks * TickSize; // Calculate trail stop adjustment
if (newPrice >= GetCurrentBid())
newPrice = GetCurrentBid() - TickSize.
SetStopLoss(CalculationMode.Price, newPrice)
Leave a comment:
-
If there's one thing I respect more than the tool itself in NT8, it's that support, especially your ChelseaB.
As always insightful in interpreting the user's problem and suggesting a solution. My consideration and eternal thanks!!!
But I wanted to confirm with you about the specific solution. Is this the one below?
// trigger the trail action when the current price is further than the set distance to the stop loss
if (TrailStopLoss &&stopLoss != null && (stopLoss.OrderState == OrderState.Accepted || stopLoss.OrderState == OrderState.Working) &&
Close[0] > currentSlPrice + StopLossDistance * tickSizeSecondary)
{
currentSlPrice = Close[0] - StopLossDistance * tickSizeSecondary;
ExitLongStopMarket(1, true, entryOrder.Quantity, currentSlPrice, "stop loss", entryOrder.Name);
}
Below, I'm sharing the code part of my trailing stop logic:
case MarketPosition.Long:
if (previousPrice == 0)
{
stopPlot = Position.AveragePrice - stopLossTicks * TickSize; // initial stop plot level
}
// Once the price is greater than entry price+ breakEvenTicks ticks, set stop loss to plusBreakeven ticks
if (Close[0] > Position.AveragePrice + breakEvenTicks * TickSize && previousPrice == 0)
{
initialBreakEven = Position.AveragePrice + plusBreakEven * TickSize;
SetStopLoss(CalculationMode.Price, initialBreakEven);
previousPrice = Position.AveragePrice;
stopPlot = initialBreakEven;
}
// Once at breakeven wait till trailProfitTrigger is reached before advancing stoploss by trailStepTicks size step
else if (previousPrice != 0 ////StopLoss is at breakeven
&& GetCurrentAsk() > previousPrice + trailProfitTrigger * TickSize )
{
newPrice = previousPrice + trailStepTicks * TickSize; // Calculate trail stop adjustment
SetStopLoss(CalculationMode.Price, newPrice); // Readjust stoploss level
previousPrice = newPrice; // save for price adjust on next candle
stopPlot = newPrice; // save to adjust plot line
}
Leave a comment:
-
Hello EvergreenGain,
If this is the managed approach, use the isLiveUntilCancelled bool parameter as true, and place the exit only when the entry has filled and when modifying the price. (Don't re-submit on each new bar to keep it alive)
Below is a link to the ProfitChaseStopTrailExitOrdersExample which demonstrates trailing with isLiveUntilCancelled as true.
Ensure the price calculated for exit order is a valid price. A sell stop must be below the bid, a buy stop must be above the ask.
Below is a link to a forum post with sample code.
Hi I have a sellshort StopLimit order that i change if unfilled. I tick below the last bar's low. I keep getting the stop price can't be changed above the market but the price value it quotes ( the one I want) is below the market. Currently I am on the simulated feed. I appreciate in real market situations this could happen
Leave a comment:
-
Error on trailing stop - order above market price reject!
Hello everybody,
I'm having the same problem that most users who try to use a trailing stop experience, which is the damn order being rejected because the price was posted above the market.
Is there any objective and straightforward solution to solve this problem, since tripling the stop loss size does not solve it when the price comes against the trailing stop?
Awaiting designation of a support technician to send trace route information and print/videos of errors and messages.
Cheers!
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Pointtoni, Yesterday, 11:41 PM
|
2 responses
21 views
0 likes
|
Last Post
![]()
by Pointtoni
Today, 11:46 AM
|
||
Started by DayTradingDEMON, Yesterday, 02:10 PM
|
5 responses
28 views
0 likes
|
Last Post
![]() |
||
Started by Nate G, 03-17-2025, 02:53 PM
|
4 responses
56 views
1 like
|
Last Post
![]()
by timko
Today, 11:13 AM
|
||
Started by several, 03-18-2025, 03:53 AM
|
11 responses
174 views
1 like
|
Last Post
![]()
by timko
Today, 10:53 AM
|
||
Started by Amelie4262, Today, 10:45 AM
|
0 responses
7 views
0 likes
|
Last Post
![]()
by Amelie4262
Today, 10:45 AM
|
Leave a comment: