NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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 08-13-2009, 06:05 PM   #1
raycam
Senior Member
 
Join Date: Mar 2008
Posts: 205
Thanks: 0
Thanked 1 time in 1 post
Default Stop loss in automated strategy

Hi all. My strategy is working well only last night I realized a glitch in my setup. I have two ways to exit a trade- the first is a 16 tick stop loss and then if price crosses a MA it exits the position. The idea is that often when a trade opportunity arises it is close to the MA exit line. I watched the trade progress and it stopped out at 9 ticks when it crossed the MA but would have gone on to be a highly profitable trade if it had kept the 16 tick stop loss.
Is there a way of setting it so that the MA exit is not triggered to exit in the initial stages?
Thanks
raycam
raycam is offline  
Reply With Quote
Old 08-14-2009, 03:28 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

raycam, I think you can work with the 'Unrealized (Open) PnL' for this, just use the MA trail only when profit is higher than amount X
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-14-2009, 05:46 AM   #3
raycam
Senior Member
 
Join Date: Mar 2008
Posts: 205
Thanks: 0
Thanked 1 time in 1 post
Default

Thanks mate- I will give it a go!
raycam
raycam is offline  
Reply With Quote
Old 08-14-2009, 07:08 AM   #4
raycam
Senior Member
 
Join Date: Mar 2008
Posts: 205
Thanks: 0
Thanked 1 time in 1 post
Cool

Having trouble with this.
In my set 3 of conditions and actions I have the following...
"Position.MarketPosition==MarketPosition.Short
CrossAbove(Close,SMA(32),1)"

When I click add and select "Unrealized PnL" Currency >= Numeric value of 100
I end up with this...
"Position.GetProfitLoss(Close(0), PerformanceUnitCurrency)>=100"

Is that how it is supposed to look so that when a trade is entered it will rely on my set stop loss until profitable to $100- at which point the SMA comes into play.

Hope this makes sense.
My head spins when I venture away from the wizard.
And even in the wizard things are blurry.
THX
raycam
raycam is offline  
Reply With Quote
Old 08-14-2009, 07:16 AM   #5
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

That is the correct listing for Unrealized PnL.
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
Going from a Stop Loss to a Trailing Stop within a strategy Sidhartha Strategy Development 28 03-24-2009 03:11 PM
Stop loss with Strategy Wizard ptolar Strategy Development 2 01-13-2009 10:32 AM
Strategy stop loss junkone Strategy Development 6 12-11-2008 10:32 AM
Stop loss strategy question alanack General Programming 5 04-25-2008 09:55 AM
Strategy Cancels Stop Loss when Exiting??? wayneFH Strategy Development 5 04-07-2008 10:03 AM


All times are GMT -6. The time now is 12:14 AM.