![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Greetings,
Can I get an explanation as to why I cannot add variables/plots to my indicators? Although it compiles there is no plot being made... #region Variables double VSLOPE; double VSLOPE2; double VSLOPE_DIFF; double VSLOPE_ROC; #endregion protectedoverridevoid Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "ROC")); } protectedoverridevoid OnBarUpdate() { VSLOPE = TRENDSLOPE[0]; VSLOPE2 = TRENDSLOPE[1]; VSLOPE_DIFF = Math.Abs(VSLOPE - VSLOPE2); VSLOPE_ROC = Math.Abs(VSLOPE_DIFF / VSLOPE2); ROC.Set(VSLOPE_ROC); } Any explanation would be GREATLY appreciated, it is very frustrating to not have these plots and not know why... |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Not sure what TRENDSLOPE[] is, but check your logs for errors. Use print functions to debug at each step.
You will also most likely need to watch out for division by 0.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2006
Location: Seattle, Washington, USA
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
Does your ROC have a DataSeries?
Do you have something like this in your code? #region Properties [Browsable(false)] [XmlIgnore()] public DataSeries ROC { get { return Values[0]; } } #endregion |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the replies. Yes I do have the commands in the Properties similar to as shown. What is a "Plot method: Overflow Error"??
Is there a way to have Plot info display in the "Data Box" however NOT PLOT on the indicator display itself? I simply want a quick and easy way to view the data values, not necessarily anything displayed visually...I'm trying to plot the data for 1 plot but only display the values in the Data Box for another... |
|
|
|
|
|
#5 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
>> "Plot method: Overflow Error"
Where have you seen this. a) on a NT standard indicator? which one or b) on a custom indicator? or c) on a custom indicator where you have overwitten the Plot() method?
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Hi,
On a custom indicator where I have added a Plot() method, not overwritten...the original Plot() is still there. The error is in the log. |
|
|
|
|
|
#7 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
- can you reproduce this issue in the logs?
- are you on latest 6.5.1000.1?
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Yes on both questions.
|
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
|
|
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Yes, I have such a condition already. Here is the complete code within OnBarUpdate:
if(CurrentBar < 50){return;} Print(Time[0].ToString()); Print("Current CurrentBar = " + CurrentBar); TRENDSLOPE.Set(Slope(FIBTREND(1).Middle, 2, 0)); //VSLOPE = TRENDSLOPE[0]; VSLOPE2 = TRENDSLOPE[1]; VSLOPE_DIFF = Math.Abs(VSLOPE - VSLOPE2); //VSLOPE_ROC = Math.Abs(VSLOPE_DIFF / VSLOPE2); ROC.Set(VSLOPE_ROC); The above works fine with everything commented out as displayed. When I "uncomment" those lines that causes the "re-producable" error in the log about the Overflow... |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Jan 2008
Posts: 257
Thanks: 0
Thanked 0 times in 0 posts
|
When VSLOPE2 == 0 it would cause an overflow. divided by 0.
|
|
|
|
|
|
#12 |
|
Senior Member
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
|
Well, when all else fails, you can always open the Output window and just pepper your code with Print statements.
But it sounds like you need to do this in your Plot() method. If you add the Print statements and open your Output window, it will become obvious what's going on (or at least what statement is objectionable). This is generally just a 5 to 10 minute exercise, start to finish. |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
divide by 0 errors normally appear in the log...do they not? I know I've seen them before there so I assume they always do so.
|
|
|
|
|
|
#14 |
|
Senior Member
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
|
Divide by zero would display an error in the log... if it gets that far.
What I would do is this: put in some Print statements and see. It's less typing to put in a Print statement than to answer this post! |
|
|
|
|
|
#15 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Great. Please send this info to "christian AT ninjatrader DOT com" and refer to this post:
- your custom indicator in question - your zipped DB (e.g. by Help->Mail to support) - which instrument is this? - which indicator settings have you applied? Thanks
Dierk
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding Plots to Strategy's... | Sidhartha | Strategy Development | 2 | 04-14-2008 06:32 AM |
| plots converging | ATI user | General Programming | 8 | 03-11-2008 04:15 PM |
| How come plots disappear ? | grd974 | Indicator Development | 1 | 12-02-2007 06:38 PM |
| Adding Plots | rt-trader | General Programming | 5 | 02-09-2007 01:01 AM |
| Plots[?].Min & Plots[?].Max Don't work | AlohaBob | Indicator Development | 6 | 01-06-2007 08:31 PM |