View Full Version : Stochastics not plotting - with Attachment to reproduce
tazatek
03-27-2010, 02:22 PM
I've tried to create as minimal of a test scenario as I can.
This works in NT6.5, but not in NT7 B12
Not sure if I've missed one of the upgrade guidelines, have a system problem, or if this is a bug.
Essentially, I've duped my exact scenario that I have in a full blown indicator, so I've got the exact functions (even if empty in the example), just to duplicate it as I'm using it.
Essentially, in NT7, there is a straight line drawn on the bottom.
In NT6.5, Stochastics are drawn.
Could someone take a moment and identify if this is a coding error on my behalf, if I've stumbled onto something bigger, or doing something I'm not supposed too (like an unsupported feature of some kind)
Thanks
Matt
NinjaTrader_Austin
03-27-2010, 03:37 PM
tazatek, are there any errors in the logs (right-most tab of Control Center)? By "straight line drawn on the bottom" do you mean that nothing is plotted or the plot never changes?
tazatek
03-27-2010, 03:49 PM
Nothing in the logs...
By straight line, I mean a line with a pricemarker of 0 for the entire history of data...
If you run the demo that I uploaded, and open up an output window, you'll see that the input values are good values, but when Stochastics() is called with those parameters, 0 is returned.
I just had it happen to another one of my indicators that I'm working on too... it must be something I'm doing, but I can't seem to see it.
Did you have a chance to run the indicator I uploaded? What should be a stochastic is just a horizontal line at price 0.
Matt
tazatek
03-27-2010, 07:27 PM
I think that this is actually a dup of my other thread here. They presented differently so I initially opened them as two different issues.
http://www.ninjatrader-support2.com/vb/showthread.php?p=154881#post154881
NinjaTrader_Josh
03-29-2010, 09:06 AM
tazatek,
You cannot do this line:
Indicator = Stochastics(slowPeriodD, slowPeriodK, slowSmooth);
This is not supported.
tazatek
03-29-2010, 09:12 AM
so what would be the right way to initialize such an IDataSeries with something that is going to hold an indicator series?
NinjaTrader_Josh
03-29-2010, 09:56 AM
tazatek,
Why can't you just call the indicator directly like how you are already doing in OnBarUpdate()?
Otherwise I believe you can try something like this (Note that this is unsupported):
private Stochastics someStoch;
tazatek
03-29-2010, 10:37 AM
tazatek,
Why can't you just call the indicator directly like how you are already doing in OnBarUpdate()?
Otherwise I believe you can try something like this (Note that this is unsupported):
private Stochastics someStoch;
I'm passing a DataSeries (Indicator) around into several functions....of which the indicator isn't set at compile time, but at run time (via a dropdown).
Things work fine in NT 6.5, but seems to be breaking in NT7
The example is just a slimmed down version of something much more complex... so I can't just do what I'm doing.
I don't think I'm doing anything too off the wall, but some suggestion of something that will work in NT 7 would be appreciated.
Surely there's a supported way of doing this?
Thanks
Matt
tazatek
03-29-2010, 10:51 AM
Would something like this work/be supported?
IDataSeries Indicator
Indicator = new DataSeries(Stochastics(14,7,3));
NinjaTrader_Josh
03-29-2010, 11:03 AM
Unfortunately not.
What you could try is just create a generic DataSeries then use a switch to decide what values to set it to that DataSeries through .Set()
tazatek
03-29-2010, 11:32 AM
Unfortunately not.
What you could try is just create a generic DataSeries then use a switch to decide what values to set it to that DataSeries through .Set()
So for every barupdate() I'll need to take the result of the indicator, and Set() it into a generic dataseries?
That seems like a safe way to do it...
Do I use an IDataSeries, or just a DataSeries?
Thanks for your suggestion.
Matt
NinjaTrader_Josh
03-29-2010, 11:37 AM
Variables region
private DataSeries someSeries;
Initialize()
someSeries = new DataSeries(this);
OnBarUpdate() in some switch
someSeries.Set(Stochastics(7, 14, 3)[0]);