![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Sep 2008
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
|
I'm using UserDefinedMethods.cs to store some basic coding to be able to reuse it in different strategies. It seems that the prices and positions are available to methods without passing them as variables. The question is are variables instantiated within your strategy? So will I be able to maintain a value within a method or should I keep the value locally stored within the strategy? (Maybe this is a General Programming question?)
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
The availability of a variable is defined by what scope you give it. If you only allow it to be used within the method, you will only have access to it in that method. If you declare the variable in the Variables section you will have access to it throughout the entire strategy.
Ben
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| userdefinedmethods | 8DTK8 | Strategy Development | 4 | 02-22-2009 07:49 AM |
| Export Strategy with UserDefinedMethods Error | mjuviler | Strategy Development | 1 | 06-04-2008 12:34 PM |
| Sharing UserDefinedMethods between indicators and strategies | FireFly | General Programming | 1 | 05-16-2008 10:20 AM |
| Compile error with UserDefinedMethods | NinjaTrader_Josh | Indicator Development | 6 | 06-06-2007 08:34 AM |