Custom Moving Averages group WW

wyndmillwillie · study · 61 行 · 点赞 3 · 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/
// © windmillwillie
 
//@version=6
indicator(title="Custom Moving Averages group WW", shorttitle="MAs WW", overlay=true)
 
en1 = input.bool(true, title="Enable", inline="m1", group="MA 1")
type1 = input.string("SMA", title="", options=["SMA", "EMA"], inline="m1", group="MA 1")
len1 = input.int(20, title="Length", minval=1, inline="m1", group="MA 1")
src1 = input.source(close, title="Source", inline="m1", group="MA 1")
val1 = type1 == "EMA" ? ta.ema(src1, len1) : ta.sma(src1, len1)
plot(en1 ? val1 : na, title="MA 1", color=color.red, linewidth=2)
 
en2 = input.bool(true, title="Enable", inline="m2", group="MA 2")
type2 = input.string("SMA", title="", options=["SMA", "EMA"], inline="m2", group="MA 2")
len2 = input.int(50, title="Length", minval=1, inline="m2", group="MA 2")
src2 = input.source(close, title="Source", inline="m2", group="MA 2")
val2 = type2 == "EMA" ? ta.ema(src2, len2) : ta.sma(src2, len2)
plot(en2 ? val2 : na, title="MA 2", color=color.green, linewidth=2)
 
en3 = input.bool(true, title="Enable", inline="m3", group="MA 3")
type3 = input.string("SMA", title="", options=["SMA", "EMA"], inline="m3", group="MA 3")
len3 = input.int(100, title="Length", minval=1, inline="m3", group="MA 3")
src3 = input.source(close, title="Source", inline="m3", group="MA 3")
val3 = type3 == "EMA" ? ta.ema(src3, len3) : ta.sma(src3, len3)
plot(en3 ? val3 : na, title="MA 3", color=color.blue, linewidth=2)
 
en4 = input.bool(true, title="Enable", inline="m4", group="MA 4")
type4 = input.string("SMA", title="", options=["SMA", "EMA"], inline="m4", group="MA 4")
len4 = input.int(150, title="Length", minval=1, inline="m4", group="MA 4")
src4 = input.source(close, title="Source", inline="m4", group="MA 4")
val4 = type4 == "EMA" ? ta.ema(src4, len4) : ta.sma(src4, len4)
plot(en4 ? val4 : na, title="MA 4", color=color.purple, linewidth=2)
 
en5 = input.bool(true, title="Enable", inline="m5", group="MA 5")
type5 = input.string("SMA", title="", options=["SMA", "EMA"], inline="m5", group="MA 5")
len5 = input.int(200, title="Length", minval=1, inline="m5", group="MA 5")
src5 = input.source(close, title="Source", inline="m5", group="MA 5")
val5 = type5 == "EMA" ? ta.ema(src5, len5) : ta.sma(src5, len5)
plot(en5 ? val5 : na, title="MA 5", color=color.gray, linewidth=2)
 
en6 = input.bool(false, title="Enable", inline="m6", group="MA 6")
type6 = input.string("EMA", title="", options=["SMA", "EMA"], inline="m6", group="MA 6")
len6 = input.int(5, title="Length", minval=1, inline="m6", group="MA 6")
src6 = input.source(close, title="Source", inline="m6", group="MA 6")
val6 = type6 == "EMA" ? ta.ema(src6, len6) : ta.sma(src6, len6)
plot(en6 ? val6 : na, title="MA 6", color=color.orange, linewidth=2)
 
en7 = input.bool(false, title="Enable", inline="m7", group="MA 7")
type7 = input.string("EMA", title="", options=["SMA", "EMA"], inline="m7", group="MA 7")
len7 = input.int(8, title="Length", minval=1, inline="m7", group="MA 7")
src7 = input.source(close, title="Source", inline="m7", group="MA 7")
val7 = type7 == "EMA" ? ta.ema(src7, len7) : ta.sma(src7, len7)
plot(en7 ? val7 : na, title="MA 7", color=color.yellow, linewidth=2)
 
en8 = input.bool(false, title="Enable", inline="m8", group="MA 8")
type8 = input.string("EMA", title="", options=["SMA", "EMA"], inline="m8", group="MA 8")
len8 = input.int(13, title="Length", minval=1, inline="m8", group="MA 8")
src8 = input.source(close, title="Source", inline="m8", group="MA 8")
val8 = type8 == "EMA" ? ta.ema(src8, len8) : ta.sma(src8, len8)
plot(en8 ? val8 : na, title="MA 8", color=color.maroon, linewidth=2)

← 返回列表