trader_apo
(PECL trader >= 0.2.0)
trader_apo — Absolute Price Oscillator
Описание
array trader_apo
( array
$real
[, integer $fastPeriod
[, integer $slowPeriod
[, integer $mAType
]]] )
Список параметров
-
real
-
Массив, содержащий реальные значения.
-
fastPeriod
-
Номер периода для быстрого скользящего среднего. Допустимы значения от 2 до 100000.
-
slowPeriod
-
Номер периода для медленного скользящего среднего. Допустимы значения от 2 до 100000.
-
mAType
-
Тип скользящей средней. Следует использовать серию констант TRADER_MA_TYPE_*.
Возвращаемые значения
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
/*
APO crossing above zero is "bullish", crossing below zero is "bearish".
Positive values are "upward movement", Negative values are "downward movement",
*/
$mATypes = array(TRADER_MA_TYPE_SMA, // Simple Moving Average
TRADER_MA_TYPE_EMA, // Exponential Moving Average
TRADER_MA_TYPE_WMA, // Weighted Moving Average
TRADER_MA_TYPE_DEMA, // Double Exponential Moving Average
TRADER_MA_TYPE_TEMA, // Triple Exponential Moving Average
TRADER_MA_TYPE_TRIMA,// Triangular Moving Average
TRADER_MA_TYPE_KAMA, // Kaufman's Adaptive Moving Average
TRADER_MA_TYPE_MAMA, // MESA Adaptive Moving Average
TRADER_MA_TYPE_T3); // T3 Moving Average
$fast_period = 12;
$slow_period = 30;
$closes = array(131.96, 137.09, 142.06, 143.16, 142.92, 139.07, 136.87, 132.03, 127.83, 127.14, 128.91, 130.89, 128.8, 128.98, 132.05, 130.92, 126.6, 131.01, 129.41, 132.69, 133.72, 134.87, 136.69, 131.97, 130.96, 131.88, 128.23, 126.655, 128.7, 127.81, 127.88, 121.78, 122.41, 123.24, 121.78, 124.38, 123.75, 122.25, 122.94, 123.08, 122.72, 119.05, 116.59, 116.03, 115.17, 113.85, 117.34, 118.64, 118.03, 119.39, 120.3, 119.26, 119.21, 119.49, 115.97, 116.32, 118.69, 119.03, 114.95, 110.44, 108.77, 108.86, 115.32, 111.2, 116.6, 115.05, 115.04, 115.75, 116.87, 117.51, 115.98, 119.02, 120.71, 121.19, 121.1, 124.4, 116.97, 114.97, 115.08, 113.16, 116.5, 113.02, 116.79, 115.81, 114.09, 114.96, 112.28, 108.22, 107.12, 111.81, 110.08, 106.84, 110.34, 112.13, 115.54, 115.355, 112, 113.49, 117.32, 112.82);
$Absolute_Price_Oscillators = array();
foreach($mATypes as $mA){
$key = 'sma';
if($mA == TRADER_MA_TYPE_EMA){$key = 'ema';}
elseif($mA == TRADER_MA_TYPE_WMA){$key = 'wma';}
elseif($mA == TRADER_MA_TYPE_DEMA){$key = 'dema';}
elseif($mA == TRADER_MA_TYPE_TEMA){$key = 'tema';}
elseif($mA == TRADER_MA_TYPE_TRIMA){$key = 'trima';}
elseif($mA == TRADER_MA_TYPE_KAMA){$key = 'kama';}
elseif($mA == TRADER_MA_TYPE_MAMA){$key = 'mama';}
elseif($mA == TRADER_MA_TYPE_T3){$key = 't3';}
$Absolute_Price_Oscillators[$key] = trader_apo ($closes, $fast_period, $slow_period, $mA);
}
var_dump($Absolute_Price_Oscillators['sma']);
/*
array(71) {
[29]=>
float(-1.264)
[30]=>
float(-1.255)
[31]=>
float(-1.654)
[32]=>
float(-1.942)
[33]=>
float(-2.247)
[34]=>
float(-2.785)
[35]=>
float(-2.927)
[36]=>
float(-3.091)
[37]=>
float(-3.567)
[38]=>
float(-3.845)
[39]=>
float(-4.008)
[40]=>
float(-4.3)
[41]=>
float(-4.635)
[42]=>
float(-5.169)
[43]=>
float(-5.217)
[44]=>
float(-5.257)
[45]=>
float(-5.471)
[46]=>
float(-5.532)
[47]=>
float(-5.598)
[48]=>
float(-5.695)
[49]=>
float(-5.49)
[50]=>
float(-5.263)
[51]=>
float(-5.061)
[52]=>
float(-4.771)
[53]=>
float(-4.318)
[54]=>
float(-3.87)
[55]=>
float(-3.327)
[56]=>
float(-2.716)
[57]=>
float(-2.03)
[58]=>
float(-1.771)
[59]=>
float(-1.875)
[60]=>
float(-2.01)
[61]=>
float(-2.457)
[62]=>
float(-2.636)
[63]=>
float(-2.906)
[64]=>
float(-2.951)
[65]=>
float(-3.01)
[66]=>
float(-2.797)
[67]=>
float(-2.628)
[68]=>
float(-2.577)
[69]=>
float(-2.518)
[70]=>
float(-2.208)
[71]=>
float(-1.492)
[72]=>
float(-0.634)
[73]=>
float(0.222)
[74]=>
float(0.506)
[75]=>
float(1.254)
[76]=>
float(1.297)
[77]=>
float(1.413)
[78]=>
float(1.515)
[79]=>
float(1.506)
[80]=>
float(1.602)
[81]=>
float(1.436)
[82]=>
float(1.584)
[83]=>
float(1.439)
[84]=>
float(0.95)
[85]=>
float(0.477)
[86]=>
float(-0.045)
[87]=>
float(-1.033)
[88]=>
float(-1.593)
[89]=>
float(-1.902)
[90]=>
float(-2.362)
[91]=>
float(-2.821)
[92]=>
float(-3.169)
[93]=>
float(-3.274)
[94]=>
float(-3.343)
[95]=>
float(-3.391)
[96]=>
float(-3.464)
[97]=>
float(-3.511)
[98]=>
float(-3.106)
[99]=>
float(-2.566)
}
*/