NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 05-05-2009, 10:40 AM   #1
jeremymgp
Member
 
Join Date: Aug 2007
Posts: 70
Thanks: 0
Thanked 0 times in 0 posts
Default Trailing Profits - How to Reverse a Trailing Stop?

Hello,

I have system using a trailing stop as follows:

protected override void Initialize()
{
SetTrailStop("", CalculationMode.Ticks, 60, true);

CalculateOnBarClose = true;
}

protected override void OnBarUpdate()
{
if ()
{
EnterShort(DefaultQuantity, "");
}

}

I'd like to reverse the trailing stop, so that I would go long instead of short and when the trailing "stop" was hit, it would be a take profit. I can't think how I could do this, low-intermediate coding skills so thanks for your patience,

Jeremy
jeremymgp is offline  
Reply With Quote
Old 05-05-2009, 10:47 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

jeremymgp,

If you did EnterShort() and had a short position and you called EnterLong() it will reverse you into a long position, cancel the original trailing stop, and finally place you in a new trailing stop that is in the appropriate direction.
NinjaTrader_Josh 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
Trailing stop gg80108 Strategy Development 6 03-20-2009 01:13 PM
Trailing Stop for Realised Profits? John833 Strategy Development 2 12-12-2008 02:18 PM
Trailing stop jonbig04 ATM Strategies (Discretionary Trading) 2 07-24-2008 11:40 AM
Trailing Stop tc101 Automated Trading 3 06-03-2008 07:59 AM
NT 6.5 - Trailing stop not trailing PocoDiablo Miscellaneous Support 3 03-19-2008 01:46 PM


All times are GMT -6. The time now is 07:05 AM.