Reputation: 75
I am doing technical analysis using talib in Go. But the result looks different compared to the Binance live result.
Technical Analysis: RSI, Stoch RSI, Boler band, and MACD. All are showing the wrong results only.
Binance Dashboard URL: https://www.binance.com/en-IN/trade/BNB_USDT?layout=pro
import (
"log"
"time"
"github.com/markcheno/go-talib"
"github.com/pdepip/go-binance/binance"
)
func main() {
q := binance.KlineQuery{
Symbol: "BNBUSDT",
Interval: "5m",
Limit: 288,
}
client := binance.New("", "")
for true {
kline, _ := client.GetKlines(q)
inputs := []float64{}
for _, e := range kline {
inputs = append(inputs, e.Close)
}
rsi := talib.Rsi(inputs, 14)
log.Println("RSI : ", rsi[len(rsi)-1])
slowk, slowd := talib.StochRsi(inputs, 14, 3, 3, talib.EMA)
log.Printf("Stoch RSI : %v %v ", slowk[len(slowk)-1], slowd[len(slowd)-1])
upper, middle, lower := talib.BBands(inputs, 5, 2, 2, talib.T3MA)
log.Printf("BBands : %v %v %v ", upper[len(upper)-1], middle[len(middle)-1], lower[len(lower)-1])
macd, signal, hist := talib.Macd(inputs, 12, 26, 9)
log.Printf("Macd : %v %v %v ", macd[len(macd)-1], signal[len(signal)-1], hist[len(hist)-1])
time.Sleep(5 * time.Second)
log.Println("_________________________________")
log.Println("")
}
}
Upvotes: 2
Views: 1432
Reputation: 1
StochRsi use both close and low and high prices, but you only pass close prices, in StochRsi, the lowest price means lowest low price, not lowest close price and the highest price means highest high price. it's not candles number issue.
Upvotes: -1
Reputation: 155
First thing is you have to use 1000 candles to get the same values as Binance because the calcul is depend to the given serie, so when you pass 288 row you will get different values
Upvotes: 1