PROTECTED SOURCE SCRIPT
DeMark789 Indicator

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © altonfung
//version=6
indicator("DeMark9 Indicator", overlay=true)
//--- DeMark9 信號有效性 ---
demarkSignalValidBars = input.int(1, title="DeMark9 Signal Valid Bars", minval=0)
//=== 3. DeMark9 指標 (偵測多/空信號) ===//
var int TD = 0
var int TS = 0
TD := close > close[4] ? nz(TD[1]) + 1 : 0
TS := close < close[4] ? nz(TS[1]) + 1 : 0
TDUp = TD - ta.valuewhen(TD < TD[1], TD, 1) // 賣出訊號 (DeMark9)
TDDn = TS - ta.valuewhen(TS < TS[1], TS, 1) // 買入訊號 (DeMark9)
//--- 新增:輸入參數控制7和8計數的顯示 ---
showCount7 = input.bool(true, title="顯示計數7")
showCount8 = input.bool(true, title="顯示計數8")
//=== 3.2 在圖上標註 DeMark9 Shape (包括計數7和8) ===//
// 標記買入序列計數7 (紫色圓圈)
plotshape(showCount7 and (TDDn == 7) ? true : false, style=shape.circle, text='7',
color=color.purple, location=location.belowbar, size=size.small)
// 標記買入序列計數8 (藍色圓圈)
plotshape(showCount8 and (TDDn == 8) ? true : false, style=shape.circle, text='8',
color=color.blue, location=location.belowbar, size=size.small)
// 標記賣出序列計數7 (紫色圓圈)
plotshape(showCount7 and (TDUp == 7) ? true : false, style=shape.circle, text='7',
color=color.purple, location=location.abovebar, size=size.small)
// 標記賣出序列計數8 (藍色圓圈)
plotshape(showCount8 and (TDUp == 8) ? true : false, style=shape.circle, text='8',
color=color.blue, location=location.abovebar, size=size.small)
// 原有的計數9標記 (最終信號)
plotshape(TDUp == 9 ? true : false, style=shape.triangledown, text='9-SELL',
color=color.rgb(236, 12, 12), location=location.abovebar, size=size.normal)
plotshape(TDDn == 9 ? true : false, style=shape.triangleup, text='9-BUY',
color=color.new(#1cf75e, 0), location=location.belowbar, size=size.normal)
// © altonfung
//version=6
indicator("DeMark9 Indicator", overlay=true)
//--- DeMark9 信號有效性 ---
demarkSignalValidBars = input.int(1, title="DeMark9 Signal Valid Bars", minval=0)
//=== 3. DeMark9 指標 (偵測多/空信號) ===//
var int TD = 0
var int TS = 0
TD := close > close[4] ? nz(TD[1]) + 1 : 0
TS := close < close[4] ? nz(TS[1]) + 1 : 0
TDUp = TD - ta.valuewhen(TD < TD[1], TD, 1) // 賣出訊號 (DeMark9)
TDDn = TS - ta.valuewhen(TS < TS[1], TS, 1) // 買入訊號 (DeMark9)
//--- 新增:輸入參數控制7和8計數的顯示 ---
showCount7 = input.bool(true, title="顯示計數7")
showCount8 = input.bool(true, title="顯示計數8")
//=== 3.2 在圖上標註 DeMark9 Shape (包括計數7和8) ===//
// 標記買入序列計數7 (紫色圓圈)
plotshape(showCount7 and (TDDn == 7) ? true : false, style=shape.circle, text='7',
color=color.purple, location=location.belowbar, size=size.small)
// 標記買入序列計數8 (藍色圓圈)
plotshape(showCount8 and (TDDn == 8) ? true : false, style=shape.circle, text='8',
color=color.blue, location=location.belowbar, size=size.small)
// 標記賣出序列計數7 (紫色圓圈)
plotshape(showCount7 and (TDUp == 7) ? true : false, style=shape.circle, text='7',
color=color.purple, location=location.abovebar, size=size.small)
// 標記賣出序列計數8 (藍色圓圈)
plotshape(showCount8 and (TDUp == 8) ? true : false, style=shape.circle, text='8',
color=color.blue, location=location.abovebar, size=size.small)
// 原有的計數9標記 (最終信號)
plotshape(TDUp == 9 ? true : false, style=shape.triangledown, text='9-SELL',
color=color.rgb(236, 12, 12), location=location.abovebar, size=size.normal)
plotshape(TDDn == 9 ? true : false, style=shape.triangleup, text='9-BUY',
color=color.new(#1cf75e, 0), location=location.belowbar, size=size.normal)
Protected script
This script is published as closed-source. However, you can use it freely and without any limitations – learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Protected script
This script is published as closed-source. However, you can use it freely and without any limitations – learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.