![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Senior Member
Join Date: Jan 2009
Posts: 413
Thanks: 0
Thanked 20 times in 20 posts
|
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 |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
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?
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jan 2009
Posts: 413
Thanks: 0
Thanked 20 times in 20 posts
|
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. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
Scott, thanks for the reply. Please let us know if you have any other questions.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jan 2009
Posts: 413
Thanks: 0
Thanked 20 times in 20 posts
|
You are welcome; everything is working.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |