NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Strategy Analyzer

Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer.

Reply
 
Thread Tools Display Modes
Old 12-16-2008, 06:17 AM   #1
tradingcube
Junior Member
 
Join Date: Oct 2008
Posts: 24
Thanks: 0
Thanked 0 times in 0 posts
Default Auto Breakeven

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;

        }
tradingcube is offline  
Reply With Quote
Old 12-16-2008, 07:20 AM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

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
NinjaTrader_Ben is offline  
Reply With Quote
Old 12-16-2008, 09:22 AM   #3
tradingcube
Junior Member
 
Join Date: Oct 2008
Posts: 24
Thanks: 0
Thanked 0 times in 0 posts
Default

thanks that works a treat
tradingcube is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 08:33 AM.