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 > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 05-23-2012, 12:02 PM   #1
dunwoodyjr
Member
 
Join Date: Aug 2009
Posts: 34
Thanks: 0
Thanked 1 time in 1 post
Default Log Error regarding an Indicator

I thought I found the problem, but apparently I did not. The log is telling me that my McClellan Oscillator, an imported indicator, has an error:

Failed to call method 'Initialize' for indicator 'McClellan Oscillator'; 'Add' method only accepts positive 'period' values, but was -1 Min

The category is Default, so I am not to sure where to start looking to fix the error.

I am using the McCOsc in several different strategies.

Thank you in advance...
dunwoodyjr is offline  
Reply With Quote
Old 05-23-2012, 12:30 PM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello dunwoodyjr,
Can you tell me does the McClellan Oscillator indicator is a multi series indicator. If so, can you tell, what exact code you have written to Add the the secondary data series.

You can find the Add() method in the Initialize section of the indicator.

I look forward to assisting you further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 05-23-2012, 12:38 PM   #3
dunwoodyjr
Member
 
Join Date: Aug 2009
Posts: 34
Thanks: 0
Thanked 1 time in 1 post
Default

In one strategy it looks like this:

protected override void Initialize()
{
Add(TripMOMO(15, 25, 5));
Add(EMA50vs200(200, 50));
Add(RSI(12, 1));
Add(EMA(eMA1st));
Add(ADX(14));
Add(EMA(eMA2nd));
Add(EMA(50));
Add(Bollinger(bBstandarddevside, 20));
Add(McClellanOscillator(19,39));

EMA(eMA1st).Plots[0].Pen.Color = Color.Blue;
EMA(eMA2nd).Plots[0].Pen.Color = Color.Black;
EMA(50).Plots[0].Pen.Color = Color.Green;
McClellanOscillator(19,39).Plots[0].Pen.Color = Color.Chocolate;

EntryHandling = EntryHandling.UniqueEntries;

SetProfitTarget("Enter Short", CalculationMode.Percent, Closeshort);
SetTrailStop("Enter Short", CalculationMode.Percent, Trailingshort, true);

CalculateOnBarClose = true;
}


Thing is, I don't notice it effect the strategy. It compiles fine and runs well. I just keep getting about 15 errors each time I compile or run a back test...
dunwoodyjr is offline  
Reply With Quote
Old 05-23-2012, 12:57 PM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello dunwoodyjr,
Thank for the code. Unfortunately this is the code which you have used in the Initialize section of the strategy. I need the code of the initialize section of the McClellanOscillator indicator.

In Control Center menu bar goto Tools>Edit NinjaScript>Indicators...
In the Indicator dialog select McClellanOscillator and click on the Ok button.
Please send the code of the Initialize section of the indicator.


I look forward to assisting you further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 05-23-2012, 01:05 PM   #5
dunwoodyjr
Member
 
Join Date: Aug 2009
Posts: 34
Thanks: 0
Thanked 1 time in 1 post
Default

{
Add("NYSE_AD", BarsPeriod.Id, BarsPeriod.Value);
Add(new Plot(Color.FromKnownColor(KnownColor.Lime), PlotStyle.Line, "McClellanUpper"));
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "McClellanLower"));

Plots[0].Min = 0;
Plots[1].Max = 0;

DrawOnPricePanel = false;
Overlay = false;
}

Sooo, I guess that the "NYSE_AD" is the cause. It does have negative values in it's series. How do I change the code to allow for negative values? Or can I? Thanks!!!
dunwoodyjr is offline  
Reply With Quote
Old 05-23-2012, 01:13 PM   #6
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello,
The default symbol in NinjaTrader for NYSE Advance decline is ADD.
Please change the code
Code:
Add("NYSE_AD", BarsPeriod.Id, BarsPeriod.Value);
to
Code:
Add("ADD", BarsPeriod.Id, BarsPeriod.Value);
Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 05-23-2012, 12:33 PM   #7
Camron
Junior Member
 
Join Date: Apr 2012
Posts: 16
Thanks: 0
Thanked 0 times in 0 posts
Default

HOw do you erase your past order entry information from being displayed on the chart screen?
Camron is offline  
Reply With Quote
Old 05-23-2012, 12:38 PM   #8
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Camron,
Please follow the instructions below to disable the plotting of trade executions.
  • Right click in your chart and select the menu "Data Series..."
  • Find the "Plot executions" parameter for each data series and change the value to "DoNotPlot"
  • Press the "OK" button
See here for more information on working with Data Series > How to edit Data Series parameters:
http://www.ninjatrader.com/support/h...price_data.htm
NinjaTrader_Joydeep 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
Log - "Error plotting values to chart data box for indicator" BrianL Miscellaneous Support 10 10-27-2012 07:03 AM
Error Log Mindset Suggestions And Feedback 3 08-17-2010 05:22 AM
Help with Log error huracan Indicator Development 4 10-01-2009 02:41 PM
Missing Indicator Log Error snaphook Miscellaneous Support 5 06-05-2009 06:21 AM
Error in log SuzyG Strategy Development 4 01-17-2007 01:17 AM


All times are GMT -6. The time now is 08:46 PM.