ninjabot
ninjabot copied to clipboard
Include new chart indicators
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
- [x] Moving average (MA)
- [x] Exponential moving average (EMA)
- [x] Moving Average Convergence Divergence (MACD)
- [x] Relative Strength Index (RSI)
- [ ] Percentage Price Oscillator (PPO)
- [ ] Parabolic SAR
- [ ] Average directional index
- [x] Stochastic oscillator
- [x] Bollinger bands
- [ ] Fibonacci retracement
- [x] Williams Percent Range (%R)
- [x] Commodity Channel Index (CCI)
- [ ] Ichimoku cloud
- [x] On-Balance volume (OBV)
- [x] Supertrend
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.