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 02-17-2010, 04:20 PM   #1
binwang2
Senior Member
 
Join Date: Jan 2009
Posts: 216
Thanks: 0
Thanked 1 time in 1 post
Default Access indicator's public variable value

Hi NT experts,
There is an indicator LinRegSlopeSFX in the file shareing indicator postion.
I would like to use its slop value in a strategy. It is declared as a public varibale in LinRegSlopeSFX.
Any way to do that?
Regards,


binwang2 is offline  
Reply With Quote
Old 02-18-2010, 05:14 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
Default

You would either need to make it a plot so it can be accessed (aka MyIndicator.MyIndicatorPlotValue) or you can also expose internal calcs with the concept shown in this sample -

http://www.ninjatrader-support2.com/...ead.php?t=4991
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 02-24-2010, 03:58 PM   #3
mgabriel01
Member
 
Join Date: Oct 2008
Posts: 70
Thanks: 1
Thanked 2 times in 2 posts
Default Exposing Strategy variables to Indicators

Hi Bertrand
I am trying to do the opposite (I think thats what you would call it)

My strategy takes 1 position at a time, long or short --- and checks the current state using Position.Quantity

When I have an open position, I would like my indicator to stop printing messages to the output window

something like:
if (Position.Quantity > 0)
do nothing
else
print a bunch of stuff to the output window


I know I cannot uses Open.Position from the indicator -- but I'm thinking I can pass a value from the strategy back to the indicator

is this possible?
thanks
mgabriel01 is offline  
Reply With Quote
Old 02-25-2010, 05:48 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
Default

Unfortunately this is not supported, as strategies do not allow cross communication. I think you could achieve what you want by reading / writing values from / to text files.

http://www.ninjatrader-support2.com/...ead.php?t=3477
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 02-25-2010, 07:01 AM   #5
mgabriel01
Member
 
Join Date: Oct 2008
Posts: 70
Thanks: 1
Thanked 2 times in 2 posts
Default

Thanks Bertrand
I will go that route, I'm new to C# so taking it one step at a time
mgabriel01 is offline  
Reply With Quote
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
Variable transfer/access between OnBarUpdate and OnExecution noincomenojobnoassets Strategy Development 9 09-23-2009 03:36 AM
ADX indicator not providing public access to data RandyT Automated Trading 8 06-02-2009 03:02 PM
How can access a variable defined in other section jrbolsa General Programming 6 04-06-2009 12:42 PM
Can I access Public Indicator Variables from Strategy rrv1980 Strategy Development 13 08-24-2008 05:31 PM
access variable outside of if block? auspiv General Programming 6 07-13-2008 07:52 PM


All times are GMT -6. The time now is 02:23 PM.