NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-20-2009, 02:55 PM   #1
daven
Senior Member
 
Join Date: Mar 2006
Location: Bellingham, WA , USA
Posts: 331
Thanks: 0
Thanked 11 times in 8 posts
Default Exposing a Variable for use in a strategy

I am working on a strategy which will go long if certain conditions are met and an avg line, which changes color depending on its slope, is the right color. To make the "color" available to a strategy I have created a variable which is set to a number depending on the color of the plot. I've embedded along with the plot statement but I don't know how to make it accessible to a strategy. Here's a sample of the code:

Code:
if (Rising(SMA(Period)))
     {
     // Connects the rising plot segment with the other plots
     RisingPlot.Set(1, SMA(Period)[1]);
     LColText = 1;
     }
I'm pretty sure I need to somehow add a statement in the "Properties" section
or perhaps do that as well as create a dataseries but the things I've tried don't work. If there is a code sample somewhere that outlines this I would be grateful to see it.
Thanks
DaveN
daven is offline  
Reply With Quote
Old 08-20-2009, 03:06 PM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,014 times in 995 posts
Default

You would need to expose this dataseries in the indicator to access it in the strategy then - http://www.ninjatrader-support2.com/...ead.php?t=4991
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 08-20-2009, 09:59 PM   #3
daven
Senior Member
 
Join Date: Mar 2006
Location: Bellingham, WA , USA
Posts: 331
Thanks: 0
Thanked 11 times in 8 posts
Default Exposing a Variable for use in a strategy

Bertrand,
Thanks for your help and guidance to the sample code. It works though I am still having trouble making the text variable visible outside the indicator so that it can be used in a strategy.
Thanks
DaveN
daven 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
How to plot variable from strategy KrisS Strategy Development 1 08-03-2009 05:18 AM
Accessing indicator variable from a strategy epcompany General Programming 13 07-16-2009 08:25 AM
Setting an Indicator Variable from a Strategy spinalwiz General Programming 5 12-16-2008 11:40 AM
Strategy with a variable that is not plotted ssierra Strategy Analyzer 1 03-08-2008 07:17 PM
Exposing non dataseries variable tquinn General Programming 10 05-17-2007 04:12 PM


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