开始会话和结束会话在移动平均中

huangapple go评论50阅读模式
英文:

Start Session & End Session In Moving Average

问题

ma=ta.sma(close,100)

issession=time(timeframe.period,"0900-1650:1234567")
time_Condition= not na(issession)

plot(time_Condition and ma ? 1 : 0 , color.black, linewidth=2)

英文:

I Want To Calculate and Plot Simple Moving Average Based On Start Session Time And End Session Time

ma=ta.sma(close,100)

issession=time(timeframe.period,"0900-1650:1234567")
time_Condition= not na(issession)

plot(time_Condition and ma ? 1 : 0 , color.black, linewidth=2)

答案1

得分: 0

//@version=5
indicator("我的脚本", overlay=true)
ma = ta.sma(close, 100)

issession = time(timeframe.period, "0901-1650:1234567")
time_Condition = not na(issession)

plot(ma, color = time_Condition ? color.red : color(na), linewidth = 2)

英文:

You can use a transparent color for the plot to hide a moving average that is outside a defined session:

//@version=5
indicator("My script", overlay = true)
ma = ta.sma(close,100)

issession = time(timeframe.period,"0901-1650:1234567") 
time_Condition = not na(issession)

plot(ma, color = time_Condition? color.red : color(na), linewidth = 2)

开始会话和结束会话在移动平均中

huangapple
  • 本文由 发表于 2023年2月16日 15:51:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/75469243.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定