I am venturing into building custom indicators (totally new to me) . Wonder if anyone can give me a little help.
I would like to create the RSI of an EMA(Close-Open) as an indicator (slight different from WL8's RSEMA by Vitali Apirine)
The strategy c# code is :
where period1-2 are external parameters
After looking into the New Indicator template I am not sure where to place both timeseries. Appreciate any help setting up this indicator here
Many thanks
I would like to create the RSI of an EMA(Close-Open) as an indicator (slight different from WL8's RSEMA by Vitali Apirine)
The strategy c# code is :
CODE:
co = bars.Close - bars.Open; coema = EMA.Series(co, period1 ); newind = RSI.Series(coema, period2);
CODE:
private TimeSeries co; private TimeSeries coema; private IndicatorBase newind;
where period1-2 are external parameters
After looking into the New Indicator template I am not sure where to place both timeseries. Appreciate any help setting up this indicator here
Many thanks
Rename
CODE:
using WealthLab.Core; using System; using WealthLab.Indicators; namespace WealthLab.MyIndicators { public class RSIofEMA : IndicatorBase { public RSIofEMA() : base() { } public RSIofEMA(TimeSeries source, int period1, int period2) : base() { Parameters[0].Value = source; Parameters[1].Value = period1; Parameters[2].Value = period1; Populate(); } public static RSIofEMA Series(TimeSeries source, int period1, int period2) => new RSIofEMA(source, period1, period2); public override string Name => "RSI of EMA"; public override string Abbreviation => "RSIofEMA"; public override string HelpDescription => "RSI of EMA(Close-Open)"; public override string PaneTag => "RSIofEMA"; public override void Populate() { BarHistory source = Parameters[0].AsBarHistory; Int32 period1 = Parameters[1].AsInt; Int32 period2 = Parameters[2].AsInt; DateTimes = source.DateTimes; if (period1 <= 0 || period2 <= 0) return; TimeSeries co = source.Close - source.Open; TimeSeries coema = EMA.Series(co, period1); TimeSeries newind = RSI.Series(coema, period2); for (int n = 0; n < source.Count; n++) Values[n] = newind[n]; } protected override void GenerateParameters() { AddParameter("Source", ParameterType.BarHistory, null); AddParameter("Period1", ParameterType.Int32, 10); AddParameter("Period2", ParameterType.Int32, 20); } } }
Note, you could use the built in indicator IndOnInd to achieve this. It lets you apply one indicator to another.
Dion, topic starter is looking to apply his 2nd level indicator to the difference of (bars.Close - bars.Open) which is hard to accomplish with Transformer indicators, if possible.
Really appreciate the fast turnaround and apologies for not getting back sooner. The (new) custom indicator is giving different readings than c# code and still working on figuring out the difference. Thanks again - much appreciate it.
In Reply# 1, you might want to change
Of course, you can call the project name "MyIndicators" so your indicators are listed in their own folder.
CODE:to
namespace WealthLab.MyIndicators;
CODE:so the compiler flags duplicate indicator names from existing WL indicators. This is done in the example for creating an indicator library, and it's a good idea.
namespace WealthLab.Indicators;
Of course, you can call the project name "MyIndicators" so your indicators are listed in their own folder.
thank you @superticker
@Eugene/Glitch - confirming all good, only a minor detail with timeseries vs. barhistory when using blocks. replaced 1st parameter to barhistory type and indicator is working fine. thanks again
@Eugene/Glitch - confirming all good, only a minor detail with timeseries vs. barhistory when using blocks. replaced 1st parameter to barhistory type and indicator is working fine. thanks again
When starting a 2nd instance of WL8 the above indicator (udo.dll) is said to be used by the 1st WL8 instance. I am in admin mode. This issue doesn't happen with any other indicator - any advice on what to change to enable the custom indicator to be used in 2 WL8 instances on the same PC? Many thanks
Call this a limitation.
The solution would be to build an indicator library DLL in Visual Studio. It's about a one hour job, and if you would like us to create it for you it could be a good test pilot of our custom development services we plan to introduce soon. If you're interested email me at dion@wealth-lab.com!
sounds good, thank you for the offer
Your Response
Post
Edit Post
Login is required