![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Mar 2010
Posts: 8
Thanks: 0
Thanked 0 times in 0 posts
|
Hi,
I am trying to create a trailing stop logic (I don't want to use the trailstop method as I don't want my trailing stop to be entered when I initially enter the market, I only want it to kick in when a certain condition becomes true). But I am finding that once I declare a dataseries, Ninjatrader 7 seems to not allow me to redeclare the dataseries value:. For example, here is the code I'm looking at: PHP Code:
Xtest 10759 Price 10764 Xtest 10763 Price 10768 Xtest 10765 Price 10770 Xtest 10765 Price 10770 Xtest 10765 Price 10770 Is there a way around this please? The current results above means that my "trailing stop" simply follows the market and doesn't "lock in" the profit. Many thanks in advance, David |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
|
David, this is simply a matter of convention. You just have to set the historical value differently. The overload you are looking for is this:
Code:
DataSeries.Set(int barsAgo, double value); Code:
dSeries.Set(2, 100);
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Mar 2010
Posts: 8
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Austin,
Many thanks for the fast reply. Are you saying that I can use the code you've provided to redeclare the Dseries? I'm not sure I want to set a historical value; I want to redeclare the Dseries. Apologies if I've misunderstood. Kind Regards, David |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Nov 2009
Location: Denver, CO
Posts: 1,424
Thanks: 0
Thanked 3 times in 3 posts
|
Hi dfarrell,
Thanks you for posting, someone will reply shortly.
Tim
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
dfarrell,
Perhaps this article discussing DataSeries objects will be helpful for you: http://www.ninjatrader-support.com/H...taSeriesObject What you want to do then is just use .Set(someValue) and set whatever value into it that you would like.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trailing Profits - How to Reverse a Trailing Stop? | jeremymgp | Strategy Development | 1 | 05-05-2009 10:47 AM |
| Going from a Stop Loss to a Trailing Stop within a strategy | Sidhartha | Strategy Development | 28 | 03-24-2009 03:11 PM |
| Trailing Stop with a fixed 20 tick stop | Godzilla | Strategy Development | 3 | 03-18-2009 07:07 AM |
| stop loss, trailing stop modification in NT6 | alfie | Strategy Development | 1 | 03-26-2008 03:46 PM |
| NT 6.5 - Trailing stop not trailing | PocoDiablo | Miscellaneous Support | 3 | 03-19-2008 01:46 PM |