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)
Script protégé
Ce script est publié en source fermée. Cependant, vous pouvez l'utiliser librement et sans aucune restriction – pour en savoir plus, cliquez ici.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script protégé
Ce script est publié en source fermée. Cependant, vous pouvez l'utiliser librement et sans aucune restriction – pour en savoir plus, cliquez ici.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.