karlwancl / Trady

Trady is a handy library for computing technical indicators, and it targets to be an automated trading system that provides stock data feeding, indicator computing, strategy building and automatic trading. It is built based on .NET Standard 2.0.
https://lppkarl.github.io/Trady
Apache License 2.0
545 stars 184 forks source link

Indicator on Indicator 'TInput TOutput not matched' #121

Open andyb1979 opened 3 years ago

andyb1979 commented 3 years ago

Hi there!

Does Trade support indicators on indicators?

If I try this ->

var rsi = new RelativeStrength(PrimaryPriceData, 14).Compute();
var emaOnRsi = new ExponentialMovingAverage<AnalyzableTick<decimal?>, AnalyzableTick<decimal?>>(rsi, tick => tick.Tick, 9).Compute();

Then I get an exception

System.ArgumentException: 'TInput, TOutput not matched!'
at Trady.Analysis.Infrastructure.AnalyzableBase`4..ctor(IEnumerable`1 inputs, Func`2 inputMapper)

Any ideas?

ridicoulous commented 3 years ago

Take a look here .
If you map AnalyzableTick<decimal?> to IOhclv, it should work, I think. Like rsi.Compute().Select(c=> new Candle(c.DateTime, c.Tick, c.Tick....)