NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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 10-28-2009, 11:48 AM   #1
TradingDreamer
Member
 
Join Date: Aug 2009
Posts: 47
Thanks: 0
Thanked 0 times in 0 posts
Default Custome Indicator Issue: Simple assignment issue

I am puzzled why the code below in the indicator won't show on the chart when I use a DataSeries variable called AD to set a value, but if I set my new indicator (AdMA) to a hard coded value, it shows on the chart. I also know that AD has values, because it shows on the chart (Values[0]). My new one is Values[1]).

protected override void Initialize()
{
Add(new Plot(Color.Green, PlotStyle.Line, "AD"));
Add(new Plot(Color.YellowGreen, PlotStyle.Line, "AdMa"));
//dsAD = new DataSeries(this);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
double dBuff = 0;
int i=0;

AD.Set((CurrentBar == 0 ? 0 : AD[1]) + (High[0] != Low[0] ? (((Close[0] - Low[0]) - (High[0] - Close[0])) / (High[0] - Low[0])) * Volume[0] : 0));


for (i = 0; i < period; i++)
{
dBuff = dBuff + AD[i]; // ISSUE!!!!
}

AdMa.Set(0, dBuff);
}

public DataSeries AD
{
get { return Values[0]; }
}

public DataSeries AdMa
{
get { return Values[1]; }
}
TradingDreamer is offline  
Reply With Quote
Old 10-28-2009, 12:07 PM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

Do you see any errors in the log? Most likely run into this issue here -

http://www.ninjatrader-support2.com/...ead.php?t=3170
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 10-28-2009, 01:25 PM   #3
TradingDreamer
Member
 
Join Date: Aug 2009
Posts: 47
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you. That was the issue!

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Do you see any errors in the log? Most likely run into this issue here -

http://www.ninjatrader-support2.com/...ead.php?t=3170
TradingDreamer 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
Vista 64bit - Indicator issue thanga Installation and Licensing 6 09-11-2009 08:38 AM
Connection Issue Garro Installation and Licensing 0 06-15-2009 08:26 PM
NT support: please tell me if this is a simulator issue or a live trading issue! JS999 SuperDOM and other Order Entry Windows 14 04-28-2009 09:28 AM
Issue with indicator display on charts kashman Charting 0 04-11-2009 11:47 PM
Arbitrage issue... frostengine Miscellaneous Support 4 01-12-2009 02:58 PM


All times are GMT -6. The time now is 10:40 PM.