NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 07-31-2012, 07:28 PM   #1
ij001
Senior Member
 
Join Date: Apr 2010
Posts: 125
Thanks: 18
Thanked 3 times in 3 posts
Default Parameters in UserDefinedMethods

Hi there

I added a bool method to Parameters in my UserDefinedMethods.cs file.

private bool iShowOnly = false;

[Description("")]
[GridCategory("Parameters")]
publicbool ShowOnly
{
get { return iShowOnly; }
set { iShowOnly = value; }
}

Since UserDefinedMethods.cs is public it shows in Parameters for all indicators. I only want to use it with a couple of indicators not all of them. Is there a way to restrict to which ones?

Btw - I can't put the code just in the indicators I need because the methods I use are coded and referenced in the UserDefinedMethods.cs file...

Thx
Irvin
ij001 is offline  
Reply With Quote
Old 07-31-2012, 08:18 PM   #2
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Are you wanting this bool to show up on the parameters grid of only some indicators not others?

Or are you just wanting some indicators to have the ability to access this bool?
NinjaTrader_Matthew is offline  
Reply With Quote
Old 07-31-2012, 09:35 PM   #3
ij001
Senior Member
 
Join Date: Apr 2010
Posts: 125
Thanks: 18
Thanked 3 times in 3 posts
Default

The former ... Some indicators.
ij001 is offline  
Reply With Quote
Old 07-31-2012, 09:43 PM   #4
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Unfortunately i'm not aware of away to only have these public defined parameters show up on only some indicators grid.

The only thing you would be able to do is create a public bool which could be accessed by the other indicator code directly, however you wouldn't be able to change this parameter from the Grid parameters.

public bool iShowOnly = false;


We will leave this thread open in the case another community member has experience in this area.
NinjaTrader_Matthew is offline  
Reply With Quote
Old 08-01-2012, 09:27 AM   #5
ij001
Senior Member
 
Join Date: Apr 2010
Posts: 125
Thanks: 18
Thanked 3 times in 3 posts
Default

Quote:
Originally Posted by NinjaTrader_Matthew View Post
Unfortunately i'm not aware of away to only have these public defined parameters show up on only some indicators grid.

The only thing you would be able to do is create a public bool which could be accessed by the other indicator code directly, however you wouldn't be able to change this parameter from the Grid parameters.

public bool iShowOnly = false;


We will leave this thread open in the case another community member has experience in this area.
Hi Matthew

I got it to work another way.

I added a boolean input into my method that is referenced from the indicators that need it.

In UserDefinedMethods.cs:
public bool MyMethod(bool iShowOnly)
if iShowOnly = false
// do something from before
else
// do something less

Calling the method in the indicator: if MyMethod(ShowOnly) == true

Thx
Irvin
ij001 is offline  
Reply With Quote
The following user says thank you to ij001 for this post:
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
UserDefinedMethods ScottB Automated Trading 7 09-28-2010 02:34 PM
UserDefinedMethods ScottB General Programming 2 09-25-2010 11:53 AM
UserDefinedMethods.cs zeller4 Indicator Development 1 06-07-2010 08:51 AM
userdefinedmethods 8DTK8 Strategy Development 4 02-22-2009 07:49 AM
Question about UserDefinedMethods clint2008 Strategy Development 1 11-07-2008 10:37 AM


All times are GMT -6. The time now is 02:53 AM.