@@ -43,14 +43,14 @@ public static function acos(array $real): array
43
43
*/
44
44
public static function chaikinAccumulationDistributionLine (array $ high , array $ low , array $ close , array $ volume ): array
45
45
{
46
- $ count = self ::verifyArrayCounts ([$ high , $ low , $ close , $ volume ]);
47
- $ result = new \SplFixedArray ($ count + 1 );
46
+ $ count = self ::verifyArrayCounts ([$ high , $ low , $ close , $ volume ]);
47
+ $ result = new \SplFixedArray ($ count + 1 );
48
48
$ moneyFlowVolume = 0.0 ;
49
49
for ($ i = 0 ; $ i <= $ count ; $ i ++) {
50
50
$ denominator = $ high [$ i ] - $ low [$ i ];
51
51
if ($ denominator > 0 ) {
52
52
$ moneyFlowMultiplier = (($ close [$ i ] - $ low [$ i ]) - ($ high [$ i ] - $ close [$ i ])) / $ denominator ;
53
- $ moneyFlowVolume += ($ moneyFlowMultiplier * $ volume [$ i ]);
53
+ $ moneyFlowVolume += ($ moneyFlowMultiplier * $ volume [$ i ]);
54
54
}
55
55
$ result [$ i ] = $ moneyFlowVolume ;
56
56
}
@@ -101,19 +101,19 @@ public static function add(array $real0, array $real1): array
101
101
*/
102
102
public static function chaikinOscillator (array $ high , array $ low , array $ close , array $ volume , int $ fastPeriod = 3 , int $ slowPeriod = 10 ): array
103
103
{
104
- $ count = self ::verifyArrayCounts ([$ high , $ low , $ close , $ volume ]);
105
- $ fastK = 2 / ($ fastPeriod + 1 );
106
- $ slowK = 2 / ($ slowPeriod + 1 );
104
+ $ count = self ::verifyArrayCounts ([$ high , $ low , $ close , $ volume ]);
105
+ $ fastK = 2 / ($ fastPeriod + 1 );
106
+ $ slowK = 2 / ($ slowPeriod + 1 );
107
107
$ oneMinusFastK = 1 - $ fastK ;
108
108
$ oneMinusSlowK = 1 - $ slowK ;
109
109
110
- $ ad = self ::ad ($ high , $ low , $ close , $ volume );
110
+ $ ad = self ::ad ($ high , $ low , $ close , $ volume );
111
111
$ fastEma = $ slowEma = $ ad [0 ];
112
- $ output = [];
112
+ $ output = [];
113
113
114
114
for ($ i = 1 ; $ i <= $ count ; $ i ++) {
115
- $ fastEma = ($ fastK * $ ad [$ i ]) + ($ oneMinusFastK * $ fastEma );
116
- $ slowEma = ($ slowK * $ ad [$ i ]) + ($ oneMinusSlowK * $ slowEma );
115
+ $ fastEma = ($ fastK * $ ad [$ i ]) + ($ oneMinusFastK * $ fastEma );
116
+ $ slowEma = ($ slowK * $ ad [$ i ]) + ($ oneMinusSlowK * $ slowEma );
117
117
$ output [$ i ] = $ fastEma - $ slowEma ;
118
118
}
119
119
@@ -149,10 +149,10 @@ public static function adosc(array $high, array $low, array $close, array $volum
149
149
*/
150
150
public static function averageDirectionalMovementIndex (array $ high , array $ low , array $ close , int $ timePeriod = 14 ): array
151
151
{
152
- $ count = self ::verifyArrayCounts ([$ high , $ low , $ close ]);
153
- $ plus = self ::plusDI ($ high , $ low , $ close , $ timePeriod );
154
- $ minus = self ::minusDI ($ high , $ low , $ close , $ timePeriod );
155
- $ sum = self ::add ($ plus , $ minus );
152
+ $ count = self ::verifyArrayCounts ([$ high , $ low , $ close ]);
153
+ $ plus = self ::plusDI ($ high , $ low , $ close , $ timePeriod );
154
+ $ minus = self ::minusDI ($ high , $ low , $ close , $ timePeriod );
155
+ $ sum = self ::add ($ plus , $ minus );
156
156
$ result = new \SplFixedArray ($ count + 1 );
157
157
for ($ i = 0 ; $ i <= $ count ; $ i ++) {
158
158
$ result [$ i ] = $ sum [$ i ] > 0 ? 100 * abs ($ plus [$ i ] - $ minus [$ i ]) / $ sum [$ i ] : 0 ;
@@ -216,12 +216,12 @@ public static function slowstochrsi(
216
216
int $ slowD_Period = 3 ,
217
217
int $ slowD_MAType = MovingAverageType::SMA
218
218
): array {
219
- $ real = \array_values ($ real );
219
+ $ real = \array_values ($ real );
220
220
$ endIdx = count ($ real ) - 1 ;
221
- $ rsi = [];
221
+ $ rsi = [];
222
222
self ::checkForError (self ::getMomentumIndicators ()::rsi (0 , $ endIdx , $ real , $ rsi_period , self ::$ outBegIdx , self ::$ outNBElement , $ rsi ));
223
- $ rsi = array_values ($ rsi );
224
- $ endIdx = self ::verifyArrayCounts ([&$ rsi ]);
223
+ $ rsi = array_values ($ rsi );
224
+ $ endIdx = self ::verifyArrayCounts ([&$ rsi ]);
225
225
$ outSlowK = [];
226
226
$ outSlowD = [];
227
227
self ::checkForError (
0 commit comments