trader_cci
(PECL trader >= 0.2.0)
trader_cci — Commodity Channel Index
Описание
array trader_cci
( array
$high
, array $low
, array $close
[, integer $timePeriod
] )
Список параметров
-
high
-
Высокая цена, массив реальных значений.
-
low
-
Низкая цена, массив реальных значений.
-
close
-
Цена закрытия, массив реальных значений.
-
timePeriod
-
Номер периода. Допустимы значения от 2 до 100000.
Возвращаемые значения
Returns an array with calculated data or false on failure.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Математические расширения
- Technical Analysis for Traders
- trader_acos
- trader_ad
- trader_add
- trader_adosc
- trader_adx
- trader_adxr
- trader_apo
- trader_aroon
- trader_aroonosc
- trader_asin
- trader_atan
- trader_atr
- trader_avgprice
- trader_bbands
- trader_beta
- trader_bop
- trader_cci
- trader_cdl2crows
- trader_cdl3blackcrows
- trader_cdl3inside
- trader_cdl3linestrike
- trader_cdl3outside
- trader_cdl3starsinsouth
- trader_cdl3whitesoldiers
- trader_cdlabandonedbaby
- trader_cdladvanceblock
- trader_cdlbelthold
- trader_cdlbreakaway
- trader_cdlclosingmarubozu
- trader_cdlconcealbabyswall
- trader_cdlcounterattack
- trader_cdldarkcloudcover
- trader_cdldoji
- trader_cdldojistar
- trader_cdldragonflydoji
- trader_cdlengulfing
- trader_cdleveningdojistar
- trader_cdleveningstar
- trader_cdlgapsidesidewhite
- trader_cdlgravestonedoji
- trader_cdlhammer
- trader_cdlhangingman
- trader_cdlharami
- trader_cdlharamicross
- trader_cdlhighwave
- trader_cdlhikkake
- trader_cdlhikkakemod
- trader_cdlhomingpigeon
- trader_cdlidentical3crows
- trader_cdlinneck
- trader_cdlinvertedhammer
- trader_cdlkicking
- trader_cdlkickingbylength
- trader_cdlladderbottom
- trader_cdllongleggeddoji
- trader_cdllongline
- trader_cdlmarubozu
- trader_cdlmatchinglow
- trader_cdlmathold
- trader_cdlmorningdojistar
- trader_cdlmorningstar
- trader_cdlonneck
- trader_cdlpiercing
- trader_cdlrickshawman
- trader_cdlrisefall3methods
- trader_cdlseparatinglines
- trader_cdlshootingstar
- trader_cdlshortline
- trader_cdlspinningtop
- trader_cdlstalledpattern
- trader_cdlsticksandwich
- trader_cdltakuri
- trader_cdltasukigap
- trader_cdlthrusting
- trader_cdltristar
- trader_cdlunique3river
- trader_cdlupsidegap2crows
- trader_cdlxsidegap3methods
- trader_ceil
- trader_cmo
- trader_correl
- trader_cos
- trader_cosh
- trader_dema
- trader_div
- trader_dx
- trader_ema
- trader_errno
- trader_exp
- trader_floor
- trader_get_compat
- trader_get_unstable_period
- trader_ht_dcperiod
- trader_ht_dcphase
- trader_ht_phasor
- trader_ht_sine
- trader_ht_trendline
- trader_ht_trendmode
- trader_kama
- trader_linearreg_angle
- trader_linearreg_intercept
- trader_linearreg_slope
- trader_linearreg
- trader_ln
- trader_log10
- trader_ma
- trader_macd
- trader_macdext
- trader_macdfix
- trader_mama
- trader_mavp
- trader_max
- trader_maxindex
- trader_medprice
- trader_mfi
- trader_midpoint
- trader_midprice
- trader_min
- trader_minindex
- trader_minmax
- trader_minmaxindex
- trader_minus_di
- trader_minus_dm
- trader_mom
- trader_mult
- trader_natr
- trader_obv
- trader_plus_di
- trader_plus_dm
- trader_ppo
- trader_roc
- trader_rocp
- trader_rocr100
- trader_rocr
- trader_rsi
- trader_sar
- trader_sarext
- trader_set_compat
- trader_set_unstable_period
- trader_sin
- trader_sinh
- trader_sma
- trader_sqrt
- trader_stddev
- trader_stoch
- trader_stochf
- trader_stochrsi
- trader_sub
- trader_sum
- trader_t3
- trader_tan
- trader_tanh
- trader_tema
- trader_trange
- trader_trima
- trader_trix
- trader_tsf
- trader_typprice
- trader_ultosc
- trader_var
- trader_wclprice
- trader_willr
- trader_wma
Коментарии
<?php
// The CCI (Commodity Channel Index) is an oscillator that
// relies on historical price momentum to determine if it is "overbought" or "oversold".
// When greater than zero the price is "above" the historic average.
// When less than zero the price is "below" the historic average.
// Investopedia claims:
// "The CCI is an unbounded oscillator, meaning it can go higher or lower indefinitely. For this reason, overbought and oversold levels are typically determined for each individual asset by looking at historical extreme CCI levels where the price reversed from."
$highs = array(118.99, 119.14, 120.5, 115.23, 115.93, 118.829, 116, 112.2, 110.88, 110.19, 112.86, 112.11, 110.25, 112.44);
$lows = array(112.68, 115.26, 112.5, 110, 112.8, 113.61, 112.04, 108.71, 106.09, 103.1, 109.16, 106.77, 105, 107.67);
$closes = array(112.82, 117.32, 113.49, 112, 115.355, 115.54, 112.13, 110.34, 106.84, 110.08, 111.81, 107.12, 108.22, 112.28);
$time_period = 7;
var_dump(trader_cci ($highs, $lows, $closes, $time_period));
/*
array(8) {
[6]=>
float(-83.234)
[7]=>
float(-137.329)
[8]=>
float(-145.78)
[9]=>
float(-101.047)
[10]=>
float(-9.331)
[11]=>
float(-59.339)
[12]=>
float(-66.964)
[13]=>
float(76.143)
}
*/