rodrigo-brito / ninjabot

A fast trading bot platform for cryptocurrency in Go (Binance)

Home Page:https://rodrigo-brito.github.io/ninjabot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include new chart indicators

rodrigo-brito opened this issue · comments

We can create and initialize indicators for chats in Ninjabot.

Example:

chart := plot.NewChart(plot.WithIndicators(
indicator.EMA(8, "red"),
indicator.EMA(21, "#000"),
indicator.RSI(14, "purple"),
indicator.Stoch(8, 3, "red", "blue"),
))

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

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

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