- ago
I have a WL6 indicator I'm trying to convert to WL7. The first problem is that a double[] parameter array is passed into the main constructor. I'm not even sure how to define that in WL7. But this parameter array typically takes a default, so I decided to use that default for the Populate() version of the indicator like this.
CODE:
public RankThres(TimeSeries ds4Thresholding, double centerRank) : this(ds4Thresholding, centerRank, defaultBeaconPeakReboundRange)
But that calls the main constructor which isn't properly initialized by ": base(parameters)" like it is in WL6. Instead, WL7 simply uses ": base()" instead, which doesn't initialize anything. So this workaround fails.

So how do I get the optional double[] array parameter into this indicator? Below is my workaround which fails. Maybe you can fix it; otherwise, perhaps this WL6 indicator isn't convertible to WL7 as an indicator.
CODE:
namespace WealthLab.Indicators {    public class RankThres : IndicatorBase //Threshold determining indicator via peak Rank, RankThres    {       private static readonly double[] defaultBeaconPeakReboundRange = { 0.12, 0.6 }; //default lower&upper minimum rebound limit for beacon peak detection       private enum BeaconPeakReboundRangeLimit { min, max };       public RankThres() : base() { }       public RankThres(TimeSeries ds4Thresholding, TimeSeries dsTimingBeacon, double centerRank, double[] beaconPeakReboundRange, double outlierToleranceMax = 0.11) : base()       {          //Main code in here.       }       public RankThres(TimeSeries ds4Thresholding, TimeSeries dsTimingBeacon, double centerRank, double outlierToleranceMax = 0.11) : this(ds4Thresholding, dsTimingBeacon, centerRank, defaultBeaconPeakReboundRange, outlierToleranceMax)       //public RankThres(TimeSeries ds4Thresholding, TimeSeries dsTimingBeacon, double centerRank, out double peakReboundMinOut, string description, double outlierToleranceMax = 0.11) : this(ds4Thresholding, dsTimingBeacon, centerRank, defaultBeaconPeakReboundRange, out peakReboundMinOut, description, outlierToleranceMax) { }       {          Parameters[0].Value = ds4Thresholding;          Parameters[1].Value = dsTimingBeacon;          Parameters[2].Value = centerRank;          Parameters[3].Value = outlierToleranceMax;          Populate();       }       public override void Populate()       {          TimeSeries ds4Thresholding = Parameters[0].AsTimeSeries;          TimeSeries dsTimingBeacon = Parameters[1].AsTimeSeries;          double centerRank = Parameters[2].AsDouble;          double outlierToleranceMax = Parameters[3].AsDouble;          DateTimes = ds4Thresholding.DateTimes;       }    } }

0
315
3 Replies

Reply

Bookmark

Sort
- ago
#1
And I still can't edit my original post to fix it. The [Edit] button for it is missing.

Look over my workaround to see if there's something to make it work. But without ": base()" properly initializing the main constructor, I don't think it's possible to get this workaround to work. (But could the main constructor initialize itself another way without base's help?)
0
- ago
#2
I got the code in the original post (above) to work better except for this error about the Populate() method. Could someone please tell me what's going on here?

I might add, this code works fine when inherited from TimeSeries(...), but not IndicatorBase where Populate() is required.

0
- ago
#3
Maybe if you consider a subscription to WL7 it would help the development and troubleshooting of your code?
0

Reply

Bookmark

Sort