The resource loading... loading...

布林带,为什么用TA.BOLL得到的布林带数据和看K线的布林带数据差这么多,求教

Author: fookootoo, Created: 2021-02-25 19:47:20, Updated:

Obtaining the data code for Brin def get_boll ((self, period = PERIOD_M1, variance = 2): Self.upLine = up self.midLine = shell self.downLine = shell r is for exchange.GetRecords ((period)) if r and len® > 20: boll = TA.BOLL ((r, 20, 2)) is the self.upLine = boll[0] self.midLine = boll[1] self.downLine = boll[2]

Log out 2021-2-23 19:10 The values of the tracks 1, 2, and 3 in the upper-middle bracket are:imgFor example, the orbital value of the Blinken belt at 2021-2-23 19:10 is 48995. But if you look back at the K line, the orbital value of BB ((20,2) for one minute is 48457.imgThe two values are more than 500 wrong. I've corrected the K-line of the lower token, and the uptrend value of the 1 minute K-line BB ((20,2) is also about 48457. I know I should be using the problem, but where is the problem, ask for help.


More

fookootooThe problem is that at the time of refresh data, the parameter passed is the 5-minute PERIOD_M5 parameter, resulting in the log output being a 5-minute Blink band.

zhengow19:10:59 on the k-line is the last value of the minute. 19:10:37 is not the last value.

The grassboll[boll.length-1] is the latest one, not the time printed in the log

fookootooI've entered the wrong parameter, it's been 5 minutes, sorry.

fookootooWell, 37 seconds is not the final value, right, but even if it's not the final value, it's more than 500 times wrong. But from the k-line, it's obvious that the Brin band is around 48449, which is also wrong.

fookootooI takeboll [boll.length-1], immediately log, this time is not the current bar, the latest is not the current time of that time, even if it is not the current one,-1,-2,-3 is smooth and will not be more than 500 wrong with the value on the K line.