TradingView
daisuke_gewinn
19 de May. de 2017 8:32

Moving average deviation rate 

Euro Fx/U.S. DollarFXCM

Descripción

Moving average deviation rate

Simple moving average deviation rate and standard deviation.

The bollinger band is momentum value standard devition.
Bat the bollinger band is not normal distribution to close price.

Moving average deviation rate is normal distribution.

This indicator is draw Moving average deviation rate and fill area 2σ standard devition.
If it exceeds 2σ, it is a trading opportunity.

移動平均かい離率と、2σのバンドです。
ボリンジャーバンドは移動量の標準偏差を描画しますが、終値はボリンジャーバンドに対して正規分布を描きません。
移動平均かい離率は、標準偏差に対して正規分布を示します。

かい離率2σを超えた場合、トレードチャンスです。

Notas de prensa

I've updated to the code you updated on the forum.
thank you @rendfirst(jp.tradingview.com/u/trendfirst/)

1) Added color when the rate crosses over the upper or lower boundaries. I find a bright color helps me spot the crossover better.
2) Changed the standard deviations from a fixed value of 2 to user input.
3) Converted to v5.
Comentarios
saitoutakasi01
初めまして
初心者です
移動平均乖離率を tradingviewで出す方法がわからず
こちらのサイトにたどり着きました

普通の乖離率より、使いやすそうでびっくりしてます!

スプリクトの登録?というのはやったことが無いのですが、具体的な手順はどうすればいいのでしょうか?
saitoutakasi01
@saitoutakasi01,
あ、ごめんなさい
自己解決しました
普通に公開されてたんですね><
ありがとうございました。
kabukiagedaisuki
_stdCenterと_stdを算出する際に、なぜ_maPeriodを2倍しているのでしょうか。
daisuke_gewinn
@kabukiagedaisuki, うわ・・・誤字おおすぎ。すみません。経験測→経験則、取る気→取る時、

身も蓋も無い言い方をすると経験測です。

一応個人的には以下の考えで偏差を取る気には平均に対して2倍しています。
移動平均は、その期間の1/2遅延した値です。(例えば10日移動平均だと5日前のトレンドを示しています)

移動平均の全期間の偏差をとるために標準偏差は倍することで正しい偏差がとれるという考えで2倍しています。
kazuyaaizawa
ありがとうございます。使わせていただきます。
jasonwhite
Hello, does it measure the deviation from the moving average in terms of pips? I can't find that in the indicator
soheilhack
heloo hi
im hesam from iran
one question for you?
do you have Moving average deviation rate for mql4?
please send cod mql4 Moving average deviation rate for me .
thank you
The_Chart_Analyst
Thank you for sharing your code. I have made a few cosmetic changes to it, thought I would share here if you are ok with that. The changes are:

1) Added color when the rate crosses over the upper or lower boundaries. I find a bright color helps me spot the crossover better.
2) Changed the standard deviations from a fixed value of 2 to user input.
3) Converted to v5.

// Moving Average Deviation Rate by daisuke_gewinn
// Modified by trendfirst Jan 23, 2023
// Added color when rate goes above/below Hi/Lo lines
// Changed Standard Deviations from fixed value to user input
//@version=5
indicator('MA Deviation', overlay=false)

//input
maPeriod = input(21, title='Moving average period')
NoStdDev = input(2, title="Number of Std Deviations") //Number of standard deviations for plus and minus lines

//deviation rate
sma = ta.sma(close, maPeriod)
rate = close / sma * 100 - 100

//deviation rate std
stdCenter = ta.sma(rate, maPeriod * NoStdDev)
std = ta.stdev(rate, maPeriod * NoStdDev)
plusDev = stdCenter + std * NoStdDev
minusDev = stdCenter - std * NoStdDev

//plot lines and add fill
RateLine = plot(rate,"MA Dev Rate",color=color.red, linewidth=1, style=plot.style_line) // Rate of change Line
CenterLine = plot(stdCenter, title="Center", color=color.gray) // Center Line
HighLine = plot(plusDev, title="HiBound", color=color.rgb(255, 255, 255, 30), linewidth=1, style=plot.style_cross) // Upper Line
LowLine = plot(minusDev, title="LoBound", color=color.rgb(255, 255, 255, 30), linewidth=1, style=plot.style_cross) // Lower Line
fill(CenterLine, HighLine, color=color.new(color.gray, transp=90), title="CenterFill")
fill(CenterLine, LowLine, color=color.new(color.gray,transp=90), title="CenterFill")

color FillColor = rate > plusDev ? color.rgb(252, 3, 3) : color.new(color.gray, transp=100)
fill(RateLine, HighLine, FillColor, title="HiColor")

color FillColor_1 = rate < minusDev ? color.lime : color.new(color.gray, transp=100)
fill(RateLine, LowLine, FillColor_1, title="LoColor")
Blblucky7
@trendfirst, Good Job Sir .. But how do I copy and paste the code.. it wont let me copy it here. Thanks
The_Chart_Analyst
@Blblucky7, Thanks. It is only a minor modification, but I published it as an open script, so you should be able to copy it from there.
Más