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 07-23-2010, 12:00 PM   #16
RJay
Senior Member
 
Join Date: May 2008
Location: Hartford, CT. USA
Posts: 618
Thanks: 13
Thanked 24 times in 18 posts
Default

Explain what it is you are trying to do again.

Maybe I'm the one who isn't understanding.
RJay is offline  
Reply With Quote
Old 07-23-2010, 12:38 PM   #17
FatCanary
Senior Member
 
Join Date: Nov 2004
Location: UK
Posts: 236
Thanks: 1
Thanked 0 times in 0 posts
Default

I have an indicator, lets call it MyIndi, that needs to access the value of T3. Both T3 and MyIndi are on the same chart.

Currently I have T3 parameters as (34, 3, 0.01). In MyIndi I am accessing T3 with:
if(High[0] > T3(34,3,0.01)[0])
do something...

This works fine but if I changed T3 (on the chart) to, say, (21, 3, 0.5) MyIndi would still be accessing
T3(34,3,0.01)[0].

I would like MyIndi to access whatever parameters T3 is currently set to. So if T3 is changed I would not have to change MyIndi.

I hope this is a bit clearer :-)

Also, thanks for your patience.
FatCanary is offline  
Reply With Quote
Old 07-23-2010, 02:06 PM   #18
RJay
Senior Member
 
Join Date: May 2008
Location: Hartford, CT. USA
Posts: 618
Thanks: 13
Thanked 24 times in 18 posts
Default

Quote:
Originally Posted by FatCanary View Post
I have an indicator, lets call it MyIndi, that needs to access the value of T3. Both T3 and MyIndi are on the same chart.

Currently I have T3 parameters as (34, 3, 0.01). In MyIndi I am accessing T3 with:
if(High[0] > T3(34,3,0.01)[0])
do something...

This works fine but if I changed T3 (on the chart) to, say, (21, 3, 0.5) MyIndi would still be accessing
T3(34,3,0.01)[0].

I would like MyIndi to access whatever parameters T3 is currently set to. So if T3 is changed I would not have to change MyIndi.

I hope this is a bit clearer :-)

Also, thanks for your patience.
FatCanary,

This should be quite simple.

save T3 under a new name. (No editing NT stock indicators)

add the following code line in onBarUpdate.

if(High[0] > T3(period, tCount, vFactor)[0]) // Do Something!!!

Now your parameters in this indicator will control your new T3 version as well as the parameters to the original T3 feeding into your indicator.

Only use the new indicator. T3 does not need to be on the chart.

The only thing left is the "do something ".



RJay


P.S. this can also be done without the T3 feed. Simply compare the Value[0] to Open[0] .
Last edited by RJay; 07-23-2010 at 02:16 PM.
RJay is offline  
Reply With Quote
Old 07-23-2010, 02:43 PM   #19
FatCanary
Senior Member
 
Join Date: Nov 2004
Location: UK
Posts: 236
Thanks: 1
Thanked 0 times in 0 posts
Talking

Aha!! Never thought of doing it like that, it works great.

Many, many thanks.

Can I push my luck with your generosity just a little further? :-)

You mention:
P.S. this can also be done without the T3 feed. Simply compare the Value[0] to Open[0]

Could you explain 'simply compare the Value[0] to Open[0]' a bit further please.
FatCanary is offline  
Reply With Quote
Old 07-23-2010, 04:54 PM   #20
RJay
Senior Member
 
Join Date: May 2008
Location: Hartford, CT. USA
Posts: 618
Thanks: 13
Thanked 24 times in 18 posts
Default

Quote:
Originally Posted by FatCanary View Post
Aha!! Never thought of doing it like that, it works great.

Many, many thanks.

Can I push my luck with your generosity just a little further? :-)

You mention:
P.S. this can also be done without the T3 feed. Simply compare the Value[0] to Open[0]

Could you explain 'simply compare the Value[0] to Open[0]' a bit further please.

OK,

Temporarily, comment out the input feed from T3 and add this if statement at this location in the code.


CalculateGD((DataSeries) seriesCollection[seriesCollection.Count - 1], Values[0]);

if(High[0] > Values[0]) // Do Something
}



RJay
RJay is offline  
Reply With Quote
Old 07-25-2010, 03:05 PM   #21
FatCanary
Senior Member
 
Join Date: Nov 2004
Location: UK
Posts: 236
Thanks: 1
Thanked 0 times in 0 posts
Default

Hi RJay

Right, got it. Although I had to change Values[0] to Value[0].
Values[0] was giving a compile error saying 'Operator '>' cannot be applied to operands type 'double' and DataSeries'.

Once again many thanks for the help. I won't take up any more of your time!
FatCanary 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
Strategy Analyzer + Varying Tick Timeframe cgeorgan Version 7 Beta General Questions & Bug Reports 1 07-01-2010 09:08 AM
Indicator Accessing Indicator Where User Has Set Parameters dkrumholz Indicator Development 1 04-27-2010 02:56 PM
Indicator Parameters in a Strategy laocoon Strategy Development 1 10-08-2009 04:11 AM
How to add additional/optional parameters to an indicator? isitpossible Indicator Development 2 08-11-2009 06:42 AM
Indicator parameters from within a strategy astrolobe Indicator Development 1 06-20-2009 11:05 PM


All times are GMT -6. The time now is 01:36 PM.