When calling the PlotTimeSeriesOscillator with WLColor.Transparent as one of the fill colors, the transparent color creates black fill. Is there a workaround for this? I'm running WL8 Build 109.
The upper example is what I actually want, but without the yellow fill below the origin.

The upper example is what I actually want, but without the yellow fill below the origin.
CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; namespace WealthScript3 { public class MyStrategy : UserStrategyBase { public override void Initialize(BarHistory bars) { IndicatorBase roc = ROC.Series(bars.Close,20); PlotTimeSeriesOscillator(roc*2.0, roc.Description, "upperPane", 0.0, 0.0, WLColor.Brown.SetAlpha(140), WLColor.Yellow, WLColor.Yellow, 150); PlotTimeSeriesOscillator(roc, roc.Description, "upperPane", 0.0, 0.0, WLColor.SteelBlue, WLColor.Salmon, WLColor.Green, 250); //now with WLColor.Transparent fill, which comes out black PlotTimeSeriesOscillator(roc*2.0, roc.Description, "lowerPane", 0.0, 0.0, WLColor.Brown.SetAlpha(140), WLColor.Transparent, WLColor.Yellow, 150); PlotTimeSeriesOscillator(roc, roc.Description, "lowerPane", 0.0, 0.0, WLColor.SteelBlue, WLColor.Salmon, WLColor.Green, 250); } public override void Execute(BarHistory bars, int idx) { } } }
Rename
The Oscillator Plot Style is assuming you're defining the desired Opacity in the Opacity parameter. It's ignoring the Alpha specified in the colors.
We can improve it for the next build so it can use the Alpha for the color if specified.
And note: the Opacity parameter is a value from 0 (transparent) to 100 (opaque) not a byte.
We can improve it for the next build so it can use the Alpha for the color if specified.
And note: the Opacity parameter is a value from 0 (transparent) to 100 (opaque) not a byte.
QUOTE:
the Opacity parameter is a value from 0 (transparent) to 100 (opaque) not a byte.
I didn't know that. Thanks for correcting me.
I would prefer to have a compile-time error instead of a run-time error. So if the compiler could catch the mistake if opacity were defined as a "byte" instead of an "int", that would be better. (It's probably too late to change it now.)
I did remove the SetAlpha property and update the opacity to 100, but WLColor.Transparent still comes out black. So there's still some kind of problem there.
It’s not using the Alpha component of the color. It’s always using the Opacity parameter. Since you set it to 100% it will fill with 255, 0, 0, 0 which is black.
It’ll work the way you expected in the next build.
It’ll work the way you expected in the next build.
Your Response
Post
Edit Post
Login is required