![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Oct 2008
Location: US&A
Posts: 115
Thanks: 0
Thanked 1 time in 1 post
|
I have an indicator which needs to output an integer to strategies.
I tried an IntSeries, but am having errors with the following property; [Browsable(false)] [XmlIgnore()] public IntSeries GridValue { get { return gridValue[1]; }// error here } EDIT: I am receiving an error which states 'Cannot implicitly convert int to NinjaTrader.Data.IntSeries'. How else can I output an integer value from an indicator without it being 'set' as above, so its value may be used within Strategies ??
Last edited by Faspomy; 11-01-2008 at 09:31 AM.
|
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
I suspect 'gridValue' is in fact your IntSeries? If yes, then:
return gridValue; is sufficient. If you want to return the actual integer value and not the series, then change to: public int GridValue
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Oct 2008
Location: US&A
Posts: 115
Thanks: 0
Thanked 1 time in 1 post
|
Thank you Ray.
I'm not sure what you mean by " If you want to return the actual integer value and not the series, then change to: public int GridValue" Will a series allow me to read integer values set by the indicator ? For example; PHP Code:
When I create a public int, the value is browsable, and is pre-set within the indicator's properties. Example; MyIndicator(GridValue, period) How can I gain access to GridValue's output from the indicator, without having its value pre-set as above ?
Last edited by Faspomy; 11-01-2008 at 12:48 PM.
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
gridValue is a series of values, an array for arguments sake. If you want to expose the entire array, then
return gridValue; if you only want to return the current bar value held by the gridValue series, then public int GridValue
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Oct 2008
Location: US&A
Posts: 115
Thanks: 0
Thanked 1 time in 1 post
|
Thank you Ray.
I changed to an integer PHP Code:
PHP Code:
PHP Code:
Also, I am receiving "gridValue = 10" & " gridValue = 20" printing-out to the output window, at the same time, on every bar. Questions; - am I formatting the integer correctly in the indicator ? - do conditionals work differently in an indicator versus a strategy ? If not, why would I be receiving erroneous results ?
Last edited by Faspomy; 11-02-2008 at 08:00 PM.
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
This link has a reference sample that shows how to make a variable exposed: http://www.ninjatrader-support.com/v...ead.php?t=4991 Notice what is going on in the Properties area and how Update() is used.
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Oct 2008
Location: US&A
Posts: 115
Thanks: 0
Thanked 1 time in 1 post
|
Ban,
thank you. That should solve the update problem. ![]() I am still having a problem, though, with the values being printed-out to the output window as both '20' and '10' on each bar. Am I missing something ? |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
Try removing the ";" after each condition and see if it works better. Also you do not need to use SMA(14).Value and SMA(7).Value. Do it this way: if (CrossAbove(SMA(14), SMA(7), 1)) { gridValue = 10; Print(“gridValue = 10”); }
Ben
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Not integer thresholds for indicators | stefy | Strategy Development | 2 | 06-12-2008 02:42 PM |
| dataseries integer values? | Burga1 | General Programming | 5 | 04-09-2008 08:53 PM |
| Prevent NT to round EMA value to integer | Nick88 | Charting | 3 | 03-10-2008 08:39 AM |
| Rounding off to an integer? | Burga1 | General Programming | 1 | 01-02-2008 10:20 PM |
| error combining ema with an integer | Thomas | Strategy Development | 3 | 08-16-2007 05:40 AM |