简体   繁体   English

具有多个指标 EMA、交易量和布林线的 pine 脚本

[英]pine script with multiple Indicator EMA, Volume & Bollinger

in which I placed multiple indicators with EMA, Vwap Bolinger band.我在其中放置了多个带有 EMA、Vwap Bolinger 波段的指标。 Now I want to add Volume too.现在我也想添加音量。 But when I added it will hide all Indicators.但是当我添加它时,它会隐藏所有指标。 Please see the below script.请看下面的脚本。

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © makkanimation

//@version=4
study("Vol in Base asset 20MA", "", true, format.volume, overlay=true, scale=scale.none)

EMA1=input(21)
EMA2=input(55) 
EMA3=input(100)
EMA4=input(200)


exponential = input(true, title="Exponential MA")
src = close

ma21 = exponential ? ema(src, EMA1) : sma(src, EMA1)
ma55 = exponential ? ema(src, EMA2) : sma(src, EMA2)
ma100 = exponential ? ema(src, EMA3) : sma(src, EMA3)
ma200 = exponential ? ema(src, EMA4) : sma(src, EMA4) 

// VWAP
price = input(type=input.source, defval=hlc3, title="VWAP Source")
enable_vwap = input(true, title="Enable VWAP")
vwapResolution = input(title = "VWAP Resolution", defval = "", type=input.resolution)
vwapFunction = vwap(price)
vwapSecurity = security(syminfo.tickerid, vwapResolution, vwapFunction)

plot(ma21, color=color.new(color.green, 0), title="[E]MA21")
plot(ma55, color=color.new(color.red, 0), title="[E]MA55")
plot(ma100, color=color.new(color.orange, 0), title="[E]MA100")
plot(ma200, color=color.new(color.blue, 0), title="[E]MA200")
plot(enable_vwap ? vwapSecurity : na, title="VWAP", color=color.navy, linewidth=2, transp=0, editable=true) // All TimeFrames 

bollinger = input(false, title="Bolinger Band")
bolingerlength = input(20,"Length")
// Bollinger Bands
bsrc = input(close, title="Source")
mult = input(2.0, title="std dev", minval=0.001, maxval=50)
basis = sma(bsrc, bolingerlength)
dev = mult * stdev(bsrc, bolingerlength)
upper = basis + dev
lower = basis - dev
plot(bollinger ? basis: na, color=color.red, title="Bol Basic")
p1 = plot(bollinger ? upper: na, color=color.blue, title="Bol Upper")
p2 = plot(bollinger ? lower: na, color=color.blue, title="Bol Lower")
fill(p1, p2, title="Bol Background")


//Make the moving average user configurable
HIM1 = "1. Historical High"
HIM2 = "2. Highest in last..."
showMA = input(true)
scaleFactor = 100 / input(30, "% of vertical space used", step = 10, maxval = 100)
hiMethod = input(HIM2, "High point method", options = [HIM1, HIM2])
hiMethod2Len = input(400, "  2. Length", minval = 2, step = 100)

//Get volume for current bar and multiply with vwap
vInverse = volume * vwap

//Plot fiat volume.
plot(vInverse, color = color.orange, title="VolumeBTC", style=plot.style_columns, transp=30) //Originally: transp=65

//Plot 20 candle moving average (changable in settings)
plot(showMA ? sma(vInverse,20) : na, color = color.white, title="Volume MA", style=plot.style_area, transp=65)

//Plot high line to scale down the columns.
var histHi = 0.
histHi := max(histHi, nz(vInverse, histHi))
limit = hiMethod == HIM1 ? histHi : highest(vInverse, hiMethod2Len)
plot(limit * scaleFactor, "Historical High", #00000000)

Please help me.请帮我。 I want to show all at one place.我想在一个地方展示所有内容。

You can't accomplish what you are trying to do.你无法完成你想要做的事情。 Especially with scale = scale.none .特别是scale = scale.none Your BB will not match the chart candles because of this and because the volume will establish the range of the script's scale which won't remotely line up with your candles.由于这个原因,您的 BB 将与图表蜡烛不匹配,因为交易量将确定脚本规模的范围,该范围不会与您的蜡烛远程对齐。 You will need to have them as separate scripts with separate scales.您需要将它们作为具有单独比例的单独脚本。 The BB/MA using the chart's scale and another script with scale.none to put your volume on the bottom of the chart. BB/MA 使用图表的比例和另一个带有scale.none的脚本将您的交易量放在图表的底部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM