ta

ta.accdist #

アキュムレーション/ディストリビューションインデックス

ta.iii #

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

#
//@version=5
indicator('My Script')
plot(ta.iii, color=color.yellow)

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

plot(f_iii())

ta.nvi #

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

#
//@version=5
indicator('My Script')

plot(ta.nvi, color=color.yellow)

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

plot(f_nvi())

ta.obv #

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

#
//@version=5
indicator('My Script')
plot(ta.obv, color=color.yellow)

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

plot(f_obv())

ta.pvi #

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

#
//@version=5
indicator('My Script')

plot(ta.pvi, color=color.yellow)

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

plot(f_pvi())

ta.pvt #

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

#
//@version=5
indicator('My Script')
plot(ta.pvt, color=color.yellow)

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

plot(f_pvt())

ta.tr #

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

関連 #

ta.tr, ta.atr

ta.vwap #

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

関連 #

ta.vwap

ta.wad #

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

#
//@version=5
indicator('My Script')
plot(ta.wad, color=color.yellow)

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

plot(f_wad())

ta.wvad #

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

#
//@version=5
indicator('My Script')
plot(ta.wvad, color=color.yellow)

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

plot(f_wvad())

ta.alma #

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

ta.alma(series, length, offset, sigma)  series float
ta.alma(series, length, offset, sigma, floor)  series float
戻り値 #

Arnaud Legoux 移動平均

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

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

ta.sma, ta.ema, ta.rma, ta.wma, ta.vwma, ta.swma

ta.atr #

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

ta.atr(length)  series float
戻り値 #

正しい幅の平均。

引数 #
length (simple int)期間 (バーをさかのぼる数)
#
plot(ta.atr(14))

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

plot(pine_atr(14))
関連 #

ta.tr, ta.rma

ta.barssince #

最後に条件が true だった時からのバーの数を計算します

ta.barssince(condition)  series int
戻り値 #

条件がtrueであったバーの数

#
// get number of bars since last color.green bar
ta.barssince(close >= open)
備考 #

現在のバーより前に条件が満たされていない場合、関数は na を返します。
この変数/関数を使用すると、インジケーターのリペイントが発生する可能性がある事にご注意下さい。

関連 #

ta.lowestbars, ta.highestbars, ta.valuewhen, ta.highest, ta.lowest

ta.bb #

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

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

ボリンジャーバンド。

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

[middle, upper, lower] = ta.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 = ta.sma(src, length)
    float dev = mult * ta.stdev(src, length)
    [basis, basis + dev, basis - dev]

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

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

ta.sma, ta.stdev, ta.kc

ta.bbw #

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

ta.bbw(series, length, mult)  series float
戻り値 #

ボリンジャーバンド幅。

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

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

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

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

ta.bb, ta.sma, ta.stdev

ta.cci #

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

ta.cci(source, length)  series float
戻り値 #

Commodity channel index of source for length bars back.

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

ta.change #

Difference between current value and previous, source - source[length].

ta.change(source, length)  series float
ta.change(source)  series float
戻り値 #

減算の結果。

引数 #
source (series int/float)ソースの系列。
length (series int)現在のバーから前のバーまでの補正。 追加として、もし指定されない場合は、length = 1が使用されます。
関連 #

ta.mom, ta.cross

ta.cmo #

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

ta.cmo(series, length)  series float
戻り値 #

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

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

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

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

ta.rsi, ta.stoch, math.sum

ta.cog #

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

ta.cog(source, length)  series float
戻り値 #

重心。

引数 #
source (series int/float)処理する値の系列。
length (series int)バーの数 (期間)。
#
plot(ta.cog(close, 10))

// the same on pine
pine_cog(source, length) =>
    sum = math.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))
関連 #

ta.stoch

ta.correlation #

Correlation coefficient. Describes the degree to which two series tend to deviate from their ta.sma values.

ta.correlation(source1, source2, length)  series float
戻り値 #

相関係数。

引数 #
source1 (series int/float)ソースの系列。
source2 (series int/float)ターゲットの形式。
length (series int)期間 (バーをさかのぼる数)
関連 #

request.security

ta.cross #

2つの系列が互いに交差する場合は true、そうでない場合は false です。

ta.cross(source1, source2)  series bool
戻り値 #

2つの系列が互いに交差する場合は true、そうでない場合は false です。

引数 #
source1 (series int/float)First data series.
source2 (series int/float)Second data series.
関連 #

ta.change

ta.crossover #

The source1-series is defined as having crossed over source2-series if, on the current bar, the value of source1 is greater than the value of source2, and on the previous bar, the value of source1 was less than the value of source2.

ta.crossover(source1, source2)  series bool
戻り値 #

true if source1 crossed over source2 otherwise false.

引数 #
source1 (series int/float)First data series.
source2 (series int/float)Second data series.

ta.crossunder #

The source1-series is defined as having crossed under source2-series if, on the current bar, the value of source1 is less than the value of source2, and on the previous bar, the value of source1 was greater than the value of source2.

ta.crossunder(source1, source2)  series bool
戻り値 #

true if source1 crossed under source2 otherwise false.

引数 #
source1 (series int/float)First data series.
source2 (series int/float)Second data series.

ta.cum #

Cumulative (total) sum of source. In other words it’s a sum of all elements of source.

ta.cum(source)  series float
戻り値 #

系列の総和。

関連 #

math.sum

ta.dev #

Measure of difference between the series and it’s ta.sma

ta.dev(source, length)  series float
戻り値 #

Deviation of source for length bars back.

引数 #
source (series int/float)処理する値の系列。
length (series int)バーの数 (期間)。
#
plot(ta.dev(close, 10))

// the same on pine
pine_dev(source, length) =>
    mean = ta.sma(source, length)
    sum = 0.0
    for i = 0 to length - 1
        val = source[i]
        sum := sum + math.abs(val - mean)
    dev = sum/length
plot(pine_dev(close, 10))
関連 #

ta.variance, ta.stdev

ta.dmi #

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

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

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

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

ta.rsi, ta.tsi, ta.mfi

ta.ema #

The ema function returns the exponentially weighted moving average. In ema weighting factors decrease exponentially. It calculates by using a formula: EMA = alpha * source + (1 - alpha) * EMA[1], where alpha = 2 / (length + 1).

ta.ema(source, length)  series float
戻り値 #

Exponential moving average of source with alpha = 2 / (length + 1).

引数 #
source (series int/float)処理する値の系列。
length (simple int)バーの数 (期間)。
#
plot(ta.ema(close, 15))

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

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

関連 #

ta.sma, ta.rma, ta.wma, ta.vwma, ta.swma, ta.alma

ta.falling #

Test if the source series is now falling for length bars long.

ta.falling(source, length)  series bool
戻り値 #

true if current source value is less than any previous source value for length bars back, false otherwise.

引数 #
source (series int/float)処理する値の系列。
length (series int)バーの数 (期間)。
関連 #

ta.rising

ta.highest #

指定された過去バーの範囲での最高値。

ta.highest(source, length)  series float
ta.highest(length)  series float
戻り値 #

Highest value in the series.

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

Two args version: source is a series and length is the number of bars back.
One arg version: length is the number of bars back. Algorithm uses high as a source series.

関連 #

ta.lowest, ta.lowestbars, ta.highestbars, ta.valuewhen, ta.barssince

ta.highestbars #

指定された過去バーの範囲で最高値のバーのオフセット位置。

ta.highestbars(source, length)  series int
ta.highestbars(length)  series int
戻り値 #

最高値のバー位置へのオフセット。

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

Two args version: source is a series and length is the number of bars back.
One arg version: length is the number of bars back. Algorithm uses high as a source series.

関連 #

ta.lowest, ta.highest, ta.lowestbars, ta.barssince, ta.valuewhen

ta.hma #

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

ta.hma(source, length)  series float
戻り値 #

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

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

ta.ema, ta.rma, ta.wma, ta.vwma, ta.sma

ta.kc #

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

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

ケルトナーチャネル。

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

[middle, upper, lower] = ta.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 = ta.ema(src, length)
    float span = (useTrueRange) ? ta.tr : (high - low)
    float rangeEma = ta.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)
関連 #

ta.ema, ta.atr, ta.bb

ta.kcw #

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

ta.kcw(series, length, mult)  series float
ta.kcw(series, length, mult, useTrueRange)  series float
戻り値 #

ケルトナーチャネル幅。

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

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

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

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

ta.kc, ta.ema, ta.atr, ta.bb

ta.linreg #

Linear regression curve. A line that best fits the prices specified over a user-defined time period. It is calculated using the least squares method. The result of this function is calculated using the formula: linreg = intercept + slope * (length - 1 - offset), where intercept and slope are the values calculated with the least squares method on source series.

ta.linreg(source, length, offset)  series float
戻り値 #

線形回帰曲線

引数 #
source (series int/float)ソースの系列。
offset (simple int)補正。

ta.lowest #

指定された過去バーの範囲での最安値。

ta.lowest(source, length)  series float
ta.lowest(length)  series float
戻り値 #

Lowest value in the series.

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

Two args version: source is a series and length is the number of bars back.
One arg version: length is the number of bars back. Algorithm uses low as a source series.

関連 #

ta.highest, ta.lowestbars, ta.highestbars, ta.valuewhen, ta.barssince

ta.lowestbars #

指定された過去バーの範囲で最安値のバーのオフセット位置。

ta.lowestbars(source, length)  series int
ta.lowestbars(length)  series int
戻り値 #

最安値のバー位置へのオフセット。

引数 #
source (series int/float)処理する値の系列。
length (series int)Number of bars back.
備考 #

Two args version: source is a series and length is the number of bars back.
One arg version: length is the number of bars back. Algorithm uses low as a source series.

関連 #

ta.lowest, ta.highest, ta.highestbars, ta.barssince, ta.valuewhen

ta.macd #

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

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

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

引数 #
source (series int/float)処理する値の系列。
fastlen (simple int)ファスト・パラメータ
slowlen (simple int)スロー・パラメータ
siglen (simple int)シグナルの期間のパラメーター。
#
// Example 1
indicator('MACD')
[macdLine, signalLine, histLine] = ta.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:
indicator('MACD')
[_, signalLine, _] = ta.macd(close, 12, 26, 9)
plot(signalLine, color=color.orange)
関連 #

ta.sma, ta.ema

ta.median #

系列の中央値を返します。

ta.median(source, length)  series float
ta.median(source, length)  series int
戻り値 #

系列の中央値。

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

ta.mfi #

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

ta.mfi(series, length)  series float
戻り値 #

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

引数 #
series (series int/float)処理する値の系列。
length (series int)バーの数 (期間)。
#
//@version=5
indicator('Money Flow Index')

plot(ta.mfi(close, 14), color=color.yellow)

// the same on pine
pine_mfi(src, length) =>
    float upper = math.sum(volume * (ta.change(src) <= 0.0 ? 0.0 : src), length)
    float lower = math.sum(volume * (ta.change(src) >= 0.0 ? 0.0 : src), length)
    mfi = 100.0 - (100.0 / (1.0 + upper / lower))
    mfi

plot(pine_mfi(close, 14))
関連 #

ta.rsi, math.sum

ta.mode #

系列の最頻値を返します。同じ頻度の値が複数ある場合は、最小の値を返します。

ta.mode(source, length)  series float
ta.mode(source, length)  series int
戻り値 #

系列の最頻値。

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

ta.mom #

Momentum of source price and source price length bars ago. This is simply a difference: source - source[length].

ta.mom(source, length)  series float
戻り値 #

Momentum of source price and source price length bars ago.

引数 #
source (series int/float)処理する値の系列。
length (series int)現在のバーから前のバーまでを補正
関連 #

ta.change

ta.percentile_linear_interpolation #

最も近い2つのランク間の線型補間の方法を利用してパーセンタイルを計算する。

ta.percentile_linear_interpolation(source, length, percentage)  series float
戻り値 #

P-th percentile of source series for length bars back.

引数 #
source (series int/float)処理する値の系列 (source)。
length (series int)過去バーの数(期間)。
percentage (simple int/float)パーセンテージ、0~100の範囲の数値。
備考 #

この方法を使用して計算された%計算は、常に入力されたデータセットのメンバーではないことに注意してください。

関連 #

ta.percentile_nearest_rank

ta.percentile_nearest_rank #

最も近い順位の方法を利用して、小さい数字から大きい数字に並び替えて%表示する。

ta.percentile_nearest_rank(source, length, percentage)  series float
戻り値 #

P-th percentile of source series for length bars back.

引数 #
source (series int/float)処理する値の系列 (source)。
length (series int)過去バーの数(期間)。
percentage (simple int/float)パーセンテージ、0~100の範囲の数値。
備考 #

バックバーが100バー未満の場合、直近のランキング方法を使用すると、1つ以上のパーセンタイルに同じ値が使用される可能性があります。
最も近いランクメソッドを使って計算されたパーセンタイルは必ず入力されたデータセットのメンバーとなります。
100のパーセンタイルは、入力データセットの中で最大値となるように定義されています。

関連 #

ta.percentile_linear_interpolation

ta.percentrank #

パーセントランクは、以前の値の数が指定された系列の現在の値以下の割合をパーセントで表したものです。

ta.percentrank(source, length)  series float
戻り値 #

Percent rank of source for length bars back.

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

ta.pivothigh #

この関数はピボットハイポイントの価格を返します。 ピボットハイポイントがない場合は’NaN’を返します。

ta.pivothigh(source, leftbars, rightbars)  series float
ta.pivothigh(leftbars, rightbars)  series float
戻り値 #

ポイントまたは ‘NaN’の価格。

引数 #
source (series int/float)オプションパラメーター。 値を計算するデータ系列。デフォルトは ‘High’ です。
leftbars (series int/float)左の期間。
rightbars (series int/float)右の期間。
#
indicator("PivotHigh", overlay=true)
leftBars = input(2)
rightBars=input(2)
ph = ta.pivothigh(leftBars, rightBars)
plot(ph, style=plot.style_cross, linewidth=3, color= color.red, offset=-rightBars)
備考 #

パラメーター ‘leftbars’ や ‘rightbars’ が系列の場合には、‘source’ 変数にmax_bars_back関数を利用する必要があります。

ta.pivotlow #

この関数はピボットローポイントの価格を返します。 ピボットローポイントがない場合は ‘NaN’を返します。

ta.pivotlow(source, leftbars, rightbars)  series float
ta.pivotlow(leftbars, rightbars)  series float
戻り値 #

ポイントまたは ‘NaN’の価格。

引数 #
source (series int/float)オプションパラメーター。値を計算するデータ系列です。デフォルトは ‘Low’ です。
leftbars (series int/float)左の期間。
rightbars (series int/float)右の期間。
#
indicator("PivotLow", overlay=true)
leftBars = input(2)
rightBars=input(2)
pl = ta.pivotlow(close, leftBars, rightBars)
plot(pl, style=plot.style_cross, linewidth=3, color= color.blue, offset=-rightBars)
備考 #

パラメーター ‘leftbars’ や ‘rightbars’ が系列の場合には、‘source’ 変数にmax_bars_back関数を利用する必要があります。

ta.range #

系列の最小値と最大値の差を返します。

ta.range(source, length)  series float
ta.range(source, length)  series int
戻り値 #

系列の最小値と最大値の差。

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

ta.rising #

Test if the source series is now rising for length bars long.

ta.rising(source, length)  series bool
戻り値 #

true if current source is greater than any previous source for length bars back, false otherwise.

引数 #
source (series int/float)処理する値の系列。
length (series int)バーの数 (期間)。
関連 #

ta.falling

ta.rma #

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

ta.rma(source, length)  series float
戻り値 #

Exponential moving average of source with alpha = 1 / length.

引数 #
source (series int/float)処理する値の系列。
length (simple int)バーの数 (期間)。
#
plot(ta.rma(close, 15))

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

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

ta.roc #

Function roc (rate of change) showing the difference between current value of source and the value of source that was length days ago.

ta.roc(source, length)  series float
戻り値 #

The rate of change of source for length bars back.

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

ta.rsi #

Relative strength index. It is calculated using the ta.rma() of upward and downward changes of source over the last length bars.

ta.rsi(source, length)  series float
戻り値 #

RSI(相対力指数)

引数 #
source (series int/float)処理する値の系列。
length (simple int)バーの数 (期間)。
#
plot(ta.rsi(close, 7))

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

plot(pine_rsi(close, 7))
関連 #

ta.rma

ta.sar #

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

ta.sar(start, inc, max)  series float
戻り値 #

パラボリックSAR

引数 #
start (simple int/float)スタート。
inc (simple int/float)増加。
max (simple int/float)最大値。
#
plot(ta.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 := math.max(high, maxMin)
			maxMin := low
			acceleration := start
	else
		if result < high
			isFirstTrendBar := true
			isBelow := true
			result := math.min(low, maxMin)
			maxMin := high
			acceleration := start
			
	if not isFirstTrendBar
		if isBelow
			if high > maxMin
				maxMin := high
				acceleration := math.min(acceleration + inc, max)
		else
			if low < maxMin
				maxMin := low
				acceleration := math.min(acceleration + inc, max)
	
	if isBelow
		result := math.min(result, low[1])
		if bar_index > 1
			result := math.min(result, low[2])
		
	else
		result := math.max(result, high[1])
		if bar_index > 1
			result := math.max(result, high[2])
	
	result
	
plot(pine_sar(0.2, 0.2, .2), style=plot.style_cross, linewidth=3)

ta.sma #

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

ta.sma(source, length)  series float
戻り値 #

Simple moving average of source for length bars back.

引数 #
source (series int/float)処理する値の系列。
length (series int)バーの数 (期間)。
#
plot(ta.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))
関連 #

ta.ema, ta.rma, ta.wma, ta.vwma, ta.swma, ta.alma

ta.stdev #

標準偏差。

ta.stdev(source, length)  series float
戻り値 #

標準偏差。

引数 #
source (series int/float)処理する値の系列。
length (series int)バーの数 (期間)。
#
plot(ta.stdev(close, 5))

//the same on pine
isZero(val, eps) => math.abs(val) <= eps

SUM(fst, snd) =>
    EPS = 1e-10
    res = fst + snd
    if isZero(res, EPS)
        res := 0
    else
        if not isZero(res, 1e-4)
            res := res
        else
            15

pine_stdev(src, length) =>
    avg = ta.sma(src, length)
    sumOfSquareDeviations = 0.0
    for i = 0 to length - 1
        sum = SUM(src[i], -avg)
        sumOfSquareDeviations := sumOfSquareDeviations + sum * sum

    stdev = math.sqrt(sumOfSquareDeviations / length)
plot(pine_stdev(close, 5))
備考 #

これは標準偏差のベイズ推定です。

関連 #

ta.dev, ta.variance

ta.stoch #

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

ta.stoch(source, high, low, length)  series float
戻り値 #

ストキャスティクス

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

ta.cog

ta.supertrend #

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

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

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

引数 #
factor (series int/float)ATRに掛ける乗数
atrPeriod (simple int)ATRの期間。
#
//@version=5
indicator("Supertrend", overlay=true)
mult = input.float(defval=4)
len = input(defval=14)
[superTrend, dir] = ta.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)
関連 #

ta.macd

ta.swma #

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

ta.swma(source)  series float
戻り値 #

対照加重移動平均

引数 #
source (series int/float)ソースの系列。
#
plot(ta.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))
関連 #

ta.sma, ta.ema, ta.rma, ta.wma, ta.vwma, ta.alma

ta.tr #

True range. It is math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1])).

ta.tr(handle_na)  series float
戻り値 #

True range. It is math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1])).

引数 #
handle_na (simple bool)How NaN values are handled. if true, and previous day’s close is NaN then tr would be calculated as current day high-low. Otherwise (if false) tr would return NaN in such cases. Also note, that ta.atr uses ta.tr(true).
備考 #

ta.tr(false) is exactly the same as ta.tr.

関連 #

ta.tr, ta.atr

ta.tsi #

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

ta.tsi(source, short_length, long_length)  series float
戻り値 #

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

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

ta.valuewhen #

最も最近発生したn番目の条件がtrueの際のソース形式値。

ta.valuewhen(condition, source, occurrence)  series float
ta.valuewhen(condition, source, occurrence)  series int
戻り値 #

条件がtrueの時のソース値

#
slow = ta.sma(close, 7)
fast = ta.sma(close, 14)
// get value of close on second cross occurrence
ta.valuewhen(ta.cross(slow, fast), close, 1)
備考 #

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

関連 #

ta.lowestbars, ta.highestbars, ta.barssince, ta.highest, ta.lowest

ta.variance #

Variance is the expectation of the squared deviation of a series from its mean (ta.sma), and it informally measures how far a set of numbers are spread out from their mean.

ta.variance(source, length)  series float
戻り値 #

Variance of source for length bars back.

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

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

関連 #

ta.dev, ta.stdev

ta.vwap #

出来高加重平均価格。

ta.vwap(source)  series float
戻り値 #

出来高加重平均。

引数 #
source (series int/float)ソースの系列。
関連 #

ta.vwap

ta.vwma #

The vwma function returns volume-weighted moving average of source for length bars back. It is the same as: sma(source * volume, length) / sma(volume, length).

ta.vwma(source, length)  series float
戻り値 #

Volume-weighted moving average of source for length bars back.

引数 #
source (series int/float)処理する値の系列。
length (series int)バーの数 (期間)。
#
plot(ta.vwma(close, 15))

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

ta.sma, ta.ema, ta.rma, ta.wma, ta.swma, ta.alma

ta.wma #

The wma function returns weighted moving average of source for length bars back. In wma weighting factors decrease in arithmetical progression.

ta.wma(source, length)  series float
戻り値 #

Weighted moving average of source for length bars back.

引数 #
source (series int/float)処理する値の系列。
length (series int)バーの数 (期間)。
#
plot(ta.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))
関連 #

ta.sma, ta.ema, ta.rma, ta.vwma, ta.swma, ta.alma

ta.wpr #

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

ta.wpr(length)  series float
戻り値 #

ウィリアムズ%R。

引数 #
length (series int)バーの数。
#
//@version=5
indicator("Williams %R", shorttitle="%R", format=format.price, precision=2)
plot(ta.wpr(14), title="%R", color=color.new(#ff6d00, 0))
関連 #

ta.mfi, ta.cmo

© - 2021 - TradingViewの教科書