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 04-17-2008, 04:13 PM   #1
mgbloomfield
Senior Member
 
Join Date: Dec 2006
Location: Seattle, Washington, USA
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default It's all about the Plot

I'm trying to get a plot to appear on the 2nd panel. This is the simplest indicator. It simply plots a horizontal with a value of zero on each OnBarUpdate(). After several minutes, the plot does not appear.

(Eventually, this plot will have a math formula so it's not an oscillator line per se).

namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
[Description("Enter the description of your new custom indicator here")]
public class MyCustomIndicator : Indicator
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "PlotFoobar"));
CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
PlotFoobar.Set(0);
}

#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries PlotFoobar
{
get { return Values[0]; }
}

#endregion
}
}
mgbloomfield is offline  
Reply With Quote
Old 04-17-2008, 04:50 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

Can you clarify-

- A value of zero is plotted for a few minutes and the the indicator plot vanishes?

Any error messages in the Log tab?
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-17-2008, 04:59 PM   #3
mgbloomfield
Senior Member
 
Join Date: Dec 2006
Location: Seattle, Washington, USA
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

A value of zero is NEVER plotted. It never appears.

I've tried different values: 10, 20, 30, etc.

It just never appears in the first place.

Here's some background: Earlier today, I was using OpenTick data feed and the plot lines were working. Then when the market closed, I started using the simulated data feed and the plot lines stopped appearing.

I was using the simulated data feed to fire the OnBarUpdate() event. I've verified that OnBarUpdate() is firing via custom log messages.
mgbloomfield is offline  
Reply With Quote
Old 04-17-2008, 05:06 PM   #4
mgbloomfield
Senior Member
 
Join Date: Dec 2006
Location: Seattle, Washington, USA
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

Interesting...

I can confirm that my indicators visibly plots a line when using OpenTick. It does NOT plot a line when using the simulated data feed.

But why? It shouldn't make a difference?
mgbloomfield is offline  
Reply With Quote
Old 04-17-2008, 07:03 PM   #5
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

When you run in the sim feed are there any historical bars? If not, you might have to wait 20 bars before you start to see a line.
NinjaTrader_Ray 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
Plot Override chantj Indicator Development 2 04-09-2008 09:10 AM
Shorten a plot? Burga1 Indicator Development 9 03-28-2008 12:59 PM
Cannot Plot High or Low NinjaCustomer Indicator Development 8 01-31-2008 12:20 PM
Limiting a Plot rt-trader General Programming 2 08-25-2007 06:21 PM
Hiding a plot grd974 Indicator Development 5 05-28-2007 01:47 PM


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