![]() |
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
|
|||||||
| Version 7 Beta General Questions & Bug Reports Ask questions here and post bug reports. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Apr 2010
Posts: 1,058
Thanks: 33
Thanked 2 times in 1 post
|
I just wrote an indicator and tested it on a chart and it all looks OK.
I then added it to a strategy so I can compare the indicator to the trades, but it throws this error: Assertion failed: abort, retry, ignore? IndicatorBase.InputInitialize followed by a stacktrace. I tried removing all my script from my indicator so that it's just a shell with nothing in the event methods, but it still happens. I have added it in the same way in the strategy's initialize method as I added the other indicators I am using. What is this InputInitialize assertion? What am I doing wrong or is there any way I can fix this? Thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Nov 2009
Location: Denver, CO
Posts: 1,424
Thanks: 0
Thanked 3 times in 3 posts
|
Hi adamus,
Can you please clarify how you "added this to a strategy"? Did you move code to the strategy? Call if from a strategy?
Tim
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Apr 2010
Posts: 1,058
Thanks: 33
Thanked 2 times in 1 post
|
It's the indicator called PivotPoint. This is the code from my strategy. The volatility indicator is added fine, the PivotPoint crashes it:
Code:
private Indicator.Indicator pivotPoint;
private Indicator.Indicator volatility;
// time frame / barsInProgress / Bars index
private int longTF = 0;
private int oneMin = 1;
private OrderBook orderBook;
private List<double> widths = new List<double>();
protected override void Initialize()
{
TraceOrders = false;
CalculateOnBarClose = true;
TimeInForce = Cbi.TimeInForce.Gtc;
ExitOnClose = false;
Add(PeriodType.Minute, 1);
pivotPoint = new PivotPoint();
pivotPoint.Overlay = true;
Add(pivotPoint);
volatility = SmoothMA(Day2Day(), maLength);
volatility.Plots[0].Pen.Color = Color.Green;
volatility.Panel = 1;
volatility.Overlay = true;
Add(volatility);
}
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Nov 2009
Location: Denver, CO
Posts: 1,424
Thanks: 0
Thanked 3 times in 3 posts
|
Hi adamus,
Adding the indicators in this way is unfortunately beyond the scope of support we can offer. The supported method of doing this can be seen in this sample: http://www.ninjatrader.com/support/f...ead.php?t=6651
Tim
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Apr 2010
Posts: 1,058
Thanks: 33
Thanked 2 times in 1 post
|
Tim,
that sample says explicitly that it's not for backtesting. Are you sure it's the one you had in mind? |
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
adamus,
The purpose of that link was not for backtesting or using the concepts in the sample, but more to show you how the indicator is added. There is no indicator variable created. Just add the indicator you want directly and set the properties you want accordingly directly. This would be more appropriate: http://www.ninjatrader.com/support/f...ead.php?t=3228
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Apr 2010
Posts: 1,058
Thanks: 33
Thanked 2 times in 1 post
|
OK, thanks but when I tried coding
Code:
Add(PivotPoint()); I looked at VOL() which works this way, but I couldn't see any difference in my script that would make it different. |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Apr 2010
Posts: 1,058
Thanks: 33
Thanked 2 times in 1 post
|
OK I forgot I added some parameters that have to go in the constructor. Strange that the compilation error doesn't talk about constructors though.
And now it doesn't throw the error. Thanks for the help. |
|
|
|
|
|
#9 | |
|
Senior Member
Join Date: Aug 2008
Location: Netherlands
Posts: 159
Thanks: 17
Thanked 5 times in 5 posts
|
When I try to add an indicator to an strategy (by clicking on the "Indicators" button in the GUI), I get an somewhat strange error stating:
Quote:
Any thoughts about this would be very welcome, ![]() EDIT: I've just been able to replicate this error: (Not sure if this is also a step: 0. Open a new strategy analyzer window,) 1. Create a new strategy, 2. Run a backtest with this strategy on any instrument and any time frame. 3. Go to the "Chart"-tab and click on the "Indicators" button. In my case, this still works at this stage. 5. Click again on "Run Backtest" with the same settings/parameters. 6. Navigate back to the "Chart" tab, and click on "Indicators". In my case, this results in the above mentioned error message. Does anyone know of a workaround for this, because it's quite convenient to set Default values. ![]() Regards,
Last edited by J_o_s; 09-16-2010 at 06:35 AM.
Reason: Added steps how to replicate this error
|
|
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Nov 2009
Location: Denver, CO
Posts: 1,424
Thanks: 0
Thanked 3 times in 3 posts
|
Hi J_o_s,
Try briefly selecting another instrument between your steps #5 and #6, from the left side list. Then switch back and try to add an indicator.
Tim
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Dec 2008
Location: http://coroin.com
Posts: 156
Thanks: 8
Thanked 7 times in 7 posts
|
i am adding an indicator to a strategy ... same as the original issue for this thread ... best i can tell:
1) when i instantiate an object [eg. myIndy = new MyIndy(_myVar1, _myVar2); ], it compiles, but then produces the "IndicatorBase.InputInitialize" and "barsArray[0] == null" errors; 2) when i remove the "new", i am unable to compile as i get the "is a 'type' but is used like a 'variable'" error. any insights? it would be great to know why we shouldn't instantiate an object. i thought that was the standard/preferred way of doing things. /scratches_head cheers, -e |
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 978 times in 961 posts
|
e-man, as Tim already mentioned this way of adding is not supported officially - the recommended way is layed out here - http://www.ninjatrader.com/support/f...ead.php?t=3228
Bertrand
NinjaTrader Customer Service |
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to abort Strategy Execution | aascotty | General Programming | 1 | 05-02-2010 06:53 AM |
| Adding an Indicator inside a strategy | astrolobe | Version 7 Beta General Questions & Bug Reports | 1 | 02-09-2010 08:14 AM |
| Adding Indicator to Strategy | Litter@live.com | Strategy Development | 10 | 07-23-2009 04:01 AM |
| Adding Indicator Color Lines to Strategy | duck_CA | Strategy Development | 2 | 02-21-2009 09:14 PM |
| Adding Indicator to Strategy not working | ATI user | Strategy Development | 12 | 12-18-2008 01:49 PM |