Type/to search
0
Follow
0
Followers
Há um erro na fórmula do indicador RSI que escrevi. Por favor, me oriente.
Help
Created 2020-04-13 23:35:26  
 3
 1648

function RSI(records,N) {
//LC:=REF(CLOSE,1)
//RSI1:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100
var v1 = []
var v2 = []
var MAX = []
var ABS = []
for (var i = N; i < records.length; i++) {
//LC = records[i - 1].Close
var ba = records.slice(i - N,i + 1)
v1[i] = ba
for (var k = N + 1; k < v1.length; k++) {
for (var j = N; j > 0; j--) {
var c = v1[k][j].Close - v1[k][j -1].Close
v2[j] = c
for (var b = 1; b < v2.length; b++) {
var c = MAX(v2[b])
var c1 = ABS(v2[b])
//var b = SMA(MAX,N,1)
//var b1 = SMA(ABS,N,1)
}
}
}
}
return [c,c1]
}
O código não está completo, mas não é muito ruim, e mostra que a linha 17 do v2 não foi obtida, mas o meu teste conseguiu, então não sei onde é o problema.

Related Recommendations
Comment
All comments (3)

    RSI可以看到看应的代码,FMZ也有公开

    6 years ago

    那有公开啊,我都找了,能给个链接不

    6 years ago
    6 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)