NinjaTrader Support Forum  

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

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-13-2010, 04:39 AM   #1
murfinp
Senior Member
 
Join Date: Jan 2007
Location: , ,
Posts: 133
Thanks: 1
Thanked 0 times in 0 posts
Default returning non plotted series

Hi

I want to write an indicator that does some plots but also returns a flag -2, -1, 0, 1, 2 ... so i have n line plots plus a series that is available but not plotted. I would want to look at the plotted and non plotted values in a strategy

Could somebody explain how i do that

much appreciated ...

Thanks
murfinp is offline  
Reply With Quote
Old 08-13-2010, 04:45 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

You could for example set your 'signals' to a non plotted series variable that is exposed to be accessed then from your strategy, the sample following shows how to work this with BoolSeries, but others would work as well -

http://www.ninjatrader.com/support/f...ead.php?t=4991
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-13-2010, 04:54 AM   #3
murfinp
Senior Member
 
Join Date: Jan 2007
Location: , ,
Posts: 133
Thanks: 1
Thanked 0 times in 0 posts
Default

great - thanks very much ....
murfinp is offline  
Reply With Quote
Old 08-15-2010, 02:36 PM   #4
kumar
Member
 
Join Date: Sep 2009
Location: MA
Posts: 92
Thanks: 2
Thanked 1 time in 1 post
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
You could for example set your 'signals' to a non plotted series variable that is exposed to be accessed then from your strategy, the sample following shows how to work this with BoolSeries, but others would work as well -

http://www.ninjatrader.com/support/f...ead.php?t=4991
This is very helpful, but having limited prgramming skills, following questions arise:

1. 'exposedVariable' is declared in the indicator and the strategy has
'Print(SampleBoolSeries().ExposedVariable'

How/where does 'exposedVariable' get linked to the SampleBoolenSeries?

2. I fI were not intereseted in a booleanSeries, couldn't I just use a boolen exposedVariable?

3. Ideally I would like to return a variable from an existing indicator and use that in a strategyWizard - is that possible?

I have had sucess with changing ZigZag indicator parameters whithin the code which cause the indicator to plot zigzig lines in 2 different colors - it is just a boolean, and I want to use within the strategy wizard, but no luck so far.

Appreciate the help and thnks.
Kumar
kumar is offline  
Reply With Quote
Old 08-15-2010, 07:04 PM   #5
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

1- I should be set at the top in or near the variables section.
2- I am sorry, I don't understand. Yes, you can use a simple boolean variable that toggles from true to false, but the series part is so you can access it in history.
3- You can access indicator values in the Wizard, but the ZigZag is not like other indicators. It is very difficult to access programmatically, let along via the Wizard. The ZigZag and Swing inidcators are for visual use only.
NinjaTrader_Ben is offline  
Reply With Quote
Old 08-16-2010, 03:35 PM   #6
kumar
Member
 
Join Date: Sep 2009
Location: MA
Posts: 92
Thanks: 2
Thanked 1 time in 1 post
Default

Ben,

Here is what I am thinking:

1. Variables:
private
bool swingfound (= false)

2. Properties:
publicbool foundswing
{
get { Update(); return foundswing; }
}
3. In indicator NinjaPriceAction in the logic to plot HH, HL, ... set the variable to true or false as appropriate.

How can I make this variable available in strategy wizard? I am only interested in the current value and not the history, so would not need to define a boolen series (that is what you have implied).

Thanks.
Kumar
kumar is offline  
Reply With Quote
Old 08-16-2010, 03:55 PM   #7
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
Default

Kumar, you will have to expose whatever series you're working with in order to use it in the Strategy Wizard. A quick side note: capitalization is very important when exposing variables because there is a private variable internal to the indicator and a public variable (the exposed one) that can easily be mixed up.

To further answer your question #1 in post 4, the exposed variable is accessed by the strategy that is also a part of the reference sample. Please take a look at post 4 in this post as well - I've explained it in a bit more detail there.
NinjaTrader_Austin is offline  
Reply With Quote
Old 08-16-2010, 05:26 PM   #8
kumar
Member
 
Join Date: Sep 2009
Location: MA
Posts: 92
Thanks: 2
Thanked 1 time in 1 post
Default

Thanks Ben, Sorry my confusion prevails!
Two posts ago NT_Ben wrote:
"2- Yes, you can use a simple boolean variable that toggles from true to false, but the series part is so you can access it in history."
So if I don't need the history, why do I need to define a boolean series?
I read through this thread and noticed that Larry had the same issue - am I to conclude that it is essential to define a boolean series?
And if I do that, will I have access to it through the strategy wizard?
Also, thanks for pointing out the significance of capitalization, duly noted.
Thanks for the patience.
Kumar
kumar is offline  
Reply With Quote
Old 08-17-2010, 08:10 AM   #9
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

kumar, you can expose either a boolean variable or boolean series - however to allow for
backesting through the wizard / Strategy Analyzer you would then indeed need the series.
NinjaTrader_Bertrand 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
Wrong Data Series plotted cborjon Version 7 Beta General Questions & Bug Reports 4 07-27-2010 02:43 PM
ZeroLagEMA returning 0 RandyT General Programming 3 07-15-2009 08:45 AM
Add daily series to minute series binwang2 General Programming 4 04-06-2009 08:56 AM
Problem returning value from WCCI CashCache Strategy Development 2 01-08-2008 06:10 PM
Indicator returning more than one value ryker General Programming 2 12-06-2007 02:22 AM


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