Monitoring real-time price where the bull track is located how should the code be written
bk_fund currentPrice设置为当前tick.Last的价格,可以获得实时的价格处于boll的位置
bk_funddef boll_locateB_bandWidth ((closeArr, currentPrice=None, time_period=20, critical_std=2.5, ma_type=0): "I'm going to kill you". locateB: (latest price - downstream) / (upstream - downstream) bandwidth: bandwidth indicator, (up-down) / mid-track 1.locateB describes the location of the latest market price in the Brynne band. locate B > 1, indicating that the price is above the track; locate B < 0, indicating the price below the track; locate B = 0.5, the price is in the middle 2.locateB is a very useful tool when making trading decisions 3. Bandwidth indicator describes the change in width of a wireline in relative terms 4. Bandwidth can be used to identify the convergence of Brainstorming lines 5. Bandwidth can be used to identify the beginning and end of market trends "I'm going to kill you". closeArr = np.array ((closeArr)) Upperband, middleband, lowerband = talib.BBANDS ((closeArr, timeperiod=time_period, nbdevup=critical_std, nbdevdn=critical_std, matype=ma_type) This is a list of all the different ways BBANDS is credited in the database. lastClose = closeArr[-1] lastUpper = upperband[-2] lastMiddle = middleband[-2] lastLower = lowerband[-2] bandwidth = (lastUpper - lastLower) / lastMiddle diff_middle = middleband[-1] - middleband[-time_period] # Calculate the value of locateB if currentPrice is None: locateB = (lastClose - lastLower) / (lastUpper - lastLower) return round ((locateB,3), round ((bandWidth, 3), round ((diff_middle, 3) Other: locateB = (currentPrice - lastLower) / (lastUpper - lastLower) return round ((locateB,3), round ((bandWidth, 3), round ((diff_middle, 3)
The grassThis is still relatively simple, easy to learn the basics, and the drawing library https://www.fmz.com/bbs-topic/4158