PROTECTED SOURCE SCRIPT

突破鬧鐘

12
//version=5
indicator("突破鬧鐘", overlay=true)
prevHigh = high[1]
prevLow = low[1]
var label activeLabel = na
var int activeDirection = 0

isBreakHigh = high >= prevHigh
isBreakLow = low <= prevLow

if activeDirection == 1 and low < prevHigh
label.delete(activeLabel)
activeLabel := na
activeDirection := 0
if activeDirection == -1 and high > prevLow
label.delete(activeLabel)
activeLabel := na
activeDirection := 0

if isBreakHigh and activeDirection != 1
if not na(activeLabel)
label.delete(activeLabel)
activeLabel := label.new(bar_index, low, text="突破前高: " + str.tostring(prevHigh), style=label.style_label_up, color=color.green, textcolor=color.white, yloc=yloc.belowbar)
activeDirection := 1

if isBreakLow and activeDirection != -1
if not na(activeLabel)
label.delete(activeLabel)
activeLabel := label.new(bar_index, high, text="跌破前低: " + str.tostring(prevLow), style=label.style_label_down, color=color.red, textcolor=color.white, yloc=yloc.abovebar)
activeDirection := -1

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。