![]() |
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: Dec 2007
Location: Atlanta
Posts: 281
Thanks: 0
Thanked 4 times in 3 posts
|
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 |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
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.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2007
Location: Atlanta
Posts: 281
Thanks: 0
Thanked 4 times in 3 posts
|
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. |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
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
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Dec 2007
Location: Atlanta
Posts: 281
Thanks: 0
Thanked 4 times in 3 posts
|
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 |
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
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.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Dec 2007
Location: Atlanta
Posts: 281
Thanks: 0
Thanked 4 times in 3 posts
|
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 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |