![]() |
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 |
|
Member
Join Date: Jan 2011
Posts: 54
Thanks: 14
Thanked 0 times in 0 posts
|
Its possible acces to a indicator public var from an strategy?
I am trying but the value is always the first declared. Indicator example code: Code:
//Indicator var declaration
public int myvar=0;
....
//Indicator update
protected override void OnBarUpdate(){
myvar=x;
...
Code:
/Strategy update
protected override void OnBarUpdate(){
//Print indicator var
print(MyIndicator().myvar);
...
How can i take the updated value? Thank you very much for help. Mary
|
|
|
|
|
|
#2 |
|
Senior Member
|
You need to include an Update() in the get function for the property.
get{myvar = Update(); return value;} ref: http://www.ninjatrader.com/support/h...tml?update.htm
Last edited by koganam; 01-30-2011 at 06:08 AM.
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
marynja, there is also a reference sample that details how to get an indicator value in a strategy, which is pretty much what you've already done with koganam's help.
Austin
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Public var not updating... | Sleeping Troll | Indicator Development | 2 | 09-23-2010 11:15 AM |
| access Strategy object from indicator | pbcah | Indicator Development | 4 | 06-07-2010 12:28 AM |
| Can a strategy access the SMA indicator | Turtle Trader | Strategy Development | 3 | 04-07-2010 04:27 AM |
| var type | b1g3ar5 | General Programming | 2 | 11-05-2009 05:27 AM |
| Can I access Public Indicator Variables from Strategy | rrv1980 | Strategy Development | 13 | 08-24-2008 05:31 PM |