![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jan 2007
Location: , ,
Posts: 133
Thanks: 1
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jan 2007
Location: , ,
Posts: 133
Thanks: 1
Thanked 0 times in 0 posts
|
great - thanks very much ....
|
|
|
|
|
|
#4 | |
|
Member
Join Date: Sep 2009
Location: MA
Posts: 92
Thanks: 2
Thanked 1 time in 1 post
|
Quote:
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 |
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
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.
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Member
Join Date: Sep 2009
Location: MA
Posts: 92
Thanks: 2
Thanked 1 time in 1 post
|
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 |
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
|
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.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Member
Join Date: Sep 2009
Location: MA
Posts: 92
Thanks: 2
Thanked 1 time in 1 post
|
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 |
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
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.
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |