mForex - Bollinger Bands - Pinbar scalping system

redf0x1 · study · 30 行 · 点赞 2,311 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © redf0x1
 
//@version=4
study(shorttitle="mForex - BB - Pinbar", title="mForex - Bollinger Bands - Pinbar scalping system", overlay=true)
length = input(20, minval=1, title="BB Length")
mult = input(2.0, minval=0.001, maxval=50, title="BB StdDev")
lengthRSI = input(9, minval=1, title="RSI Length")
pinbardown = input(75, minval=1, maxval=99, title="Bearish pinbar when RSI >= ")
pinbarup = input(25, minval=1, maxval=99, title="Bullish pinbar when RSI <= ")
 
basis = sma(close, length)
dev = mult * stdev(close, length)
upper = basis + dev
lower = basis - dev
plot(basis, "Basis", color=#872323, offset = 0)
p1 = plot(upper, "Upper", color=color.teal, offset = 0)
p2 = plot(lower, "Lower", color=color.teal, offset = 0)
fill(p1, p2, title = "Background", color=#198787, transp=95)
 
rsi = rsi(close, lengthRSI)
body = abs(close-open)
upshadow = open>close?(high-open):(high-close)
downshadow = open>close?(close-low):(open-low)
pinbar_h = close[1]>open[1] and rsi > pinbardown ?(body[1]>body?(upshadow>0.8*body?(upshadow>2*downshadow?1:0):0):0):0
pinbar_l = open[1]>close[1] and rsi < pinbarup ?(body[1]>body?(downshadow>0.8*body?(downshadow>2*upshadow?1:0):0):0):0
plotshape(pinbar_h,style=shape.triangledown,color=color.red)
plotshape(pinbar_l,style=shape.triangleup,color=color.lime,location=location.belowbar)
plotchar(pinbar_h,text="Bearish pinbar",char="",color=color.red)
plotchar(pinbar_l,text="Bullish pinbar",char="",color=color.lime,location=location.belowbar)

← 返回列表