![]() |
|
|||||||
| Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
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?
|
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Try passing in 0.02 for your percent.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
That would be 2%.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
Tried it and the stop orders still get cancelled.
I just added it to the MAcrossover template: protectedoverridevoid 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> protectedoverridevoid OnBarUpdate() { if (CrossAbove(SMA(Fast), SMA(Slow), 1)) { EnterLong("CrossLong"); } elseif (CrossBelow(SMA(Fast), SMA(Slow), 1)) { EnterShort("CrossShort"); } } |
|
|
|
|
|
#6 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
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.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
|
|
#8 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Are there any funny messages on the logs?
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Member
Join Date: Jun 2007
Posts: 50
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
|
|
#10 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
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).
Dierk
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I'm getting the stop loss error again... | funk101 | Strategy Development | 2 | 05-08-2007 11:30 PM |
| Stop Loss Orders activated by number of trades past stop level | DoveforUsAll | Suggestions And Feedback | 1 | 02-08-2006 01:19 AM |
| stop loss feature | QQQ | Suggestions And Feedback | 2 | 09-01-2005 12:04 AM |
| Stop Loss Size | JohnnyB | Suggestions And Feedback | 0 | 07-21-2005 04:04 AM |
| Initial stop loss | meyer99 | ATM Strategies (Discretionary Trading) | 1 | 04-26-2005 12:45 PM |