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 11-04-2008, 05:49 AM   #1
TAJTrades
Senior Member
 
Join Date: Dec 2007
Location: Atlanta
Posts: 281
Thanks: 0
Thanked 4 times in 3 posts
Default Indicator could not be serialized

Ninja Folks,

I created an indicator that compiled with no problems. However, when I tried to Save the Workspace I received the Error "Indicator could not be serialized. Please refer help for more information on serializing indicators". I hit the F1 (F1 and I have become very close friends) key and found nothing to help diagnose this issue.

Can you point me in the right direction?

Thanks
TAJTrades is offline  
Reply With Quote
Old 11-04-2008, 08:40 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Hi TAJTrades,

Is your indicator running on a chart somewhere? Please try removing the indicator from any running instances and see what happens. Then try removing the indicator from NinjaTrader altogether. Backup your code first. See what happens then.

If you still get the error then it is something with the code. Please upload the code here then we can take a quick glance through at it to see if we see anything out of the ordinary.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-04-2008, 02:47 PM   #3
TAJTrades
Senior Member
 
Join Date: Dec 2007
Location: Atlanta
Posts: 281
Thanks: 0
Thanked 4 times in 3 posts
Default

Josh,

"Is your indicator running on a chart somewhere? Please try removing the indicator from any running instances and see what happens."

When I removed the indicator and the strategy calling the indicator form the chart the workspace closed with NO error message.

Here is the situation:
- Indicator creates 2 DataSeries with values of 0 to 20 (integers, no decimals)
- Indicator creates Trend Lines on the chart.
- A Strategy calls the DataSeries for input into the Strategy with the line:
IndicatorV5(80,1,5,20,40,period1,period2,true).bea rishDivergenceCount[1];

Indicator results:
-Trend Lines are drawn as expected
-DataSeries values created as expected per the Output Window
- The Strategy is accessing the Indicator DataSeries as it is firing off trades in the Sim101 Account.


My guess is that I have not defined the DataSeries in a way that Ninja needs to have everything sync and accessible. I have defined the DataSeries as follows:

#region Variables
(Other Inputs);

public DataSeries bullishDivergenceCount; // DataSeries Bullish Divergence;
public DataSeries bearishDivergenceCount; // DataSeries Bullish Divergence;

#endregion

protected override void Initialize()
{
CalculateOnBarClose = true;
Overlay = true;
PriceTypeSupported = false;

bullishDivergenceCount = new DataSeries(this);
bearishDivergenceCount = new DataSeries(this);

}


protected override void OnBarUpdate()
{
// Lots of code creating DataSeries Values and Trend Lines

bullishDivergenceCount.Set(Value);
bearishDivergenceCount.Set(Value); // Value being an integer number assigned to that bar

}

#region Properties
nothing pertaining to the DataSeries
#endregion


Have I defined the DataSeries correctly to sync everything and give access to the Strategy?

Many thanks for your help.
TAJTrades is offline  
Reply With Quote
Old 11-04-2008, 03:10 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

You should not create public DataSeries like that. Please check out this reference sample on how to expose DataSeries for use in strategies. http://www.ninjatrader-support.com/v...ead.php?t=4991
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-04-2008, 03:14 PM   #5
TAJTrades
Senior Member
 
Join Date: Dec 2007
Location: Atlanta
Posts: 281
Thanks: 0
Thanked 4 times in 3 posts
Default

Josh,

I just opened a fresh chart and put the Indicator on it and then Closed the Work Space. Got the same Error Message.

I repeated the process this time only putting the Strategy that calls the Indicator and closed the Work Space with the Strategy still attached. Got NO error Message.

My best guess is that the issue is with the Indicator either with defining the DataSeries or or the .Set command

Back to the drawing board.

TJ
TAJTrades is offline  
Reply With Quote
Old 11-04-2008, 03:18 PM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

TAJTrades,

Please start by using exposed properties to access the internal DataSeries objects. The reference sample I posted earlier demonstrates how to do this with a BoolSeries. It is done exactly the same way for a DataSeries.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-04-2008, 05:50 PM   #7
TAJTrades
Senior Member
 
Join Date: Dec 2007
Location: Atlanta
Posts: 281
Thanks: 0
Thanked 4 times in 3 posts
Default

Its a trick. There's two of them. Half a bottle of Merlot later I realized that SampleBoolSeries.zip has both a Strategy and Indicator in the example.

All is well. Thanks Josh
TAJTrades 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
Indicator: Removing and Custom Formatting an Indicator’s Chart Label NinjaTrader_Josh Reference Samples 0 12-30-2007 06:49 PM
Howard Indicator and Pesavento Pattern Swing Indicator DORAIRAJ_S@HOTMAIL.COM Indicator Development 1 11-12-2007 12:28 AM


All times are GMT -6. The time now is 08:33 AM.