チャート

iii #

イントラデイ・インテンシティ・インデックス

#
study('My Script')
plot(iii, color=color.yellow)

// the same on pine
f_iii() =>
    return = (2 * close - high - low) / ((high - low) * volume)

plot(f_iii())

nvi #

ネガティブ・ボリューム・インデックス

#
//@version=4
study('My Script')

plot(nvi, color=color.yellow)

// the same on pine
f_nvi() =>
    float nvi = 1.0
    float prevNvi = (nz(nvi[1], 0.0) == 0.0)  ? 1.0: nvi[1]
    if nz(close, 0.0) == 0.0 or nz(close[1], 0.0) == 0.0
        nvi := prevNvi
    else
        nvi := (volume < nz(volume[1], 0.0)) ? prevNvi + ((close - close[1]) / close[1]) * prevNvi : prevNvi
    result = nvi

plot(f_nvi())

obv #

オン・バランス・ボリューム

#
study('My Script')
plot(obv, color=color.yellow)

// the same on pine
f_obv() =>
    return = cum(sign(change(close)) * volume)

plot(f_obv())

pvi #

ポジティブ・ボリューム・インデックス

#
//@version=4
study('My Script')

plot(pvi, color=color.yellow)

// the same on pine
f_pvi() =>
    float pvi = 1.0
    float prevPvi = (nz(pvi[1], 0.0) == 0.0)  ? 1.0: pvi[1]
    if nz(close, 0.0) == 0.0 or nz(close[1], 0.0) == 0.0
        pvi := prevPvi
    else
        pvi := (volume > nz(volume[1], 0.0)) ? prevPvi + ((close - close[1]) / close[1]) * prevPvi : prevPvi
    result = pvi

plot(f_pvi())

pvt #

プライスボリュームトレンド

#
study('My Script')
plot(pvt, color=color.yellow)

// the same on pine
f_pvt() =>
    return = cum((change(close) / close[1]) * volume)

plot(f_pvt())

tr #

トゥルー・レンジ。tr(false)と同じです。max(high - low, abs(high - close[1]), abs(low - close[1])) です。

関連 #

tr, atr

vwap #

ボリューム加重平均価格。 それはソース形式としてhlc3を使用します。

関連 #

vwap

wad #

ウィリアムズ・アキュムレーション/ディストリビューション

#
study('My Script')
plot(wad, color=color.yellow)

// the same on pine
f_wad() =>
    trueHigh = max(high, close[1])
    trueLow = min(low, close[1])
    mom = change(close)
    gain = (mom > 0) ? close - trueLow : (mom < 0) ? close - trueHigh : 0
    return = cum(gain)

plot(f_wad())

wvad #

ウィリアムズ・可変アキュムレーション/ディストリビューション

#
study('My Script')
plot(wvad, color=color.yellow)

// the same on pine
f_wvad() =>
    return = (close - open) / (high - low) * volume

plot(f_wvad())

alma #

Arnaud Legoux 移動平均、それは移動平均の加重にガウシアン分布を用います。

alma(series, length, offset, sigma)  series[float]
alma(series, length, offset, sigma, floor)  series[float]
戻り値 #

Arnaud Legoux 移動平均

引数 #
series (series[float])処理する値の系列。
length (series[integer])バーの数(期間)。整数である必要があります。
offset (float)滑らかさ(1に近い)と応答性(0に近い)との間のトレードオフを制御する。
sigma (float)ALMAの滑らかさを変えます。 シグマが大きいほどより滑らかなALMA。
floor (bool)オプションパラメーター。ALMAを計算する前にオフセットの計算を切り捨てるかを指定します。デフォルト値は false です。
#
plot(alma(close, 9, 0.85, 6))

// same on pine, but much less efficient
pine_alma(series, windowsize, offset, sigma) =>
    m = offset * (windowsize - 1)
    //m = floor(offset * (windowsize - 1)) // Used as m when floor=true
    s = windowsize / sigma
    norm = 0.0
    sum = 0.0
    for i = 0 to windowsize - 1
        weight = exp(-1 * pow(i - m, 2) / (2 * pow(s, 2)))
        norm := norm + weight
        sum := sum + series[windowsize - i - 1] * weight
    sum / norm
plot(pine_alma(close, 9, 0.85, 6))
関連 #

sma, ema, rma, wma, vwma, swma

atr #

atr関数 (アベレージ・トゥルー・レンジ) は、トゥルー・レンジのRMAを返します。トゥルー・レンジは max(high - low, abs(high - close[1]), abs(low - close[1])) です。

atr(length)  series[float]
戻り値 #

正しい幅の平均。

引数 #
length (integer)期間 (バーをさかのぼる数)
#
plot(atr(14))

//the same on pine
pine_atr(length) =>
    trueRange = na(high[1])? high-low : max(max(high - low, abs(high - close[1])), abs(low - close[1]))
    //true range can be also calculated with tr(true)
    rma(trueRange, length)

plot(pine_atr(14))
関連 #

tr, rma

bb #

ボリンジャーバンド。ボリンジャーバンドはテクニカル分析ツールの一種で、銘柄価格の単純移動平均(SMA)から(正と負の方向に)2標準偏差離れてプロットされるラインから定義されます。各パラメーターはお好みに応じて調整可能です。

bb(series, length, mult)  [series[float], series[float], series[float]]
戻り値 #

ボリンジャーバンド。

引数 #
series (series[float])処理する値の系列。
length (series[integer])バーの数 (期間)。
mult (float)標準偏差ファクター
#
//@version=4
study('My Script')

[middle, upper, lower] = bb(close, 5, 4)
plot(middle, color=color.yellow)
plot(upper, color=color.yellow)
plot(lower, color=color.yellow)

// the same on pine
f_bb(src, length, mult) =>
    float basis = sma(src, length)
    float dev = mult * stdev(src, length)
    [basis, basis + dev, basis - dev]

[pineMiddle, pineUpper, pineLower] = f_bb(close, 5, 4)

plot(pineMiddle)
plot(pineUpper)
plot(pineLower)
関連 #

sma, stdev, kc

bbw #

ボリンジャーバンド幅。ボリンジャーバンド幅は上下のボリンジャーバンドの差を中央のバンドで割ったものです。

bbw(series, length, mult)  series[float]
戻り値 #

ボリンジャーバンド幅。

引数 #
series (series[float])処理する値の系列。
length (series[integer])バーの数 (期間)。
mult (float)標準偏差ファクター
#
//@version=4
study('My Script')

plot(bbw(close, 5, 4), color=color.yellow)

// the same on pine
f_bbw(src, length, mult) =>
    float basis = sma(src, length)
    float dev = mult * stdev(src, length)
    ((basis + dev) - (basis - dev)) / basis

plot(f_bbw(close, 5, 4))
関連 #

bb, sma, stdev

cci #

CCI (商品チャネル指数) は、商品の標準的な価格と単純移動平均を標準価格の平均絶対偏差で割った差として計算されます。 インデックスは0.015の逆係数でスケーリングされ、より分かり易い数値を提供します

cci(source, length)  series[float]
戻り値 #

過去yバーに対するxのコモディティチャネルインデックス。

引数 #
source (series[float])処理する値の系列。
length (series[integer])バーの数 (期間)。

cmo #

シャンデ・モメンタム・オシレーター。直近の上昇と下降の値幅の合計の差を計算し、その結果を同じ期間のすべての値幅合計で割ります。

cmo(series, length)  series[float]
戻り値 #

シャンデ・モメンタム・オシレーター。

引数 #
series (series[float])処理する値の系列。
length (series[integer])バーの数 (期間)。
#
study('My Script')
plot(cmo(close, 5), color=color.yellow)

// the same on pine
f_cmo(src, length) =>
    float mom = change(src)
    float sm1 = sum((mom >= 0) ? mom : 0.0, length)
    float sm2 = sum((mom >= 0) ? 0.0 : -mom, length)
    return = 100 * (sm1 - sm2) / (sm1 + sm2)

plot(f_cmo(close, 5))
関連 #

rsi, stoch, sum

cog #

cog(重心)は統計とフィボナッチの黄金比に基づいた指標です。

cog(source, length)  series[float]
戻り値 #

重心。

引数 #
source (series[float])処理する値の系列。
length (series[integer])バーの数 (期間)。
#
plot(cog(close, 10))

// the same on pine
pine_cog(source, length) =>
    sum = sum(source, length)
    num = 0.0
    for i = 0 to length - 1
        price = source[i]
        num := num + price * (i + 1)
    -num / sum

plot(pine_cog(close, 10))
関連 #

stoch

dmi #

dmi関数はDMI(方向性指数)を返します。

dmi(diLength, adxSmoothing)  [series[float], series[float], series[float]]
戻り値 #

3つのDMI系列のタプル: +DI(プラスの方向性指数)と -DI(プラスの方向性指数)、ADX(平均方向性指数)。

引数 #
diLength (integer)DI期間。
adxSmoothing (integer)ADXの平滑化期間。
#
study(title="Directional Movement Index", shorttitle="DMI", format=format.price, precision=4)
len = input(17, minval=1, title="DI Length")
lensig = input(14, title="ADX Smoothing", minval=1, maxval=50)
[diplus, diminus, adx] = dmi(len, lensig)
plot(adx, color=color.red, title="ADX")
plot(diplus, color=color.blue, title="+DI")
plot(diminus, color=color.orange, title="-DI")
関連 #

rsi, tsi, mfi

ema #

ema 関数は、指数加重移動平均を返します。ema では、重み付けの係数は指数関数的に減少します。以下の式を用いて計算されます: EMA = alpha * x + (1 - alpha) * EMA[1]、この時 alpha = 2 / (y + 1)

ema(source, length)  series[float]
戻り値 #

α= 2 /(y + 1)のxの指数移動平均

引数 #
source (series)処理する値の系列。
length (integer)バーの数 (期間)。
#
plot(ema(close, 15))

//the same on pine
pine_ema(src, length) =>
    alpha = 2 / (length + 1)
    sum = 0.0
    sum := na(sum[1]) ? sma(src, length) : alpha * src + (1 - alpha) * nz(sum[1])
plot(pine_ema(close,15))
備考 #

この変数/関数を使用すると、インジケーターのリペイントが発生する可能性がある事にご注意下さい。

関連 #

sma, rma, wma, vwma, swma, alma

hma #

hma関数はハル移動平均を戻します。

hma(source, length)  series[float]
戻り値 #

‘source’ の過去 ‘length’ バーのハル移動平均。

引数 #
source (series)処理する値の系列。
length (integer)バーの数。
#
study("Hull Moving Average")
src = input(defval=close, type=input.source, title="Source")
length = input(defval=9, type=input.integer, title="Length")
hmaBuildIn = hma(src, length)
plot(hmaBuildIn, title="Hull MA", color=#674EA7)
関連 #

ema, rma, wma, vwma, sma

kagi #

カギ足の値を要求するティッカー識別子を作成する。

kagi(symbol, reversal)  string
戻り値 #

security関数に渡すことができるティッカーIDの文字列。

引数 #
symbol (string)シンボルティッカー識別子。
reversal (float)転換量(絶対価格値)。
#
kagi_tickerid = kagi(syminfo.tickerid, 3)
kagi_close = security(kagi_tickerid, timeframe.period, close)
plot(kagi_close)
関連 #

syminfo.tickerid, syminfo.ticker, security, heikinashi, renko, linebreak, pointfigure

kc #

ケルトナーチャネル。ケルトナーチャネルは、中央に移動平均線と上下に一定の距離でチャネルを表示するテクニカル分析インジケーターです。

kc(series, length, mult)  [series[float], series[float], series[float]]
kc(series, length, mult, useTrueRange)  [series[float], series[float], series[float]]
戻り値 #

ケルトナーチャネル。

引数 #
series (series)処理する値の系列。
length (integer)バーの数 (期間)。
mult (float)標準偏差ファクター
useTrueRange (bool)オプションパラメーター。トゥルー・レンジを利用するかを指定します。デフォルトは true です。false の場合、レンジは以下の式で計算されます (high - low)。
#
//@version=4
study('My Script')

[middle, upper, lower] = kc(close, 5, 4)
plot(middle, color=color.yellow)
plot(upper, color=color.yellow)
plot(lower, color=color.yellow)


// the same on pine
f_kc(src, length, mult, useTrueRange) =>
    float basis = ema(src, length)
    float span = (useTrueRange) ? tr : (high - low)
    float rangeEma = ema(span, length)
    [basis, basis + rangeEma * mult, basis - rangeEma * mult]
    
[pineMiddle, pineUpper, pineLower] = f_kc(close, 5, 4, true)

plot(pineMiddle)
plot(pineUpper)
plot(pineLower)
関連 #

ema, atr, bb

kcw #

ケルトナーチャネル幅。ケルトナーチャネル幅は上下のケルトナーチャネルの差を中央のチャネルで割ったものです。

kcw(series, length, mult)  series[float]
kcw(series, length, mult, useTrueRange)  series[float]
戻り値 #

ケルトナーチャネル幅。

引数 #
series (series)処理する値の系列。
length (integer)バーの数 (期間)。
mult (float)標準偏差ファクター
useTrueRange (bool)オプションパラメーター。トゥルー・レンジを利用するかを指定します。デフォルトは true です。false の場合、レンジは以下の式で計算されます (high - low)。
#
//@version=4
study('My Script')

plot(kcw(close, 5, 4), color=color.yellow)

// the same on pine
f_kcw(src, length, mult, useTrueRange) =>
    float basis = ema(src, length)
    float span = (useTrueRange) ? tr : (high - low)
    float rangeEma = ema(span, length)
    
    ((basis + rangeEma * mult) - (basis - rangeEma * mult)) / basis

plot(f_kcw(close, 5, 4, true))
関連 #

kc, ema, atr, bb

macd #

MACD (移動平均の収束・拡散) 。株価のトレンドの強さ、方向、勢い、期間の変化を明らかにする方法です。

macd(source, fastlen, slowlen, siglen)  [series[float], series[float], series[float]]
戻り値 #

3つのMACD系列のタプル: MACDラインとシグナルライン、ヒストグラムのライン。

引数 #
source (series)処理する値の系列。
fastlen (integer)ファスト・パラメータ
slowlen (integer)スロー・パラメータ
siglen (integer)シグナルの期間のパラメーター。
#
// Example 1
study('MACD')
[macdLine, signalLine, histLine] = macd(close, 12, 26, 9)
plot(macdLine, color=color.blue)
plot(signalLine, color=color.orange)
plot(histLine, color=color.red, style=plot.style_histogram)

// Example 2
// If you need only one value, use placeholders '_' like this:
study('MACD')
[_, signalLine, _] = macd(close, 12, 26, 9)
plot(signalLine, color=color.orange)
関連 #

sma, ema

mfi #

マネーフローインデックス。マネーフローインデックス (MFI) は価格と出来高を利用して、アセットの買われすぎ/売られすぎの状態を判別するテクニカルオシレーターです。

mfi(series, length)  series[float]
戻り値 #

マネーフローインデックス。

引数 #
series (series[float])処理する値の系列。
length (series[integer])バーの数 (期間)。
#
//@version=4
study('My Script')

plot(mfi(close, 5), color=color.yellow)

// the same on pine
f_mfi(src, length) =>
    float upper = sum(volume * (change(src) <= 0.0 ? 0.0 : src), length)
    float lower = sum(volume * (change(src) >= 0.0 ? 0.0 : src), length)
    
    if na(lower)
        float res = na
        return = res
    else
        return = rsi(upper, lower)

plot(f_mfi(close, 5))
関連 #

rsi, sum

rma #

RSIで使用される移動平均。係数α= 1 / 期間で計算される指数加重移動平均です。

rma(source, length)  series[float]
戻り値 #

xに掛ける係数αがα = 1 / yとなる指数移動平均。

引数 #
source (series)処理する値の系列。
length (integer)バーの数 (期間)。
#
plot(rma(close, 15))

//the same on pine
pine_rma(src, length) =>
	alpha = 1/length
	sum = 0.0
	sum := na(sum[1]) ? sma(src, length) : alpha * src + (1 - alpha) * nz(sum[1])
plot(pine_rma(close, 15))
関連 #

sma, ema, wma, vwma, swma, alma, rsi

rsi #

相対的強度指数。 xの上下のrmaの変化に基づいて計算されます。

rsi(x, y)  series[float]
戻り値 #

RSI(相対力指数)

#
plot(rsi(close, 7))

// same on pine, but less efficient
pine_rsi(x, y) => 
    u = max(x - x[1], 0) // upward change
    d = max(x[1] - x, 0) // downward change
    rs = rma(u, y) / rma(d, y)
    res = 100 - 100 / (1 + rs)
    res

plot(pine_rsi(close, 7))
備考 #

xが系列でyが整数の場合、xは元の系列でyは期間です。
x及びyが級数である場合、x及びyは、上向きおよび下向きの変化について2つの計算されたMAとみなされる。

関連 #

rma

sar #

パラボリックSAR (パラボリック・ストップ&リバース) は、J・ウェルズ・ワイルダー・ジュニアによって考案された手法であり、トレード商品の市場価格の方向の潜在的な反転を見い出します。

sar(start, inc, max)  series[float]
戻り値 #

パラボリックSAR

引数 #
start (float)スタート。
inc (float)増加。
max (float)最大値。
#
plot(sar(0.2, 0.2, .2), style=plot.style_cross, linewidth=3)

// The same on Pine
pine_sar(start, inc, max) =>
	var float result = na
	var float maxMin = na
	var float acceleration = na
	var bool isBelow = na
	bool isFirstTrendBar = false
	
	if bar_index == 1
		if close > close[1]
			isBelow := true
			maxMin := high
			result := low[1]
		else
			isBelow := false
			maxMin := low
			result := high[1]
		isFirstTrendBar := true
		acceleration := start
	
	result := result + acceleration * (maxMin - result)
	
	if isBelow
		if result > low
			isFirstTrendBar := true
			isBelow := false
			result := max(high, maxMin)
			maxMin := low
			acceleration := start
	else
		if result < high
			isFirstTrendBar := true
			isBelow := true
			result := min(low, maxMin)
			maxMin := high
			acceleration := start
			
	if not isFirstTrendBar
		if isBelow
			if high > maxMin
				maxMin := high
				acceleration := min(acceleration + inc, max)
		else
			if low < maxMin
				maxMin := low
				acceleration := min(acceleration + inc, max)
	
	if isBelow
		result := min(result, low[1])
		if bar_index > 1
			result := min(result, low[2])
		
	else
		result := max(result, high[1])
		if bar_index > 1
			result := max(result, high[2])
	
	result
	
plot(pine_sar(0.2, 0.2, .2), style=plot.style_cross, linewidth=3)

sma #

sma関数はxの最後のy値の合計をyで割った移動平均を返します。

sma(source, length)  series[float]
戻り値 #

過去のyバーによるxの単純移動平均。

引数 #
source (series[float])処理する値の系列。
length (series[integer])バーの数(期間)。整数である必要があります。
#
plot(sma(close, 15))

// same on pine, but much less efficient
pine_sma(x, y) =>
    sum = 0.0
    for i = 0 to y - 1
        sum := sum + x[i] / y
    sum
plot(pine_sma(close, 15))
関連 #

ema, rma, wma, vwma, swma, alma

stoch #

ストキャスティクス。以下の式で計算される:100 * (close - lowest(low, length)) / (highest(high, length) - lowest(low, length))

stoch(source, high, low, length)  series[float]
戻り値 #

ストキャスティクス

引数 #
source (series[float])ソースの系列。
high (series[float])高さの形式。
low (series[float])低さの形式。
length (series[integer])期間 (バーをさかのぼる数)
関連 #

cog

supertrend #

スーパートレンドインジケーター。スーパートレンドはトレンドフォローのインジケーターです。

supertrend(factor, atrPeriod)  [series[float], series[float]]
戻り値 #

2つのスーパートレンド系列のタプル: スーパートレンドのラインとトレンドの方向。可能な値は 1(上方向)と -1(下方向)です。

引数 #
factor (series)ATRに掛ける乗数
atrPeriod (integer)ATRの期間。
#
//@version=4
study("Supertrend", overlay=true)
mult = input(type=input.float, defval=4)
len = input(type=input.integer, defval=14)
[superTrend, dir] = supertrend(mult, len)
colResistance = dir == 1 and dir == dir[1] ? color.new(color.red, 0) : color.new(color.red, 100)
colSupport = dir == -1 and dir == dir[1] ? color.new(color.green, 0) : color.new(color.green, 100)
plot(superTrend, color = colResistance, linewidth=2)
plot(superTrend, color = colSupport, linewidth=2)
関連 #

macd

swma #

固定期間の対称加重移動平均: 4. 重み: [1/6, 2/6, 2/6, 1/6]。

swma(x)  series[float]
戻り値 #

対照加重移動平均

引数 #
x (series)ソースの系列。
#
plot(swma(close))

// same on pine, but less efficient
pine_swma(x) =>
    x[3] * 1 / 6 + x[2] * 2 / 6 + x[1] * 2 / 6 + x[0] * 1 / 6
plot(pine_swma(close))
関連 #

sma, ema, rma, wma, vwma, alma

tr #

トゥルー・レンジ。max(high - low, abs(high - close[1]), abs(low - close[1])) です。

tr(handle_na)  series[float]
戻り値 #

トゥルー・レンジ。max(high - low, abs(high - close[1]), abs(low - close[1])) です。

引数 #
handle_na (bool)NaN値の扱い方。もしtrueで前日の終値がNaNの場合、trは現在の日の高低として計算される。それ以外の場合(falseの場合)はtrはNaNを返す。また atrがtr(true)を利用することにもご注意ください。
備考 #

tr(false)は{@ var tr}と全く同じです。

関連 #

tr, atr

tsi #

トゥルー・ストレングス・インデックス。金融商品の基本的なモメンタムの移動平均を使用します。

tsi(source, short_length, long_length)  series[float]
戻り値 #

トゥルー・ストレングス・インデックス。[-1,1] の範囲の値

引数 #
source (series)ソースの系列。
short_length (integer)ショートの期間。
long_length (integer)ロングの期間

variance #

分散は、一連の平均値からの偏差の平方根(sma)の期待値であり、平均からどれくらいの数が広がっているかを非形式的に測定します。

variance(source, length)  series[float]
戻り値 #

過去yバーのxの分散。

引数 #
source (series[float])処理する値の系列。
length (series[integer])バーの数 (期間)。
備考 #

これはサンプル分散のベイズ推定です。

関連 #

dev, stdev

vwap #

出来高加重平均価格。

vwap(x)  series[float]
戻り値 #

出来高加重平均。

引数 #
x (series)ソースの系列。
関連 #

vwap

vwma #

vwma関数は、過去yバーに対するボリュームの加重移動平均xを返します。 sma(x * volume、y)/ sma(volume、y)と同じです。

vwma(source, length)  series[float]
戻り値 #

過去yバーに対するxのボリューム加重移動平均。

引数 #
source (series[float])処理する値の系列。
length (series[integer])バーの数(期間)。整数である必要があります。
#
plot(vwma(close, 15))

// same on pine, but less efficient
pine_vwma(x, y) =>
    sma(x * volume, y) / sma(volume, y)
plot(pine_vwma(close, 15))
関連 #

sma, ema, rma, wma, swma, alma

wma #

wma関数は、過去yバーのxの加重移動平均を返します。 wmaにおいて、加重係数は等差級数的に減少する。

wma(source, length)  series[float]
戻り値 #

過去yバーに対するxの加重移動平均。

引数 #
source (series[float])処理する値の系列。
length (series[integer])バーの数(期間)。整数である必要があります。
#
plot(wma(close, 15))

// same on pine, but much less efficient
pine_wma(x, y) =>
    norm = 0.0
    sum = 0.0
    for i = 0 to y - 1
        weight = (y - i) * y
        norm := norm + weight
        sum := sum + x[i] * weight
    sum / norm
plot(pine_wma(close, 15))
関連 #

sma, ema, rma, vwma, swma, alma

wpr #

ウィリアムズ%R。このオシレーターは、過去 ‘length’ バーの高値及び安値と現在の終値との位置関係を示します。

wpr(length)  series[float]
戻り値 #

ウィリアムズ%R。

引数 #
length (series[integer])バーの数。
#
//@version=4
study("Williams %R", shorttitle="%R", format=format.price, precision=2)
plot(wpr(14), title="%R", color=#ff6d00, transp=0)
関連 #

mfi, cmo

© - 2021 - TradingViewの教科書