ninjabot icon indicating copy to clipboard operation
ninjabot copied to clipboard

Include new chart indicators

Open rodrigo-brito opened this issue 2 years ago • 2 comments

We can create and initialize indicators for chats in Ninjabot.

Example: https://github.com/rodrigo-brito/ninjabot/blob/516e75064107daf73495bf1d091b5dc1cba18c09/examples/backtesting/main.go#L58-L63

A indicator is a simple struct that implements the follow interface:

type Indicator interface {
	Name() string
	Overlay() bool
	Metrics() []IndicatorMetric
	Load(dataframe *model.Dataframe)
}

Here, we have a simple example of Exponential Moving Average (EMA): https://github.com/rodrigo-brito/ninjabot/blob/516e75064107daf73495bf1d091b5dc1cba18c09/plot/indicator/ema.go

Indicators Roadmap

rodrigo-brito avatar Mar 19 '22 12:03 rodrigo-brito

Hi, This looks very interesting since I'm a little bit interested in trading (stocks, but still) and relatively new to GO. If I'm correct all I have to do is to create new file for dedicated indicator which would implement the Indicator interface? Just similarly to the ema.go? If that's right I can work with SMA as it looks like the easiest one and then maybe tackle the harder indicators

RobertKwiatkowski avatar Mar 19 '22 16:03 RobertKwiatkowski

Hi @RobertKwiatkowski , exactly like ema.go. The format is very simple.

rodrigo-brito avatar Mar 19 '22 16:03 rodrigo-brito