![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2006
Location: Seattle, Washington, USA
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
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 } } |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
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?
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2006
Location: Seattle, Washington, USA
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Dec 2006
Location: Seattle, Washington, USA
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#5 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |