Type/to search
0
Follow
0
Followers
Bandas de Bollinger, ¿por qué los datos de las bandas de Bollinger obtenidos por TA.BOLL son tan diferentes de los datos de las bandas de Bollinger obtenidos al observar la línea K? Por favor ayuda
Help
Created 2021-02-25 19:47:20  
 6
 1507

Obtener el código de datos de Brin
def get_boll(self, period = PERIOD_M1 ,variance = 2):
self.upLine = '---'
self.midLine = '---'
self.downLine = '---'
r = exchange.GetRecords(period)
if r and len(r) > 20:
boll = TA.BOLL(r, 20, 2)
self.upLine = boll[0]
self.midLine = boll[1]
self.downLine = boll[2]

log log logado en 2021-2-23 19:10 el valor de los binarios -1, -2, -3 en la parte superior y la parte inferior es:
img
Por ejemplo, el valor de la banda de Brin en la órbita de 2021-2-23 19:10 es 48995
Sin embargo, al mirar hacia atrás en la línea K, el valor de la órbita de un minuto de BB 20 2 es 48 457
img
Los dos valores están equivocados más de 500. He ajustado la línea K de la moneda digital, y en este momento la línea K de 1 minuto BB ((20,2) también tiene un valor de la línea superior de 48457 aproximadamente.
Sé que debería ser yo quien use el problema, pero ¿dónde está el problema?

Related Recommendations
Comment
All comments (6)

    知道问题了,在refresh data的时候,传的参数是5分钟的PERIOD_M5 参数,导致log打出来的是5分钟的布林带。低级错误。。。

    6 years ago

    k线上是19:10:59即该一分钟最后的值,19:10:37并不是最终值

    6 years ago

    嗯,37秒的时候不是最终值,是对的,但是即使不是最终值错了500多怎么解释。-2 的那个值应该是19:09的吧(-2的是最终值吧)函数 TA.BOLL得到的值是49025, img
    但是从k线上看布林带值明显也就是48449左右,也错了49025-48449=576多怎么回事,很是迷惑 img

    6 years ago

    boll[boll.length-1] 是最新的一根,并不是日志上打印的时间

    6 years ago

    穿错参数了,传成5分钟的了,sorry

    6 years ago

    我取完boll[boll.length-1],立即log,这个时间不是当前bar的吗,最新的不就是回测那个时间的当前时间吗,即使不是当前的,-1,-2,-3都很平滑的,也都不会和K线上的值错500多啊。

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