- ago
The SMMA indicator produces no output (i.e. NaN) when the input to it is from certain indicators such as LRSlope. The last plot in the code below produces nothing. I'm running WL8 Build 47.
CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; namespace WealthScript2 {    public class PolyScreener : UserStrategyBase    {       public override void Initialize(BarHistory bars)       {          IndicatorBase smma = new SMMA(bars.Close, 5);          PlotIndicatorLine(smma, WLColor.YellowGreen); //works          IndicatorBase slope = new LRSlope(bars.Close, 4);          IndicatorBase smmaSlope = new SMMA(slope, 5);          PlotIndicatorLine(smmaSlope, WLColor.Green); //fails       }       public override void Execute(BarHistory bars, int idx) { }    } }
0
220
Solved
3 Replies

Reply

Bookmark

Sort
- ago
#1
This is not a bug. LRSlope is programmed to return NaN for the first few bars which confuses SMMA. I'm sure we can work around this for next build though.
0
- ago
#2
QUOTE:
LRSlope is programmed to return NaN for the first few bars which confuses SMMA.

Padding the LRSlope output, then feeding it into SMMA doesn't fix the problem. I think the SMMA indicator has a more serious problem. SMMA works fine on WL6.
CODE:
   public override void Initialize(BarHistory bars)    {       //IndicatorBase smma = new SMMA(bars.Close, 5);       //PlotIndicatorLine(smma, WLColor.YellowGreen);       IndicatorBase slope = new LRSlope(bars.Close, 4);       PlotIndicatorLine(slope, WLColor.Orange);       for (int bar = 0; bar < slope.FirstValidIndex; bar++)          slope[bar] = 10.0;       slope.FirstValidIndex = 0;       IndicatorBase smmaSlope = new SMMA(slope, 5);       PlotIndicatorLine(smmaSlope, WLColor.Green);    }
0
- ago
#3
I've fixed the SMMA for B49 already.
2
Best Answer

Reply

Bookmark

Sort