I want to use TimeSeries as a source for NeuroLab.
I have read everything on this forum. But it all doesn't work.
As a data source I take TimeSeries from sentimentrader.com and then load it into wealth-lab 8 using ASCII Data. Naturally, everything is loaded and displayed on charts. But in NL as an input vector is not
as input vector. It is written that only indicators can be dragged.
To build an indicator from this data, I decided to take the standard example for building an indicator in wealth-lab 8 based on SMA. I simply replace
String //
TimeSeries source = Parameters[0].AsTimeSeries; to
TimeSeries source = new SymbolInd(Bars,new
SMA(Bars.Close,1), ‘MODEL_CNN_FEAR_GREED’);
If we set the values for the indicator SMA(1) then
we get the original values of ASCII Data. This new client indicator built by me works on charts and when building on cubes, but when dragging it into the neural network it gives a failure message.
What can I do to load, for example, MODEL_CNN_FEAR_GREED into NL as an indicator? Here is the code of my indicator, and I would be extremely grateful if you would make changes in it, i.e. that I would have an example of a working full corrected code.
I have read everything on this forum. But it all doesn't work.
As a data source I take TimeSeries from sentimentrader.com and then load it into wealth-lab 8 using ASCII Data. Naturally, everything is loaded and displayed on charts. But in NL as an input vector is not
as input vector. It is written that only indicators can be dragged.
To build an indicator from this data, I decided to take the standard example for building an indicator in wealth-lab 8 based on SMA. I simply replace
String //
TimeSeries source = Parameters[0].AsTimeSeries; to
TimeSeries source = new SymbolInd(Bars,new
SMA(Bars.Close,1), ‘MODEL_CNN_FEAR_GREED’);
If we set the values for the indicator SMA(1) then
we get the original values of ASCII Data. This new client indicator built by me works on charts and when building on cubes, but when dragging it into the neural network it gives a failure message.
What can I do to load, for example, MODEL_CNN_FEAR_GREED into NL as an indicator? Here is the code of my indicator, and I would be extremely grateful if you would make changes in it, i.e. that I would have an example of a working full corrected code.
CODE:
using WealthLab.Core; using System; using WealthLab.Indicators; namespace WealthLab.MyIndicators { public class CustomSMA : IndicatorBase { //parameterless constructor public CustomSMA() : base() { } //for code based construction public CustomSMA(TimeSeries source, int period) : base() { Parameters[0].Value = source; Parameters[1].Value = period; Populate(); } //static method public static CustomSMA Series(TimeSeries source, int period) { return new CustomSMA(source, period); } //name public override string Name { get { return "Simple Moving Average"; } } //abbreviation public override string Abbreviation { get { return "SMA"; } } //description public override string HelpDescription { get { return "Simple average of a range of values."; } } //price pane public override string PaneTag { get { return "Price"; } } //it's a smoother public override bool IsSmoother { get { return true; } } //populate public override void Populate() { TimeSeries source = new SymbolInd(Bars,new SMA(Bars.Close,1),"MODEL_CNN_FEAR_GREED"); // TimeSeries source = Parameters[0].AsTimeSeries; Int32 period = Parameters[1].AsInt; DateTimes = source.DateTimes; if (period <= 0) return; for (int n = period - 1; n < source.Count; n++) Values[n] = CustomSMA.Value(n, source, period); } //calculate an ad-hoc SMA at a specific point public static double Value(int idx, TimeSeries source, int period) { if (period <= 0 || idx >= source.Count || (idx - period + 1) < 0) return Double.NaN; double sum = 0; for (int n = 0; n < period; n++) { var i = idx - n; sum += source[i]; } return sum / period; } //generate parameters protected override void GenerateParameters() { AddParameter("Source", ParameterType.TimeSeries, PriceComponent.Close); AddParameter("Period", ParameterType.Int32, 1); } } }
Rename
You didn't have to go so far because you can select Open, High, Low, Close, Volume, Average* prices, etc. as indicators too. For an external symbol, use the SymbolData or SymbolInd (Transformer group of indicators), enter your symbol, and select the Close series.
Thanks for the tip, it turned out to be considerably simpler.
Your Response
Post
Edit Post
Login is required