![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Oct 2008
Posts: 24
Thanks: 0
Thanked 0 times in 0 posts
|
Hello,
Just having a play with my first bit of backtesting... how would i amend the below to move the stop to b/e if the price hits +25 ticks? Any help greatly appreciated Code:
protected override void Initialize()
{
SetStopLoss("", CalculationMode.Ticks, 25, false);
SetProfitTarget("", CalculationMode.Ticks, 36);
CalculateOnBarClose = true;
}
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
You will need to move the SetStopLoss("", CalculationMode.Ticks, 25, false); out of the Initialization block and into the OnBarUpdate block, build your criteria for move the stop, then call the SetStopLoss again with new placement. This link may help: http://www.ninjatrader-support2.com/...ead.php?t=3222
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Oct 2008
Posts: 24
Thanks: 0
Thanked 0 times in 0 posts
|
thanks that works a treat
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto-breakeven in strategy | cassb | Strategy Development | 21 | 05-08-2008 06:57 PM |
| Example of Auto Breakeven code? | Thomas | Strategy Development | 4 | 08-17-2007 03:39 PM |
| Auto breakeven fails? | nicko9 | ATM Strategies (Discretionary Trading) | 3 | 02-05-2007 03:04 AM |
| Auto breakeven fails? (2) | nicko9 | ATM Strategies (Discretionary Trading) | 1 | 02-05-2007 01:36 AM |
| Sliding auto-breakeven | pwald9 | ATM Strategies (Discretionary Trading) | 3 | 11-08-2006 06:45 AM |