View Full Version : CalculateMode.Percent stop loss gets cancelled
suedeuno
06-03-2007, 11:35 AM
I'm using the simulator version of NT and when I try to use SetStopLoss(CalculateMode.Percent, 2) the stop gets cancelled. If I use one of the other modes the stop will trigger. Why is the percent mode always cancelling?
NinjaTrader_Ray
06-03-2007, 12:18 PM
Try passing in 0.02 for your percent.
suedeuno
06-03-2007, 12:26 PM
Thanks. So will 0.02 be calculated as 0.02% or 2% ?
Try passing in 0.02 for your percent.
NinjaTrader_Ray
06-03-2007, 12:40 PM
That would be 2%.
suedeuno
06-03-2007, 12:58 PM
Tried it and the stop orders still get cancelled.
I just added it to the MAcrossover template:
protected override void Initialize()
{
SMA(Fast).Plots[0].Pen.Color = Color.Orange;
SMA(Slow).Plots[0].Pen.Color = Color.Green;
Add(SMA(Fast));
Add(SMA(Slow));
CalculateOnBarClose = true;
SetStopLoss(CalculationMode.Percent, 0.02);
}
/// <summary>
/// Called on each bar update event (incoming tick).
/// </summary>
protected override void OnBarUpdate()
{
if (CrossAbove(SMA(Fast), SMA(Slow), 1))
{
EnterLong("CrossLong");
}
else if (CrossBelow(SMA(Fast), SMA(Slow), 1))
{
EnterShort("CrossShort");
}
}
NinjaTrader_Dierk
06-04-2007, 12:10 AM
Please check out the logs. In case you trade against a live account there should be some messages in indicating why your broker cancelled out the order.
suedeuno
06-04-2007, 07:31 AM
I'm using the simulator version of Ninja Trader
Please check out the logs. In case you trade against a live account there should be some messages in indicating why your broker cancelled out the order.
NinjaTrader_Dierk
06-04-2007, 08:05 AM
Are there any funny messages on the logs?
suedeuno
06-04-2007, 09:51 PM
Not that I can see.
There is a log entry stating Automated trading is disabled. But that shouldn't have affected the backtest since the other stop modes trigger.
Are there any funny messages on the logs?
NinjaTrader_Dierk
06-05-2007, 12:18 AM
May be the stop gets cancelled as your strategy tries to enter on the other side and closes the opposite position plus cancels the associated stop order (expected).