![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jun 2010
Posts: 129
Thanks: 17
Thanked 6 times in 4 posts
|
This follows from the Tutorial 2 sample strategy in the Help Guide (i.e. RSI with a Stop Loss and a Profit Target).
Our entry condition is this: Code:
if (CrossAbove (RSI(RSIPeriod, RSISmooth), 20, 1))
{
How do I got about referencing it? Thanks! |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hello nicbizz,
Your strategy should control all the input parameters in this case. You can use the same variable name for both places: 1) adding the indicator for visualization in initialize 2) evaluating indicator values in OnBarUpdate() for an order condition. This is what is shown in the example. You can access the indicator "Period" value but there is no benefit to this. Since the user never has access to this indicator input when running the strategy, it will always be the default value for Period in the RSI indicator.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jun 2010
Posts: 129
Thanks: 17
Thanked 6 times in 4 posts
|
Hi Ryan,
THanks for the reply. Perhaps this is not the best example to illustrate what I'm attempting to do. Let's say I have a custom indicator called IndicatorX, which has a public property called PricePoint. If I'd like to reference the value of PricePoint in my strategy, what is the correct syntax to do so? In regular C#, I'd have to create an instance of IndicatorX ..... IndicatorX thisIndicator = new IndicatorX(); and then call the property using thisIndicator.PricePoint. -Nick |
|
|
|
|
|
#4 | |
|
Senior Member
|
Quote:
|
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Nicbizz,
Yes, that is how you would do it. Can see this sample for best practices on exposing non-plot value from another indicator: http://www.ninjatrader.com/support/f...ead.php?t=4991
Ryan M
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing parameters from Strategy to Indicator via Add() | abfc123 | Indicator Development | 1 | 11-09-2010 05:52 AM |
| When indicator parameters not in Parameters category | MikeInMA | Strategy Development | 3 | 11-08-2010 03:24 PM |
| Indicator Accessing Indicator Where User Has Set Parameters | dkrumholz | Indicator Development | 1 | 04-27-2010 02:56 PM |
| Indicator Parameters in a Strategy | laocoon | Strategy Development | 1 | 10-08-2009 04:11 AM |
| Indicator parameters from within a strategy | astrolobe | Indicator Development | 1 | 06-20-2009 11:05 PM |