本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// @version=6
indicator("FIRST 15 SWEEP + VOL 1.6 + CISD FINAL", overlay=true, max_lines_count=500, max_labels_count=500, max_bars_back=500)
rr1 = input.float(2.0, "T1 RR", 0.5, 10.0, 0.5)
rr2 = input.float(4.0, "T2 RR", 0.5, 10.0, 0.5)
rr3 = input.float(6.0, "T3 RR", 0.5, 10.0, 0.5)
vMult = input.float(1.6, "Vol Mult", 1.1, 3.0, 0.1)
useVol = input.bool(true, "Use Vol 1.6?")
useCISD = input.bool(true, "Use CISD?")
var float fH = na
var float fL = na
var bool fCap = false
var int fBar = na
bool newDay = ta.change(time("D"))!= 0
bool in15 = not na(time(timeframe.period, "0915-0930", "Asia/Kolkata"))
if newDay
fCap := false
fH := na
fL := na
fBar := na
if in15 and not in15[1]
fH := high
fL := low
else if in15
fH := math.max(fH, high)
fL := math.min(fL, low)
if not in15 and in15[1]
fCap := true
fBar := bar_index
plot(fCap? fH : na, "F15 High", color=color.orange, style=plot.style_linebr, linewidth=2)
plot(fCap? fL : na, "F15 Low", color=color.orange, style=plot.style_linebr, linewidth=2)
vAvg = ta.sma(volume, 20)
bool vUp = volume > vAvg * vMult and volume > volume[1]
bool vDn = volume > vAvg * vMult and volume > volume[1]
bool cBull = close > high[1]
bool cBear = close < low[1]
bool after = fCap and bar_index > fBar
bool rawBull = false
bool rawBear = false
if after
rawBull := close[1] < fL and low < low[1] and close > fL
rawBear := close[1] > fH and high > high[1] and close < fH
bool bullSig = rawBull and (useVol? vUp : true) and (useCISD? cBull : true)
bool bearSig = rawBear and (useVol? vDn : true) and (useCISD? cBear : true)
var float eP = na
var float slP = na
var float t1P = na
var float t2P = na
var float t3P = na
var line eL = na
var line slL = na
var line t1L = na
var line t2L = na
var line t3L = na
if bullSig or bearSig
line.delete(eL)
line.delete(slL)
line.delete(t1L)
line.delete(t2L)
line.delete(t3L)
eP := close
float risk = na
if bullSig
slP := low
risk := eP - slP
t1P := eP + risk * rr1
t2P := eP + risk * rr2
t3P := eP + risk * rr3
eL := line.new(bar_index, eP, bar_index+1, eP, color=color.green, width=2, extend=extend.right)
slL := line.new(bar_index, slP, bar_index+1, slP, color=color.red, style=line.style_dashed, extend=extend.right)
else
slP := high
risk := slP - eP
t1P := eP - risk * rr1
t2P := eP - risk * rr2
t3P := eP - risk * rr3
eL := line.new(bar_index, eP, bar_index+1, eP, color=color.red, width=2, extend=extend.right)
slL := line.new(bar_index, slP, bar_index+1, slP, color=color.red, style=line.style_dashed, extend=extend.right)
t1L := line.new(bar_index, t1P, bar_index+1, t1P, color=color.green, width=1, extend=extend.right)
t2L := line.new(bar_index, t2P, bar_index+1, t2P, color=color.green, width=2, extend=extend.right)
t3L := line.new(bar_index, t3P, bar_index+1, t3P, color=color.green, width=3, extend=extend.right)
plotshape(bullSig, "LONG", style=shape.labelup, location=location.belowbar, color=color.new(color.green,0), text="LONG", size=size.small)
plotshape(bearSig, "SHORT", style=shape.labeldown, location=location.abovebar, color=color.new(color.red,0), text="SHORT", size=size.small)
alertcondition(bullSig, "LONG", "LONG VOL+CISD")
alertcondition(bearSig, "SHORT", "SHORT VOL+CISD")