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 02-26-2011, 01:28 PM   #1
ScottB
Senior Member
 
Join Date: Jan 2009
Posts: 413
Thanks: 0
Thanked 20 times in 20 posts
Default SetStopLoss

Is it possible to enter a negative number for the value in SetStopLoss and CalculationMode.Ticks? Alternatively, is it possible to switch CalculationMode from ticks to price while holding a position (that would actually be preferable)?

When a position is first entered, a fixed number of ticks is used then it jumps to a number of ticks based on some other criteria and then once a certain profit level is reached, it starts trailing.

Because you can't mix SetStopLoss with a trailing stop, once I get to the trailing stop level I still have to use SetStopLoss.

However, now I want a stop that is above (for a long) my entry so it would appear the stop loss in ticks is actually a negative number.

Yes, I know I can use price all along but because initally the price is going to be so close to the market, I have to jump through hoops to make certain I don't place a stop at the market which will give me an error and shut the strategy down.

Best Regards,
Scott
ScottB is offline  
Reply With Quote
Old 02-26-2011, 08:35 PM   #2
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
Default

ScottB, a stop with negative ticks would become a profit target. What check are you using to make sure you're not entering on the wrong side of the market? Have you tried using GetCurrentAsk() and GetCurrentBid() to check the price before entry?
NinjaTrader_Austin is offline  
Reply With Quote
Old 02-27-2011, 09:04 AM   #3
ScottB
Senior Member
 
Join Date: Jan 2009
Posts: 413
Thanks: 0
Thanked 20 times in 20 posts
Default

Austin, using GetCurrentAsk... was what I was trying to avoid. I figured out you can change calculation mode in the middle of a trade so all is well.

The difference between a negative tick stop and a profit target would be the nature of the underlying order. I was hoping the stop would stay a stop order and NinjaTrader simply converted the input values into an actual prices. This would leave the order a stop order, just at a price above the entry.

I am used to using the unmanaged approach and allowing for fast moving markets. If done correctly (so as it is virtually impossible to break) requires a decent amount of code. Technically, you can do what you suggested but I have found issues with doing that without additional checks, if the market is moving very fast.

Thanks for your help.
ScottB is offline  
Reply With Quote
Old 02-27-2011, 02:34 PM   #4
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
Default

Scott, thanks for the reply. Please let us know if you have any other questions.
NinjaTrader_Austin is offline  
Reply With Quote
Old 02-27-2011, 03:03 PM   #5
ScottB
Senior Member
 
Join Date: Jan 2009
Posts: 413
Thanks: 0
Thanked 20 times in 20 posts
Default

You are welcome; everything is working.
ScottB 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
SetStopLoss gg80108 General Programming 3 10-11-2010 10:38 AM
SetStopLoss() Lost Trader Strategy Development 4 08-03-2010 02:14 PM
An example for SetStopLoss crunchy General Programming 3 05-09-2010 09:11 AM
SetStopLoss toyogo00 Strategy Development 1 07-22-2008 09:02 AM
SetStopLoss thepcmd Strategy Development 2 12-01-2007 01:14 PM


All times are GMT -6. The time now is 09:37 PM.