Completed
Push — master ( 89efb3...3f845f )
by Evgenii
03:40
created

CallsFunctions::stoch()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 21
nc 1
nop 8
dl 0
loc 25
ccs 0
cts 12
cp 0
crap 2
rs 8.8571
c 0
b 0
f 0

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
namespace Laratrade\Trader\Contracts;
4
5
/**
6
 * Trait MagicCalls
7
 * @package Laratrade\Trader\Contracts
8
 *
9
 * phpcs:disable Generic.Files.LineLength
10
 * phpcs:disable PSR1.Methods.CamelCapsMethodName
11
 */
12
trait CallsFunctions
13
{
14
    /**
15
     * Vector Trigonometric ACos.
16
     *
17
     * Calculates the arc cosine for each value in real and returns the resulting array.
18
     *
19
     * @param array $real Array of real values.
20
     *
21
     * @return array Returns an array with calculated data.
22
     */
23 2
    public function acos(array $real): array
24
    {
25 2
        $result = trader_acos($real);
26
27 2
        $this->handleErrors();
28
29 2
        return $result;
30
    }
31
32
    /**
33
     * Chaikin A/D Line.
34
     *
35
     * @param array $high   High price, array of real values.
36
     * @param array $low    Low price, array of real values.
37
     * @param array $close  Closing price, array of real values.
38
     * @param array $volume Volume traded, array of real values.
39
     *
40
     * @return array Returns an array with calculated data.
41
     */
42 2
    public function ad(array $high, array $low, array $close, array $volume): array
43
    {
44 2
        $result = trader_ad($high, $low, $close, $volume);
45
46 2
        $this->handleErrors();
47
48 2
        return $result;
49
    }
50
51
    /**
52
     * Vector Arithmetic Add.
53
     *
54
     * Calculates the vector addition of real0 to real1 and returns the resulting vector.
55
     *
56
     * @param array $real0 Array of real values.
57
     * @param array $real1 Array of real values.
58
     *
59
     * @return array Returns an array with calculated data.
60
     */
61 2
    public function add(array $real0, array $real1): array
62
    {
63 2
        $result = trader_add($real0, $real1);
64
65 2
        $this->handleErrors();
66
67 2
        return $result;
68
    }
69
70
    /**
71
     * Chaikin A/D Oscillator.
72
     *
73
     * @param array $high       High price, array of real values.
74
     * @param array $low        Low price, array of real values.
75
     * @param array $close      Closing price, array of real values.
76
     * @param array $volume     Volume traded, array of real values.
77
     * @param int   $fastPeriod Number of period for the fast MA. Valid range from 2 to 100000.
78
     * @param int   $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000.
79
     *
80
     * @return array Returns an array with calculated data.
81
     */
82
    public function adosc(
83
        array $high,
84
        array $low,
85
        array $close,
86
        array $volume,
87
        int $fastPeriod = 3,
88
        int $slowPeriod = 10
89
    ): array {
90
        $result = trader_adosc($high, $low, $close, $volume, $fastPeriod, $slowPeriod);
91
92
        $this->handleErrors();
93
94
        return $result;
95
    }
96
97
    /**
98
     * Average Directional Movement Index.
99
     *
100
     * @param array $high       High price, array of real values.
101
     * @param array $low        Low price, array of real values.
102
     * @param array $close      Closing price, array of real values.
103
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
104
     *
105
     * @return array Returns an array with calculated data.
106
     */
107
    public function adx(array $high, array $low, array $close, int $timePeriod = 14): array
108
    {
109
        $result = trader_adx($high, $low, $close, $timePeriod);
110
111
        $this->handleErrors();
112
113
        return $result;
114
    }
115
116
    /**
117
     * Average Directional Movement Index Rating.
118
     *
119
     * @param array $high       High price, array of real values.
120
     * @param array $low        Low price, array of real values.
121
     * @param array $close      Closing price, array of real values.
122
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
123
     *
124
     * @return array Returns an array with calculated data.
125
     */
126
    public function adxr(array $high, array $low, array $close, int $timePeriod = 14): array
127
    {
128
        $result = trader_adxr($high, $low, $close, $timePeriod);
129
130
        $this->handleErrors();
131
132
        return $result;
133
    }
134
135
    /**
136
     * Absolute Price Oscillator.
137
     *
138
     * @param array $real       Array of real values.
139
     * @param int   $fastPeriod Number of period for the fast MA. Valid range from 2 to 100000.
140
     * @param int   $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000.
141
     * @param int   $mAType     Type of Moving Average. MA_TYPE_* series of constants should be used.
142
     *
143
     * @return array Returns an array with calculated data.
144
     */
145
    public function apo(array $real, int $fastPeriod = 12, int $slowPeriod = 26, int $mAType = 0): array
146
    {
147
        $result = trader_adxr($real, $fastPeriod, $slowPeriod, $mAType);
148
149
        $this->handleErrors();
150
151
        return $result;
152
    }
153
154
    /**
155
     * Aroon.
156
     *
157
     * @param array $high       High price, array of real values.
158
     * @param array $low        Low price, array of real values.
159
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
160
     *
161
     * @return array Returns an array with calculated data.
162
     */
163
    public function aroon(array $high, array $low, int $timePeriod = 14): array
164
    {
165
        $result = trader_aroon($high, $low, $timePeriod);
166
167
        $this->handleErrors();
168
169
        return $result;
170
    }
171
172
    /**
173
     * Aroon Oscillator.
174
     *
175
     * @param array $high       High price, array of real values.
176
     * @param array $low        Low price, array of real values.
177
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
178
     *
179
     * @return array Returns an array with calculated data.
180
     */
181
    public function aroonosc(array $high, array $low, int $timePeriod = 14): array
182
    {
183
        $result = trader_aroonosc($high, $low, $timePeriod);
184
185
        $this->handleErrors();
186
187
        return $result;
188
    }
189
190
    /**
191
     * Vector Trigonometric ASin.
192
     *
193
     * @param array $real Array of real values.
194
     *
195
     * @return array Returns an array with calculated data.
196
     */
197
    public function asin(array $real): array
198
    {
199
        $result = trader_asin($real);
200
201
        $this->handleErrors();
202
203
        return $result;
204
    }
205
206
    /**
207
     * Vector Trigonometric ATan.
208
     *
209
     * @param array $real Array of real values.
210
     *
211
     * @return array Returns an array with calculated data.
212
     */
213
    public function atan(array $real): array
214
    {
215
        $result = trader_atan($real);
216
217
        $this->handleErrors();
218
219
        return $result;
220
    }
221
222
    /**
223
     * Average True Range.
224
     *
225
     * @param array $high       High price, array of real values.
226
     * @param array $low        Low price, array of real values.
227
     * @param array $close      Closing price, array of real values.
228
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
229
     *
230
     * @return array Returns an array with calculated data.
231
     */
232
    public function atr(array $high, array $low, array $close, int $timePeriod = 14): array
233
    {
234
        $result = trader_atr($high, $low, $close, $timePeriod);
235
236
        $this->handleErrors();
237
238
        return $result;
239
    }
240
241
    /**
242
     * Average Price.
243
     *
244
     * @param array $open  Opening price, array of real values.
245
     * @param array $high  High price, array of real values.
246
     * @param array $low   Low price, array of real values.
247
     * @param array $close Closing price, array of real values.
248
     *
249
     * @return array Returns an array with calculated data.
250
     */
251
    public function avgprice(array $open, array $high, array $low, array $close): array
252
    {
253
        $result = trader_avgprice($open, $high, $low, $close);
254
255
        $this->handleErrors();
256
257
        return $result;
258
    }
259
260
    /**
261
     * Bollinger Bands.
262
     *
263
     * @param array $real       Array of real values.
264
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
265
     * @param float $nbDevUp    Deviation multiplier for upper band. Valid range from REAL_MIN to REAL_MAX.
266
     * @param float $nbDevDn    Deviation multiplier for lower band. Valid range from REAL_MIN to REAL_MAX.
267
     * @param int   $mAType     Type of Moving Average. MA_TYPE_* series of constants should be used.
268
     *
269
     * @return array Returns an array with calculated data.
270
     */
271
    public function bbands(
272
        array $real,
273
        int $timePeriod = 5,
274
        float $nbDevUp = 2.0,
275
        float $nbDevDn = 2.0,
276
        int $mAType = 0
277
    ): array {
278
        $result = trader_bbands($real, $timePeriod, $nbDevUp, $nbDevDn, $mAType);
279
280
        $this->handleErrors();
281
282
        return $result;
283
    }
284
285
    /**
286
     * Beta.
287
     *
288
     * @param array $real0      Array of real values.
289
     * @param array $real1      Array of real values.
290
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
291
     *
292
     * @return array Returns an array with calculated data.
293
     */
294
    public function beta(array $real0, array $real1, int $timePeriod = 5): array
295
    {
296
        $result = trader_beta($real0, $real1, $timePeriod);
297
298
        $this->handleErrors();
299
300
        return $result;
301
    }
302
303
    /**
304
     * Balance Of Power.
305
     *
306
     * @param array $open  Opening price, array of real values.
307
     * @param array $high  High price, array of real values.
308
     * @param array $low   Low price, array of real values.
309
     * @param array $close Closing price, array of real values.
310
     *
311
     * @return array Returns an array with calculated data.
312
     */
313
    public function bop(array $open, array $high, array $low, array $close): array
314
    {
315
        $result = trader_bop($open, $high, $low, $close);
316
317
        $this->handleErrors();
318
319
        return $result;
320
    }
321
322
    /**
323
     * Commodity Channel Index.
324
     *
325
     * @param array $high       High price, array of real values.
326
     * @param array $low        Low price, array of real values.
327
     * @param array $close      Closing price, array of real values.
328
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
329
     *
330
     * @return array Returns an array with calculated data.
331
     */
332
    public function cci(array $high, array $low, array $close, int $timePeriod = null): array
333
    {
334
        $result = trader_cci($high, $low, $close, $timePeriod);
335
336
        $this->handleErrors();
337
338
        return $result;
339
    }
340
341
    /**
342
     * Two Crows.
343
     *
344
     * @param array $open  Opening price, array of real values.
345
     * @param array $high  High price, array of real values.
346
     * @param array $low   Low price, array of real values.
347
     * @param array $close Closing price, array of real values.
348
     *
349
     * @return array Returns an array with calculated data.
350
     */
351
    public function cdl2crows(array $open, array $high, array $low, array $close): array
352
    {
353
        $result = trader_cci($open, $high, $low, $close);
354
355
        $this->handleErrors();
356
357
        return $result;
358
    }
359
360
    /**
361
     * Three Black Crows.
362
     *
363
     * @param array $open  Opening price, array of real values.
364
     * @param array $high  High price, array of real values.
365
     * @param array $low   Low price, array of real values.
366
     * @param array $close Closing price, array of real values.
367
     *
368
     * @return array Returns an array with calculated data.
369
     */
370
    public function cdl3blackcrows(array $open, array $high, array $low, array $close): array
371
    {
372
        $result = trader_cdl3blackcrows($open, $high, $low, $close);
373
374
        $this->handleErrors();
375
376
        return $result;
377
    }
378
379
    /**
380
     * Three Inside Up/Down.
381
     *
382
     * @param array $open  Opening price, array of real values.
383
     * @param array $high  High price, array of real values.
384
     * @param array $low   Low price, array of real values.
385
     * @param array $close Closing price, array of real values.
386
     *
387
     * @return array Returns an array with calculated data.
388
     */
389
    public function cdl3inside(array $open, array $high, array $low, array $close): array
390
    {
391
        $result = trader_cdl3inside($open, $high, $low, $close);
392
393
        $this->handleErrors();
394
395
        return $result;
396
    }
397
398
    /**
399
     * Three-Line Strike
400
     *
401
     * @param array $open  Opening price, array of real values.
402
     * @param array $high  High price, array of real values.
403
     * @param array $low   Low price, array of real values.
404
     * @param array $close Closing price, array of real values.
405
     *
406
     * @return array Returns an array with calculated data.
407
     */
408
    public function cdl3linestrike(array $open, array $high, array $low, array $close): array
409
    {
410
        $result = trader_cdl3linestrike($open, $high, $low, $close);
411
412
        $this->handleErrors();
413
414
        return $result;
415
    }
416
417
    /**
418
     * Three Outside Up/Down.
419
     *
420
     * @param array $open  Opening price, array of real values.
421
     * @param array $high  High price, array of real values.
422
     * @param array $low   Low price, array of real values.
423
     * @param array $close Closing price, array of real values.
424
     *
425
     * @return array Returns an array with calculated data.
426
     */
427
    public function cdl3outside(array $open, array $high, array $low, array $close): array
428
    {
429
        $result = trader_cdl3outside($open, $high, $low, $close);
430
431
        $this->handleErrors();
432
433
        return $result;
434
    }
435
436
    /**
437
     * Three Stars In The South.
438
     *
439
     * @param array $open  Opening price, array of real values.
440
     * @param array $high  High price, array of real values.
441
     * @param array $low   Low price, array of real values.
442
     * @param array $close Closing price, array of real values.
443
     *
444
     * @return array Returns an array with calculated data.
445
     */
446
    public function cdl3starsinsouth(array $open, array $high, array $low, array $close): array
447
    {
448
        $result = trader_cdl3starsinsouth($open, $high, $low, $close);
449
450
        $this->handleErrors();
451
452
        return $result;
453
    }
454
455
    /**
456
     * Three Advancing White Soldiers.
457
     *
458
     * @param array $open  Opening price, array of real values.
459
     * @param array $high  High price, array of real values.
460
     * @param array $low   Low price, array of real values.
461
     * @param array $close Closing price, array of real values.
462
     *
463
     * @return array Returns an array with calculated data.
464
     */
465
    public function cdl3whitesoldiers(array $open, array $high, array $low, array $close): array
466
    {
467
        $result = trader_cdl3whitesoldiers($open, $high, $low, $close);
468
469
        $this->handleErrors();
470
471
        return $result;
472
    }
473
474
    /**
475
     * Abandoned Baby.
476
     *
477
     * @param array $open        Opening price, array of real values.
478
     * @param array $high        High price, array of real values.
479
     * @param array $low         Low price, array of real values.
480
     * @param array $close       Closing price, array of real values.
481
     * @param float $penetration Percentage of penetration of a candle within another candle.
482
     *
483
     * @return array Returns an array with calculated data.
484
     */
485
    public function cdlabandonedbaby(
486
        array $open,
487
        array $high,
488
        array $low,
489
        array $close,
490
        float $penetration = 0.3
491
    ): array {
492
        $result = trader_cdlabandonedbaby($open, $high, $low, $close, $penetration);
493
494
        $this->handleErrors();
495
496
        return $result;
497
    }
498
499
    /**
500
     * Advance Block.
501
     *
502
     * @param array $open  Opening price, array of real values.
503
     * @param array $high  High price, array of real values.
504
     * @param array $low   Low price, array of real values.
505
     * @param array $close Closing price, array of real values.
506
     *
507
     * @return array Returns an array with calculated data.
508
     */
509
    public function cdladvanceblock(array $open, array $high, array $low, array $close): array
510
    {
511
        $result = trader_cdladvanceblock($open, $high, $low, $close);
512
513
        $this->handleErrors();
514
515
        return $result;
516
    }
517
518
    /**
519
     * Belt-hold.
520
     *
521
     * @param array $open  Opening price, array of real values.
522
     * @param array $high  High price, array of real values.
523
     * @param array $low   Low price, array of real values.
524
     * @param array $close Closing price, array of real values.
525
     *
526
     * @return array Returns an array with calculated data.
527
     */
528
    public function cdlbelthold(array $open, array $high, array $low, array $close): array
529
    {
530
        $result = trader_cdlbelthold($open, $high, $low, $close);
531
532
        $this->handleErrors();
533
534
        return $result;
535
    }
536
537
    /**
538
     * Breakaway.
539
     *
540
     * @param array $open  Opening price, array of real values.
541
     * @param array $high  High price, array of real values.
542
     * @param array $low   Low price, array of real values.
543
     * @param array $close Closing price, array of real values.
544
     *
545
     * @return array Returns an array with calculated data.
546
     */
547
    public function cdlbreakaway(array $open, array $high, array $low, array $close): array
548
    {
549
        $result = trader_cdlbreakaway($open, $high, $low, $close);
550
551
        $this->handleErrors();
552
553
        return $result;
554
    }
555
556
    /**
557
     * Closing Marubozu.
558
     *
559
     * @param array $open  Opening price, array of real values.
560
     * @param array $high  High price, array of real values.
561
     * @param array $low   Low price, array of real values.
562
     * @param array $close Closing price, array of real values.
563
     *
564
     * @return array Returns an array with calculated data.
565
     */
566
    public function cdlclosingmarubozu(array $open, array $high, array $low, array $close): array
567
    {
568
        $result = trader_cdlclosingmarubozu($open, $high, $low, $close);
569
570
        $this->handleErrors();
571
572
        return $result;
573
    }
574
575
    /**
576
     * Concealing Baby Swallow.
577
     *
578
     * @param array $open  Opening price, array of real values.
579
     * @param array $high  High price, array of real values.
580
     * @param array $low   Low price, array of real values.
581
     * @param array $close Closing price, array of real values.
582
     *
583
     * @return array Returns an array with calculated data.
584
     */
585
    public function cdlconcealbabyswall(array $open, array $high, array $low, array $close): array
586
    {
587
        $result = trader_cdlconcealbabyswall($open, $high, $low, $close);
588
589
        $this->handleErrors();
590
591
        return $result;
592
    }
593
594
    /**
595
     * Counterattack.
596
     *
597
     * @param array $open  Opening price, array of real values.
598
     * @param array $high  High price, array of real values.
599
     * @param array $low   Low price, array of real values.
600
     * @param array $close Closing price, array of real values.
601
     *
602
     * @return array Returns an array with calculated data.
603
     */
604
    public function cdlcounterattack(array $open, array $high, array $low, array $close): array
605
    {
606
        $result = trader_cdlcounterattack($open, $high, $low, $close);
607
608
        $this->handleErrors();
609
610
        return $result;
611
    }
612
613
    /**
614
     * Dark Cloud Cover.
615
     *
616
     * @param array $open        Opening price, array of real values.
617
     * @param array $high        High price, array of real values.
618
     * @param array $low         Low price, array of real values.
619
     * @param array $close       Closing price, array of real values.
620
     * @param float $penetration Percentage of penetration of a candle within another candle.
621
     *
622
     * @return array Returns an array with calculated data.
623
     */
624
    public function cdldarkcloudcover(
625
        array $open,
626
        array $high,
627
        array $low,
628
        array $close,
629
        float $penetration = 0.5
630
    ): array {
631
        $result = trader_cdldarkcloudcover($open, $high, $low, $close, $penetration);
632
633
        $this->handleErrors();
634
635
        return $result;
636
    }
637
638
    /**
639
     * Doji.
640
     *
641
     * @param array $open  Opening price, array of real values.
642
     * @param array $high  High price, array of real values.
643
     * @param array $low   Low price, array of real values.
644
     * @param array $close Closing price, array of real values.
645
     *
646
     * @return array Returns an array with calculated data.
647
     */
648
    public function cdldoji(array $open, array $high, array $low, array $close): array
649
    {
650
        $result = trader_cdldoji($open, $high, $low, $close);
651
652
        $this->handleErrors();
653
654
        return $result;
655
    }
656
657
    /**
658
     * Doji Star.
659
     *
660
     * @param array $open  Opening price, array of real values.
661
     * @param array $high  High price, array of real values.
662
     * @param array $low   Low price, array of real values.
663
     * @param array $close Closing price, array of real values.
664
     *
665
     * @return array Returns an array with calculated data.
666
     */
667
    public function cdldojistar(array $open, array $high, array $low, array $close): array
668
    {
669
        $result = trader_cdldojistar($open, $high, $low, $close);
670
671
        $this->handleErrors();
672
673
        return $result;
674
    }
675
676
    /**
677
     * Dragonfly Doji.
678
     *
679
     * @param array $open  Opening price, array of real values.
680
     * @param array $high  High price, array of real values.
681
     * @param array $low   Low price, array of real values.
682
     * @param array $close Closing price, array of real values.
683
     *
684
     * @return array Returns an array with calculated data.
685
     */
686
    public function cdldragonflydoji(array $open, array $high, array $low, array $close): array
687
    {
688
        $result = trader_cdldragonflydoji($open, $high, $low, $close);
689
690
        $this->handleErrors();
691
692
        return $result;
693
    }
694
695
    /**
696
     * Engulfing Pattern.
697
     *
698
     * @param array $open  Opening price, array of real values.
699
     * @param array $high  High price, array of real values.
700
     * @param array $low   Low price, array of real values.
701
     * @param array $close Closing price, array of real values.
702
     *
703
     * @return array Returns an array with calculated data.
704
     */
705
    public function cdlengulfing(array $open, array $high, array $low, array $close): array
706
    {
707
        $result = trader_cdlengulfing($open, $high, $low, $close);
708
709
        $this->handleErrors();
710
711
        return $result;
712
    }
713
714
    /**
715
     * Evening Doji Star.
716
     *
717
     * @param array $open        Opening price, array of real values.
718
     * @param array $high        High price, array of real values.
719
     * @param array $low         Low price, array of real values.
720
     * @param array $close       Closing price, array of real values.
721
     * @param float $penetration Percentage of penetration of a candle within another candle.
722
     *
723
     * @return array Returns an array with calculated data.
724
     */
725
    public function cdleveningdojistar(
726
        array $open,
727
        array $high,
728
        array $low,
729
        array $close,
730
        float $penetration = 0.3
731
    ): array {
732
        $result = trader_cdleveningdojistar($open, $high, $low, $close, $penetration);
733
734
        $this->handleErrors();
735
736
        return $result;
737
    }
738
739
    /**
740
     * Evening Star.
741
     *
742
     * @param array $open        Opening price, array of real values.
743
     * @param array $high        High price, array of real values.
744
     * @param array $low         Low price, array of real values.
745
     * @param array $close       Closing price, array of real values.
746
     * @param float $penetration [OPTIONAL] [DEFAULT 0.3] Percentage of penetration of a candle within another candle.
747
     *
748
     * @return array Returns an array with calculated data.
749
     */
750
    public function cdleveningstar(
751
        array $open,
752
        array $high,
753
        array $low,
754
        array $close,
755
        float $penetration = 0.3
756
    ): array {
757
        $result = trader_cdleveningstar($open, $high, $low, $close, $penetration);
758
759
        $this->handleErrors();
760
761
        return $result;
762
    }
763
764
    /**
765
     * Up/Down-gap side-by-side white lines.
766
     *
767
     * @param array $open  Opening price, array of real values.
768
     * @param array $high  High price, array of real values.
769
     * @param array $low   Low price, array of real values.
770
     * @param array $close Closing price, array of real values.
771
     *
772
     * @return array Returns an array with calculated data.
773
     */
774
    public function cdlgapsidesidewhite(array $open, array $high, array $low, array $close): array
775
    {
776
        $result = trader_cdlgapsidesidewhite($open, $high, $low, $close);
777
778
        $this->handleErrors();
779
780
        return $result;
781
    }
782
783
    /**
784
     * Gravestone Doji.
785
     *
786
     * @param array $open  Opening price, array of real values.
787
     * @param array $high  High price, array of real values.
788
     * @param array $low   Low price, array of real values.
789
     * @param array $close Closing price, array of real values.
790
     *
791
     * @return array Returns an array with calculated data.
792
     */
793
    public function cdlgravestonedoji(array $open, array $high, array $low, array $close): array
794
    {
795
        $result = trader_cdlgravestonedoji($open, $high, $low, $close);
796
797
        $this->handleErrors();
798
799
        return $result;
800
    }
801
802
    /**
803
     * Hammer.
804
     *
805
     * @param array $open  Opening price, array of real values.
806
     * @param array $high  High price, array of real values.
807
     * @param array $low   Low price, array of real values.
808
     * @param array $close Closing price, array of real values.
809
     *
810
     * @return array Returns an array with calculated data.
811
     */
812
    public function cdlhammer(array $open, array $high, array $low, array $close): array
813
    {
814
        $result = trader_cdlhammer($open, $high, $low, $close);
815
816
        $this->handleErrors();
817
818
        return $result;
819
    }
820
821
    /**
822
     * Hanging Man.
823
     *
824
     * @param array $open  Opening price, array of real values.
825
     * @param array $high  High price, array of real values.
826
     * @param array $low   Low price, array of real values.
827
     * @param array $close Closing price, array of real values.
828
     *
829
     * @return array Returns an array with calculated data.
830
     */
831
    public function cdlhangingman(array $open, array $high, array $low, array $close): array
832
    {
833
        $result = trader_cdlhangingman($open, $high, $low, $close);
834
835
        $this->handleErrors();
836
837
        return $result;
838
    }
839
840
    /**
841
     * Harami Pattern.
842
     *
843
     * @param array $open  Opening price, array of real values.
844
     * @param array $high  High price, array of real values.
845
     * @param array $low   Low price, array of real values.
846
     * @param array $close Closing price, array of real values.
847
     *
848
     * @return array Returns an array with calculated data.
849
     */
850
    public function cdlharami(array $open, array $high, array $low, array $close): array
851
    {
852
        $result = trader_cdlharami($open, $high, $low, $close);
853
854
        $this->handleErrors();
855
856
        return $result;
857
    }
858
859
    /**
860
     * Harami Cross Pattern.
861
     *
862
     * @param array $open  Opening price, array of real values.
863
     * @param array $high  High price, array of real values.
864
     * @param array $low   Low price, array of real values.
865
     * @param array $close Closing price, array of real values.
866
     *
867
     * @return array Returns an array with calculated data.
868
     */
869
    public function cdlharamicross(array $open, array $high, array $low, array $close): array
870
    {
871
        $result = trader_cdlharamicross($open, $high, $low, $close);
872
873
        $this->handleErrors();
874
875
        return $result;
876
    }
877
878
    /**
879
     * High-Wave Candle.
880
     *
881
     * @param array $open  Opening price, array of real values.
882
     * @param array $high  High price, array of real values.
883
     * @param array $low   Low price, array of real values.
884
     * @param array $close Closing price, array of real values.
885
     *
886
     * @return array Returns an array with calculated data.
887
     */
888
    public function cdlhighwave(array $open, array $high, array $low, array $close): array
889
    {
890
        $result = trader_cdlhighwave($open, $high, $low, $close);
891
892
        $this->handleErrors();
893
894
        return $result;
895
    }
896
897
    /**
898
     * Hikkake Pattern.
899
     *
900
     * @param array $open  Opening price, array of real values.
901
     * @param array $high  High price, array of real values.
902
     * @param array $low   Low price, array of real values.
903
     * @param array $close Closing price, array of real values.
904
     *
905
     * @return array Returns an array with calculated data.
906
     */
907
    public function cdlhikkake(array $open, array $high, array $low, array $close): array
908
    {
909
        $result = trader_cdlhikkake($open, $high, $low, $close);
910
911
        $this->handleErrors();
912
913
        return $result;
914
    }
915
916
    /**
917
     * Modified Hikkake Pattern.
918
     *
919
     * @param array $open  Opening price, array of real values.
920
     * @param array $high  High price, array of real values.
921
     * @param array $low   Low price, array of real values.
922
     * @param array $close Closing price, array of real values.
923
     *
924
     * @return array Returns an array with calculated data.
925
     */
926
    public function cdlhikkakemod(array $open, array $high, array $low, array $close): array
927
    {
928
        $result = trader_cdlhikkakemod($open, $high, $low, $close);
929
930
        $this->handleErrors();
931
932
        return $result;
933
    }
934
935
    /**
936
     * Homing Pigeon.
937
     *
938
     * @param array $open  Opening price, array of real values.
939
     * @param array $high  High price, array of real values.
940
     * @param array $low   Low price, array of real values.
941
     * @param array $close Closing price, array of real values.
942
     *
943
     * @return array Returns an array with calculated data.
944
     */
945
    public function cdlhomingpigeon(array $open, array $high, array $low, array $close): array
946
    {
947
        $result = trader_cdlhomingpigeon($open, $high, $low, $close);
948
949
        $this->handleErrors();
950
951
        return $result;
952
    }
953
954
    /**
955
     * Identical Three Crows.
956
     *
957
     * @param array $open  Opening price, array of real values.
958
     * @param array $high  High price, array of real values.
959
     * @param array $low   Low price, array of real values.
960
     * @param array $close Closing price, array of real values.
961
     *
962
     * @return array Returns an array with calculated data.
963
     */
964
    public function cdlidentical3crows(array $open, array $high, array $low, array $close): array
965
    {
966
        $result = trader_cdlidentical3crows($open, $high, $low, $close);
967
968
        $this->handleErrors();
969
970
        return $result;
971
    }
972
973
    /**
974
     * In-Neck Pattern.
975
     *
976
     * @param array $open  Opening price, array of real values.
977
     * @param array $high  High price, array of real values.
978
     * @param array $low   Low price, array of real values.
979
     * @param array $close Closing price, array of real values.
980
     *
981
     * @return array Returns an array with calculated data.
982
     */
983
    public function cdlinneck(array $open, array $high, array $low, array $close): array
984
    {
985
        $result = trader_cdlinneck($open, $high, $low, $close);
986
987
        $this->handleErrors();
988
989
        return $result;
990
    }
991
992
    /**
993
     * Inverted Hammer.
994
     *
995
     * @param array $open  Opening price, array of real values.
996
     * @param array $high  High price, array of real values.
997
     * @param array $low   Low price, array of real values.
998
     * @param array $close Closing price, array of real values.
999
     *
1000
     * @return array Returns an array with calculated data.
1001
     */
1002
    public function cdlinvertedhammer(array $open, array $high, array $low, array $close): array
1003
    {
1004
        $result = trader_cdlinvertedhammer($open, $high, $low, $close);
1005
1006
        $this->handleErrors();
1007
1008
        return $result;
1009
    }
1010
1011
    /**
1012
     * Kicking.
1013
     *
1014
     * @param array $open  Opening price, array of real values.
1015
     * @param array $high  High price, array of real values.
1016
     * @param array $low   Low price, array of real values.
1017
     * @param array $close Closing price, array of real values.
1018
     *
1019
     * @return array Returns an array with calculated data.
1020
     */
1021
    public function cdlkicking(array $open, array $high, array $low, array $close): array
1022
    {
1023
        $result = trader_cdlkicking($open, $high, $low, $close);
1024
1025
        $this->handleErrors();
1026
1027
        return $result;
1028
    }
1029
1030
    /**
1031
     * Kicking - bull/bear determined by the longer marubozu.
1032
     *
1033
     * @param array $open  Opening price, array of real values.
1034
     * @param array $high  High price, array of real values.
1035
     * @param array $low   Low price, array of real values.
1036
     * @param array $close Closing price, array of real values.
1037
     *
1038
     * @return array Returns an array with calculated data.
1039
     */
1040
    public function cdlkickingbylength(array $open, array $high, array $low, array $close): array
1041
    {
1042
        $result = trader_cdlkickingbylength($open, $high, $low, $close);
1043
1044
        $this->handleErrors();
1045
1046
        return $result;
1047
    }
1048
1049
    /**
1050
     * Ladder Bottom.
1051
     *
1052
     * @param array $open  Opening price, array of real values.
1053
     * @param array $high  High price, array of real values.
1054
     * @param array $low   Low price, array of real values.
1055
     * @param array $close Closing price, array of real values.
1056
     *
1057
     * @return array Returns an array with calculated data.
1058
     */
1059
    public function cdlladderbottom(array $open, array $high, array $low, array $close): array
1060
    {
1061
        $result = trader_cdlladderbottom($open, $high, $low, $close);
1062
1063
        $this->handleErrors();
1064
1065
        return $result;
1066
    }
1067
1068
    /**
1069
     * Long Legged Doji.
1070
     *
1071
     * @param array $open  Opening price, array of real values.
1072
     * @param array $high  High price, array of real values.
1073
     * @param array $low   Low price, array of real values.
1074
     * @param array $close Closing price, array of real values.
1075
     *
1076
     * @return array Returns an array with calculated data.
1077
     */
1078
    public function cdllongleggeddoji(array $open, array $high, array $low, array $close): array
1079
    {
1080
        $result = trader_cdllongleggeddoji($open, $high, $low, $close);
1081
1082
        $this->handleErrors();
1083
1084
        return $result;
1085
    }
1086
1087
    /**
1088
     * Long Line Candle.
1089
     *
1090
     * @param array $open  Opening price, array of real values.
1091
     * @param array $high  High price, array of real values.
1092
     * @param array $low   Low price, array of real values.
1093
     * @param array $close Closing price, array of real values.
1094
     *
1095
     * @return array Returns an array with calculated data.
1096
     */
1097
    public function cdllongline(array $open, array $high, array $low, array $close): array
1098
    {
1099
        $result = trader_cdllongline($open, $high, $low, $close);
1100
1101
        $this->handleErrors();
1102
1103
        return $result;
1104
    }
1105
1106
    /**
1107
     * Marubozu.
1108
     *
1109
     * @param array $open  Opening price, array of real values.
1110
     * @param array $high  High price, array of real values.
1111
     * @param array $low   Low price, array of real values.
1112
     * @param array $close Closing price, array of real values.
1113
     *
1114
     * @return array Returns an array with calculated data.
1115
     */
1116
    public function cdlmarubozu(array $open, array $high, array $low, array $close): array
1117
    {
1118
        $result = trader_cdlmarubozu($open, $high, $low, $close);
1119
1120
        $this->handleErrors();
1121
1122
        return $result;
1123
    }
1124
1125
    /**
1126
     * Matching Low.
1127
     *
1128
     * @param array $open  Opening price, array of real values.
1129
     * @param array $high  High price, array of real values.
1130
     * @param array $low   Low price, array of real values.
1131
     * @param array $close Closing price, array of real values.
1132
     *
1133
     * @return array Returns an array with calculated data.
1134
     */
1135
    public function cdlmatchinglow(array $open, array $high, array $low, array $close): array
1136
    {
1137
        $result = trader_cdlmatchinglow($open, $high, $low, $close);
1138
1139
        $this->handleErrors();
1140
1141
        return $result;
1142
    }
1143
1144
    /**
1145
     * Mat Hold.
1146
     *
1147
     * @param array $open        Opening price, array of real values.
1148
     * @param array $high        High price, array of real values.
1149
     * @param array $low         Low price, array of real values.
1150
     * @param array $close       Closing price, array of real values.
1151
     * @param float $penetration Percentage of penetration of a candle within another candle.
1152
     *
1153
     * @return array Returns an array with calculated data.
1154
     */
1155
    public function cdlmathold(
1156
        array $open,
1157
        array $high,
1158
        array $low,
1159
        array $close,
1160
        float $penetration = 0.5
1161
    ): array {
1162
        $result = trader_cdlmathold($open, $high, $low, $close, $penetration);
1163
1164
        $this->handleErrors();
1165
1166
        return $result;
1167
    }
1168
1169
    /**
1170
     * Morning Doji Star.
1171
     *
1172
     * @param array $open        Opening price, array of real values.
1173
     * @param array $high        High price, array of real values.
1174
     * @param array $low         Low price, array of real values.
1175
     * @param array $close       Closing price, array of real values.
1176
     * @param float $penetration [OPTIONAL] [DEFAULT 0.3] Percentage of penetration of a candle within another candle.
1177
     *
1178
     * @return array Returns an array with calculated data.
1179
     */
1180
    public function cdlmorningdojistar(
1181
        array $open,
1182
        array $high,
1183
        array $low,
1184
        array $close,
1185
        float $penetration = 0.3
1186
    ): array {
1187
        $result = trader_cdlmorningdojistar($open, $high, $low, $close, $penetration);
1188
1189
        $this->handleErrors();
1190
1191
        return $result;
1192
    }
1193
1194
    /**
1195
     * Morning Star.
1196
     *
1197
     * @param array $open        Opening price, array of real values.
1198
     * @param array $high        High price, array of real values.
1199
     * @param array $low         Low price, array of real values.
1200
     * @param array $close       Closing price, array of real values.
1201
     * @param float $penetration Percentage of penetration of a candle within another candle.
1202
     *
1203
     * @return array Returns an array with calculated data.
1204
     */
1205
    public function cdlmorningstar(
1206
        array $open,
1207
        array $high,
1208
        array $low,
1209
        array $close,
1210
        float $penetration = 0.3
1211
    ): array {
1212
        $result = trader_cdlmorningstar($open, $high, $low, $close, $penetration);
1213
1214
        $this->handleErrors();
1215
1216
        return $result;
1217
    }
1218
1219
    /**
1220
     * On-Neck Pattern.
1221
     *
1222
     * @param array $open  Opening price, array of real values.
1223
     * @param array $high  High price, array of real values.
1224
     * @param array $low   Low price, array of real values.
1225
     * @param array $close Closing price, array of real values.
1226
     *
1227
     * @return array Returns an array with calculated data.
1228
     */
1229
    public function cdlonneck(array $open, array $high, array $low, array $close): array
1230
    {
1231
        $result = trader_cdlonneck($open, $high, $low, $close);
1232
1233
        $this->handleErrors();
1234
1235
        return $result;
1236
    }
1237
1238
    /**
1239
     * Piercing Pattern.
1240
     *
1241
     * @param array $open  Opening price, array of real values.
1242
     * @param array $high  High price, array of real values.
1243
     * @param array $low   Low price, array of real values.
1244
     * @param array $close Closing price, array of real values.
1245
     *
1246
     * @return array Returns an array with calculated data.
1247
     */
1248
    public function cdlpiercing(array $open, array $high, array $low, array $close): array
1249
    {
1250
        $result = trader_cdlpiercing($open, $high, $low, $close);
1251
1252
        $this->handleErrors();
1253
1254
        return $result;
1255
    }
1256
1257
    /**
1258
     * Rickshaw Man.
1259
     *
1260
     * @param array $open  Opening price, array of real values.
1261
     * @param array $high  High price, array of real values.
1262
     * @param array $low   Low price, array of real values.
1263
     * @param array $close Closing price, array of real values.
1264
     *
1265
     * @return array Returns an array with calculated data.
1266
     */
1267
    public function cdlrickshawman(array $open, array $high, array $low, array $close): array
1268
    {
1269
        $result = trader_cdlrickshawman($open, $high, $low, $close);
1270
1271
        $this->handleErrors();
1272
1273
        return $result;
1274
    }
1275
1276
    /**
1277
     * Rising/Falling Three Methods.
1278
     *
1279
     * @param array $open  Opening price, array of real values.
1280
     * @param array $high  High price, array of real values.
1281
     * @param array $low   Low price, array of real values.
1282
     * @param array $close Closing price, array of real values.
1283
     *
1284
     * @return array Returns an array with calculated data.
1285
     */
1286
    public function cdlrisefall3methods(array $open, array $high, array $low, array $close): array
1287
    {
1288
        $result = trader_cdlrisefall3methods($open, $high, $low, $close);
1289
1290
        $this->handleErrors();
1291
1292
        return $result;
1293
    }
1294
1295
    /**
1296
     * Separating Lines.
1297
     *
1298
     * @param array $open  Opening price, array of real values.
1299
     * @param array $high  High price, array of real values.
1300
     * @param array $low   Low price, array of real values.
1301
     * @param array $close Closing price, array of real values.
1302
     *
1303
     * @return array Returns an array with calculated data.
1304
     */
1305
    public function cdlseparatinglines(array $open, array $high, array $low, array $close): array
1306
    {
1307
        $result = trader_cdlseparatinglines($open, $high, $low, $close);
1308
1309
        $this->handleErrors();
1310
1311
        return $result;
1312
    }
1313
1314
    /**
1315
     * Shooting Star.
1316
     *
1317
     * @param array $open  Opening price, array of real values.
1318
     * @param array $high  High price, array of real values.
1319
     * @param array $low   Low price, array of real values.
1320
     * @param array $close Closing price, array of real values.
1321
     *
1322
     * @return array Returns an array with calculated data.
1323
     */
1324
    public function cdlshootingstar(array $open, array $high, array $low, array $close): array
1325
    {
1326
        $result = trader_cdlshootingstar($open, $high, $low, $close);
1327
1328
        $this->handleErrors();
1329
1330
        return $result;
1331
    }
1332
1333
    /**
1334
     * Short Line Candle.
1335
     *
1336
     * @param array $open  Opening price, array of real values.
1337
     * @param array $high  High price, array of real values.
1338
     * @param array $low   Low price, array of real values.
1339
     * @param array $close Closing price, array of real values.
1340
     *
1341
     * @return array Returns an array with calculated data.
1342
     */
1343
    public function cdlshortline(array $open, array $high, array $low, array $close): array
1344
    {
1345
        $result = trader_cdlshortline($open, $high, $low, $close);
1346
1347
        $this->handleErrors();
1348
1349
        return $result;
1350
    }
1351
1352
    /**
1353
     * Spinning Top.
1354
     *
1355
     * @param array $open  Opening price, array of real values.
1356
     * @param array $high  High price, array of real values.
1357
     * @param array $low   Low price, array of real values.
1358
     * @param array $close Closing price, array of real values.
1359
     *
1360
     * @return array Returns an array with calculated data.
1361
     */
1362
    public function cdlspinningtop(array $open, array $high, array $low, array $close): array
1363
    {
1364
        $result = trader_cdlspinningtop($open, $high, $low, $close);
1365
1366
        $this->handleErrors();
1367
1368
        return $result;
1369
    }
1370
1371
    /**
1372
     * Stalled Pattern.
1373
     *
1374
     * @param array $open  Opening price, array of real values.
1375
     * @param array $high  High price, array of real values.
1376
     * @param array $low   Low price, array of real values.
1377
     * @param array $close Closing price, array of real values.
1378
     *
1379
     * @return array Returns an array with calculated data.
1380
     */
1381
    public function cdlstalledpattern(array $open, array $high, array $low, array $close): array
1382
    {
1383
        $result = trader_cdlstalledpattern($open, $high, $low, $close);
1384
1385
        $this->handleErrors();
1386
1387
        return $result;
1388
    }
1389
1390
    /**
1391
     * Stick Sandwich.
1392
     *
1393
     * @param array $open  Opening price, array of real values.
1394
     * @param array $high  High price, array of real values.
1395
     * @param array $low   Low price, array of real values.
1396
     * @param array $close Closing price, array of real values.
1397
     *
1398
     * @return array Returns an array with calculated data.
1399
     */
1400
    public function cdlsticksandwich(array $open, array $high, array $low, array $close): array
1401
    {
1402
        $result = trader_cdlsticksandwich($open, $high, $low, $close);
1403
1404
        $this->handleErrors();
1405
1406
        return $result;
1407
    }
1408
1409
    /**
1410
     * Takuri (Dragonfly Doji with very long lower shadow).
1411
     *
1412
     * @param array $open  Opening price, array of real values.
1413
     * @param array $high  High price, array of real values.
1414
     * @param array $low   Low price, array of real values.
1415
     * @param array $close Closing price, array of real values.
1416
     *
1417
     * @return array Returns an array with calculated data.
1418
     */
1419
    public function cdltakuri(array $open, array $high, array $low, array $close): array
1420
    {
1421
        $result = trader_cdltakuri($open, $high, $low, $close);
1422
1423
        $this->handleErrors();
1424
1425
        return $result;
1426
    }
1427
1428
    /**
1429
     * Tasuki Gap.
1430
     *
1431
     * @param array $open  Opening price, array of real values.
1432
     * @param array $high  High price, array of real values.
1433
     * @param array $low   Low price, array of real values.
1434
     * @param array $close Closing price, array of real values.
1435
     *
1436
     * @return array Returns an array with calculated data.
1437
     */
1438
    public function cdltasukigap(array $open, array $high, array $low, array $close): array
1439
    {
1440
        $result = trader_cdltasukigap($open, $high, $low, $close);
1441
1442
        $this->handleErrors();
1443
1444
        return $result;
1445
    }
1446
1447
    /**
1448
     * Thrusting Pattern.
1449
     *
1450
     * @param array $open  Opening price, array of real values.
1451
     * @param array $high  High price, array of real values.
1452
     * @param array $low   Low price, array of real values.
1453
     * @param array $close Closing price, array of real values.
1454
     *
1455
     * @return array Returns an array with calculated data.
1456
     */
1457
    public function cdlthrusting(array $open, array $high, array $low, array $close): array
1458
    {
1459
        $result = trader_cdlthrusting($open, $high, $low, $close);
1460
1461
        $this->handleErrors();
1462
1463
        return $result;
1464
    }
1465
1466
    /**
1467
     * Tristar Pattern.
1468
     *
1469
     * @param array $open  Opening price, array of real values.
1470
     * @param array $high  High price, array of real values.
1471
     * @param array $low   Low price, array of real values.
1472
     * @param array $close Closing price, array of real values.
1473
     *
1474
     * @return array Returns an array with calculated data.
1475
     */
1476
    public function cdltristar(array $open, array $high, array $low, array $close): array
1477
    {
1478
        $result = trader_cdltristar($open, $high, $low, $close);
1479
1480
        $this->handleErrors();
1481
1482
        return $result;
1483
    }
1484
1485
    /**
1486
     * Unique 3 River.
1487
     *
1488
     * @param array $open  Opening price, array of real values.
1489
     * @param array $high  High price, array of real values.
1490
     * @param array $low   Low price, array of real values.
1491
     * @param array $close Closing price, array of real values.
1492
     *
1493
     * @return array Returns an array with calculated data.
1494
     */
1495
    public function cdlunique3river(array $open, array $high, array $low, array $close): array
1496
    {
1497
        $result = trader_cdlunique3river($open, $high, $low, $close);
1498
1499
        $this->handleErrors();
1500
1501
        return $result;
1502
    }
1503
1504
    /**
1505
     * Upside Gap Two Crows.
1506
     *
1507
     * @param array $open  Opening price, array of real values.
1508
     * @param array $high  High price, array of real values.
1509
     * @param array $low   Low price, array of real values.
1510
     * @param array $close Closing price, array of real values.
1511
     *
1512
     * @return array Returns an array with calculated data.
1513
     */
1514
    public function cdlupsidegap2crows(array $open, array $high, array $low, array $close): array
1515
    {
1516
        $result = trader_cdlupsidegap2crows($open, $high, $low, $close);
1517
1518
        $this->handleErrors();
1519
1520
        return $result;
1521
    }
1522
1523
    /**
1524
     * Upside/Downside Gap Three Methods.
1525
     *
1526
     * @param array $open  Opening price, array of real values.
1527
     * @param array $high  High price, array of real values.
1528
     * @param array $low   Low price, array of real values.
1529
     * @param array $close Closing price, array of real values.
1530
     *
1531
     * @return array Returns an array with calculated data.
1532
     */
1533
    public function cdlxsidegap3methods(array $open, array $high, array $low, array $close): array
1534
    {
1535
        $result = trader_cdlxsidegap3methods($open, $high, $low, $close);
1536
1537
        $this->handleErrors();
1538
1539
        return $result;
1540
    }
1541
1542
    /**
1543
     * Vector Ceil.
1544
     *
1545
     * Calculates the next highest integer for each value in real and returns the resulting array.
1546
     *
1547
     * @param array $real Array of real values.
1548
     *
1549
     * @return array Returns an array with calculated data.
1550
     */
1551
    public function ceil(array $real): array
1552
    {
1553
        $result = trader_ceil($real);
1554
1555
        $this->handleErrors();
1556
1557
        return $result;
1558
    }
1559
1560
    /**
1561
     * Chande Momentum Oscillator.
1562
     *
1563
     * @param array $real       Array of real values.
1564
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1565
     *
1566
     * @return array Returns an array with calculated data.
1567
     */
1568
    public function cmo(array $real, int $timePeriod = 14): array
1569
    {
1570
        $result = trader_cmo($real, $timePeriod);
1571
1572
        $this->handleErrors();
1573
1574
        return $result;
1575
    }
1576
1577
    /**
1578
     * Pearson's Correlation Coefficient (r).
1579
     *
1580
     * @param array $real0      Array of real values.
1581
     * @param array $real1      Array of real values.
1582
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1583
     *
1584
     * @return array Returns an array with calculated data.
1585
     */
1586
    public function correl(array $real0, array $real1, int $timePeriod = 30): array
1587
    {
1588
        $result = trader_correl($real0, $real1, $timePeriod);
1589
1590
        $this->handleErrors();
1591
1592
        return $result;
1593
    }
1594
1595
    /**
1596
     * Vector Trigonometric Cos.
1597
     *
1598
     * Calculates the cosine for each value in real and returns the resulting array.
1599
     *
1600
     * @param array $real Array of real values.
1601
     *
1602
     * @return array Returns an array with calculated data.
1603
     */
1604
    public function cos(array $real): array
1605
    {
1606
        $result = trader_cos($real);
1607
1608
        $this->handleErrors();
1609
1610
        return $result;
1611
    }
1612
1613
    /**
1614
     * Vector Trigonometric Cosh.
1615
     *
1616
     * Calculates the hyperbolic cosine for each value in real and returns the resulting array.
1617
     *
1618
     * @param array $real Array of real values.
1619
     *
1620
     * @return array Returns an array with calculated data.
1621
     */
1622
    public function cosh(array $real): array
1623
    {
1624
        $result = trader_cosh($real);
1625
1626
        $this->handleErrors();
1627
1628
        return $result;
1629
    }
1630
1631
    /**
1632
     * Double Exponential Moving Average.
1633
     *
1634
     * @param array $real       Array of real values.
1635
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1636
     *
1637
     * @return array Returns an array with calculated data.
1638
     */
1639
    public function dema(array $real, int $timePeriod = 30): array
1640
    {
1641
        $result = trader_dema($real, $timePeriod);
1642
1643
        $this->handleErrors();
1644
1645
        return $result;
1646
    }
1647
1648
    /**
1649
     * Vector Arithmetic Div.
1650
     *
1651
     * Divides each value from real0 by the corresponding value from real1 and returns the resulting array.
1652
     *
1653
     * @param array $real0 Array of real values.
1654
     * @param array $real1 Array of real values.
1655
     *
1656
     * @return array Returns an array with calculated data.
1657
     */
1658
    public function div(array $real0, array $real1): array
1659
    {
1660
        $result = trader_dema($real0, $real1);
1661
1662
        $this->handleErrors();
1663
1664
        return $result;
1665
    }
1666
1667
    /**
1668
     * Directional Movement Index.
1669
     *
1670
     * @param array $high       High price, array of real values.
1671
     * @param array $low        Low price, array of real values.
1672
     * @param array $close      Closing price, array of real values.
1673
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1674
     *
1675
     * @return array  Returns an array with calculated data.
1676
     */
1677
    public function dx(array $high, array $low, array $close, int $timePeriod = 14): array
1678
    {
1679
        $result = trader_dx($high, $low, $close, $timePeriod);
1680
1681
        $this->handleErrors();
1682
1683
        return $result;
1684
    }
1685
1686
    /**
1687
     * Exponential Moving Average.
1688
     *
1689
     * @param array $real       Array of real values.
1690
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1691
     *
1692
     * @return array Returns an array with calculated data.
1693
     */
1694
    public function ema(array $real, int $timePeriod = 30): array
1695
    {
1696
        $result = trader_ema($real, $timePeriod);
1697
1698
        $this->handleErrors();
1699
1700
        return $result;
1701
    }
1702
1703
    /**
1704
     * Get error code.
1705
     *
1706
     * Get error code of the last operation.
1707
     *
1708
     * @return int Returns the error code identified by one of the ERR_* constants.
1709
     */
1710
    public function errno(): int
1711
    {
1712
        return trader_errno();
1713
    }
1714
1715
    /**
1716
     * Vector Arithmetic Exp.
1717
     *
1718
     * Calculates e raised to the power of each value in real. Returns an array with the calculated data.
1719
     *
1720
     * @param array $real Array of real values.
1721
     *
1722
     * @return array Returns an array with calculated data.
1723
     */
1724
    public function exp(array $real): array
1725
    {
1726
        $result = trader_exp($real);
1727
1728
        $this->handleErrors();
1729
1730
        return $result;
1731
    }
1732
1733
    /**
1734
     * Vector Floor.
1735
     *
1736
     * Calculates the next lowest integer for each value in real and returns the resulting array.
1737
     *
1738
     * @param array $real Array of real values.
1739
     *
1740
     * @return array Returns an array with calculated data.
1741
     */
1742
    public function floor(array $real): array
1743
    {
1744
        $result = trader_floor($real);
1745
1746
        $this->handleErrors();
1747
1748
        return $result;
1749
    }
1750
1751
    /**
1752
     * Get compatibility mode.
1753
     *
1754
     * Get compatibility mode which affects the way calculations are done by all the extension functions.
1755
     *
1756
     * @return int Returns the compatibility mode id which can be identified by COMPATIBILITY_* series of constants.
1757
     */
1758
    public function get_compat(): int
1759
    {
1760
        return trader_get_compat();
1761
    }
1762
1763
    /**
1764
     * Get unstable period.
1765
     *
1766
     * Get unstable period factor for a particular function.
1767
     *
1768
     * @param int $functionId Function ID the factor to be read for. FUNC_UNST_* series of constants should be used.
1769
     *
1770
     * @return int Returns the unstable period factor for the corresponding function.
1771
     */
1772
    public function get_unstable_period(int $functionId): int
0 ignored issues
show
Unused Code introduced by
The parameter $functionId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1773
    {
1774
        return trader_get_unstable_period();
1775
    }
1776
1777
    /**
1778
     * Hilbert Transform - Dominant Cycle Period.
1779
     *
1780
     * @param array $real Array of real values.
1781
     *
1782
     * @return array Returns an array with calculated data.
1783
     */
1784
    public function ht_dcperiod(array $real): array
1785
    {
1786
        $result = trader_ht_dcperiod($real);
1787
1788
        $this->handleErrors();
1789
1790
        return $result;
1791
    }
1792
1793
    /**
1794
     * Hilbert Transform - Dominant Cycle Phase.
1795
     *
1796
     * @param array $real Array of real values.
1797
     *
1798
     * @return array Returns an array with calculated data.
1799
     */
1800
    public function ht_dcphase(array $real): array
1801
    {
1802
        $result = trader_ht_dcphase($real);
1803
1804
        $this->handleErrors();
1805
1806
        return $result;
1807
    }
1808
1809
    /**
1810
     * Hilbert Transform - Phasor Components.
1811
     *
1812
     * @param array $open  Opening price, array of real values.
1813
     * @param array $close Closing price, array of real values.
1814
     *
1815
     * @return array Returns an array with calculated data.
1816
     */
1817
    public function ht_phasor(array $open, array $close): array
1818
    {
1819
        $result = trader_ht_phasor($open, $close);
1820
1821
        $this->handleErrors();
1822
1823
        return $result;
1824
    }
1825
1826
    /**
1827
     * Hilbert Transform - Phasor Components.
1828
     *
1829
     * @param array $open  Opening price, array of real values.
1830
     * @param array $close Closing price, array of real values.
1831
     *
1832
     * @return array Returns an array with calculated data.
1833
     */
1834
    public function ht_sine(array $open, array $close): array
1835
    {
1836
        $result = trader_ht_sine($open, $close);
1837
1838
        $this->handleErrors();
1839
1840
        return $result;
1841
    }
1842
1843
    /**
1844
     * Hilbert Transform - Instantaneous Trendline.
1845
     *
1846
     * @param array $real Array of real values.
1847
     *
1848
     * @return array Returns an array with calculated data.
1849
     */
1850
    public function ht_trendline(array $real): array
1851
    {
1852
        $result = trader_ht_trendline($real);
1853
1854
        $this->handleErrors();
1855
1856
        return $result;
1857
    }
1858
1859
    /**
1860
     * Hilbert Transform - Trend vs Cycle Mode.
1861
     *
1862
     * @param array $real Array of real values.
1863
     *
1864
     * @return array Returns an array with calculated data.
1865
     */
1866
    public function ht_trendmode(array $real): array
1867
    {
1868
        $result = trader_ht_trendmode($real);
1869
1870
        $this->handleErrors();
1871
1872
        return $result;
1873
    }
1874
1875
    /**
1876
     * Kaufman Adaptive Moving Average.
1877
     *
1878
     * @param array $real       Array of real values.
1879
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1880
     *
1881
     * @return array Returns an array with calculated data.
1882
     */
1883
    public function kama(array $real, int $timePeriod = 30): array
1884
    {
1885
        $result = trader_kama($real, $timePeriod);
1886
1887
        $this->handleErrors();
1888
1889
        return $result;
1890
    }
1891
1892
    /**
1893
     * Linear Regression Angle.
1894
     *
1895
     * @param array $real       Array of real values.
1896
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1897
     *
1898
     * @return array Returns an array with calculated data.
1899
     */
1900
    public function linearreg_angle(array $real, int $timePeriod = 14): array
1901
    {
1902
        $result = trader_linearreg_angle($real, $timePeriod);
1903
1904
        $this->handleErrors();
1905
1906
        return $result;
1907
    }
1908
1909
    /**
1910
     * Linear Regression Angle.
1911
     *
1912
     * @param array $real       Array of real values.
1913
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1914
     *
1915
     * @return array Returns an array with calculated data.
1916
     */
1917
    public function linearreg_intercept(array $real, int $timePeriod = 14): array
1918
    {
1919
        $result = trader_linearreg_intercept($real, $timePeriod);
1920
1921
        $this->handleErrors();
1922
1923
        return $result;
1924
    }
1925
1926
    /**
1927
     * Linear Regression Slope.
1928
     *
1929
     * @param array $real       Array of real values.
1930
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1931
     *
1932
     * @return array Returns an array with calculated data.
1933
     */
1934
    public function linearreg_slope(array $real, int $timePeriod = 14): array
1935
    {
1936
        $result = trader_linearreg_slope($real, $timePeriod);
1937
1938
        $this->handleErrors();
1939
1940
        return $result;
1941
    }
1942
1943
    /**
1944
     * Linear Regression.
1945
     *
1946
     * @param array $real       Array of real values.
1947
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
1948
     *
1949
     * @return array Returns an array with calculated data.
1950
     */
1951
    public function linearreg(array $real, int $timePeriod = 14): array
1952
    {
1953
        $result = trader_linearreg($real, $timePeriod);
1954
1955
        $this->handleErrors();
1956
1957
        return $result;
1958
    }
1959
1960
    /**
1961
     * Vector Log Natural.
1962
     *
1963
     * Calculates the natural logarithm for each value in real and returns the resulting array.
1964
     *
1965
     * @param array $real Array of real values.
1966
     *
1967
     * @return array Returns an array with calculated data.
1968
     */
1969
    public function ln(array $real): array
1970
    {
1971
        $result = trader_ln($real);
1972
1973
        $this->handleErrors();
1974
1975
        return $result;
1976
    }
1977
1978
    /**
1979
     * Vector Log10.
1980
     *
1981
     * Calculates the base-10 logarithm for each value in real and returns the resulting array.
1982
     *
1983
     * @param array $real Array of real values.
1984
     *
1985
     * @return array Returns an array with calculated data.
1986
     */
1987
    public function log10(array $real): array
1988
    {
1989
        $result = trader_log10($real);
1990
1991
        $this->handleErrors();
1992
1993
        return $result;
1994
    }
1995
1996
    /**
1997
     * Moving average.
1998
     *
1999
     * @param array $real       Array of real values.
2000
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2001
     * @param int   $mAType     Type of Moving Average. MA_TYPE_* series of constants should be used.
2002
     *
2003
     * @return array Returns an array with calculated data.
2004
     */
2005
    public function ma(array $real, int $timePeriod = 30, int $mAType = 0): array
2006
    {
2007
        $result = trader_ma($real, $timePeriod, $mAType);
2008
2009
        $this->handleErrors();
2010
2011
        return $result;
2012
    }
2013
2014
    /**
2015
     * Moving Average Convergence/Divergence.
2016
     *
2017
     * @param array $real         Array of real values.
2018
     * @param int   $fastPeriod   Number of period for the fast MA. Valid range from 2 to 100000.
2019
     * @param int   $slowPeriod   Number of period for the slow MA. Valid range from 2 to 100000.
2020
     * @param int   $signalPeriod Smoothing for the signal line (nb of period). Valid range from 1 to 100000.
2021
     *
2022
     * @return array Returns an array with calculated data.
2023
     */
2024
    public function macd(
2025
        array $real,
2026
        int $fastPeriod = 12,
2027
        int $slowPeriod = 26,
2028
        int $signalPeriod = 9
2029
    ): array {
2030
        $result = trader_macd($real, $fastPeriod, $slowPeriod, $signalPeriod);
2031
2032
        $this->handleErrors();
2033
2034
        return $result;
2035
    }
2036
2037
    /**
2038
     * Moving Average Convergence/Divergence with controllable Moving Average type.
2039
     *
2040
     * @param array $real         Array of real values.
2041
     * @param int   $fastPeriod   Number of period for the fast MA. Valid range from 2 to 100000.
2042
     * @param int   $fastMAType   Type of Moving Average for fast MA. MA_TYPE_* series of constants should be used.
2043
     * @param int   $slowPeriod   Number of period for the slow MA. Valid range from 2 to 100000.
2044
     * @param int   $slowMAType   Type of Moving Average for fast MA. MA_TYPE_* series of constants should be used.
2045
     * @param int   $signalPeriod Smoothing for the signal line (nb of period). Valid range from 1 to 100000.
2046
     *
2047
     * @return array Returns an array with calculated data.
2048
     */
2049
    public function macdext(
2050
        array $real,
2051
        int $fastPeriod = 12,
2052
        int $fastMAType = 0,
2053
        int $slowPeriod = 26,
2054
        int $slowMAType = 0,
2055
        int $signalPeriod = 9
2056
    ): array {
2057
        $result = trader_macdext($real, $fastPeriod, $fastMAType, $slowPeriod, $slowMAType, $signalPeriod);
2058
2059
        $this->handleErrors();
2060
2061
        return $result;
2062
    }
2063
2064
    /**
2065
     * Moving Average Convergence/Divergence Fix 12/26.
2066
     *
2067
     * @param array $real         Array of real values.
2068
     * @param int   $signalPeriod Smoothing for the signal line (nb of period). Valid range from 1 to 100000.
2069
     *
2070
     * @return array Returns an array with calculated data.
2071
     */
2072
    public function macdfix(array $real, int $signalPeriod = 9): array
2073
    {
2074
        $result = trader_macdfix($real, $signalPeriod);
2075
2076
        $this->handleErrors();
2077
2078
        return $result;
2079
    }
2080
2081
    /**
2082
     * MESA Adaptive Moving Average.
2083
     *
2084
     * @param array $real      Array of real values.
2085
     * @param float $fastLimit Upper limit use in the adaptive algorithm. Valid range from 0.01 to 0.99.
2086
     * @param float $slowLimit Lower limit use in the adaptive algorithm. Valid range from 0.01 to 0.99.
2087
     *
2088
     * @return array Returns an array with calculated data.
2089
     */
2090
    public function mama(array $real, float $fastLimit = 0.5, float $slowLimit = 0.05): array
2091
    {
2092
        $result = trader_mama($real, $fastLimit, $slowLimit);
2093
2094
        $this->handleErrors();
2095
2096
        return $result;
2097
    }
2098
2099
    /**
2100
     * Moving average with variable period
2101
     *
2102
     * @param array $real      Array of real values.
2103
     * @param array $periods   Array of real values.
2104
     * @param int   $minPeriod Value less than minimum will be changed to Minimum period. Valid range from 2 to 100000
2105
     * @param int   $maxPeriod Value higher than maximum will be changed to Maximum period. Valid range from 2 to 100000
2106
     * @param int   $mAType    Type of Moving Average. MA_TYPE_* series of constants should be used.
2107
     *
2108
     * @return array Returns an array with calculated data.
2109
     */
2110
    public function mavp(
2111
        array $real,
2112
        array $periods,
2113
        int $minPeriod = 2,
2114
        int $maxPeriod = 30,
2115
        int $mAType = 0
2116
    ): array {
2117
        $result = trader_mavp($real, $periods, $minPeriod, $maxPeriod, $mAType);
2118
2119
        $this->handleErrors();
2120
2121
        return $result;
2122
    }
2123
2124
    /**
2125
     * Highest value over a specified period.
2126
     *
2127
     * @param array $real       Array of real values.
2128
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2129
     *
2130
     * @return array Returns an array with calculated data.
2131
     */
2132
    public function max(array $real, int $timePeriod = 30): array
2133
    {
2134
        $result = trader_max($real, $timePeriod);
2135
2136
        $this->handleErrors();
2137
2138
        return $result;
2139
    }
2140
2141
    /**
2142
     * Index of highest value over a specified period
2143
     *
2144
     * @param array $real       Array of real values.
2145
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2146
     *
2147
     * @return array Returns an array with calculated data.
2148
     */
2149
    public function maxindex(array $real, int $timePeriod = 30): array
2150
    {
2151
        $result = trader_maxindex($real, $timePeriod);
2152
2153
        $this->handleErrors();
2154
2155
        return $result;
2156
    }
2157
2158
    /**
2159
     * Median Price.
2160
     *
2161
     * @param array $high High price, array of real values.
2162
     * @param array $low  Low price, array of real values.
2163
     *
2164
     * @return array Returns an array with calculated data.
2165
     */
2166
    public function medprice(array $high, array $low): array
2167
    {
2168
        $result = trader_medprice($high, $low);
2169
2170
        $this->handleErrors();
2171
2172
        return $result;
2173
    }
2174
2175
    /**
2176
     * Money Flow Index.
2177
     *
2178
     * @param array $high       High price, array of real values.
2179
     * @param array $low        Low price, array of real values.
2180
     * @param array $close      Closing price, array of real values.
2181
     * @param array $volume     Volume traded, array of real values.
2182
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2183
     *
2184
     * @return array Returns an array with calculated data.
2185
     */
2186
    public function mfi(array $high, array $low, array $close, array $volume, int $timePeriod = 14): array
2187
    {
2188
        $result = trader_mfi($high, $low, $close, $volume, $timePeriod);
2189
2190
        $this->handleErrors();
2191
2192
        return $result;
2193
    }
2194
2195
    /**
2196
     * MidPoint over period.
2197
     *
2198
     * @param array $real       Array of real values.
2199
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2200
     *
2201
     * @return array Returns an array with calculated data.
2202
     */
2203
    public function midpoint(array $real, int $timePeriod = 14): array
2204
    {
2205
        $result = trader_midpoint($real, $timePeriod);
2206
2207
        $this->handleErrors();
2208
2209
        return $result;
2210
    }
2211
2212
    /**
2213
     * Midpoint Price over period.
2214
     *
2215
     * @param array $high       High price, array of real values.
2216
     * @param array $low        Low price, array of real values.
2217
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2218
     *
2219
     * @return array Returns an array with calculated data.
2220
     */
2221
    public function midprice(array $high, array $low, int $timePeriod = 14)
2222
    {
2223
        $result = trader_midpoint($high, $low, $timePeriod);
2224
2225
        $this->handleErrors();
2226
2227
        return $result;
2228
    }
2229
2230
    /**
2231
     * Lowest value over a specified period.
2232
     *
2233
     * @param array $real       Array of real values.
2234
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2235
     *
2236
     * @return array Returns an array with calculated data.
2237
     */
2238
    public function min(array $real, int $timePeriod = 30): array
2239
    {
2240
        $result = trader_min($real, $timePeriod);
2241
2242
        $this->handleErrors();
2243
2244
        return $result;
2245
    }
2246
2247
    /**
2248
     * Index of lowest value over a specified period.
2249
     *
2250
     * @param array $real       Array of real values.
2251
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2252
     *
2253
     * @return array Returns an array with calculated data.
2254
     */
2255
    public function minindex(array $real, int $timePeriod = 30): array
2256
    {
2257
        $result = trader_minindex($real, $timePeriod);
2258
2259
        $this->handleErrors();
2260
2261
        return $result;
2262
    }
2263
2264
    /**
2265
     * Lowest and highest values over a specified period.
2266
     *
2267
     * @param array $real       Array of real values.
2268
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2269
     *
2270
     * @return array Returns an array with calculated data.
2271
     */
2272
    public function minmax(array $real, int $timePeriod = 30): array
2273
    {
2274
        $result = trader_minmax($real, $timePeriod);
2275
2276
        $this->handleErrors();
2277
2278
        return $result;
2279
    }
2280
2281
    /**
2282
     * Indexes of lowest and highest values over a specified period.
2283
     *
2284
     * @param array $real       Array of real values.
2285
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2286
     *
2287
     * @return array Returns an array with calculated data.
2288
     */
2289
    public function minmaxindex(array $real, int $timePeriod = 30): array
2290
    {
2291
        $result = trader_minmaxindex($real, $timePeriod);
2292
2293
        $this->handleErrors();
2294
2295
        return $result;
2296
    }
2297
2298
    /**
2299
     * Minus Directional Indicator.
2300
     *
2301
     * @param array $high       High price, array of real values.
2302
     * @param array $low        Low price, array of real values.
2303
     * @param array $close      Closing price, array of real values.
2304
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2305
     *
2306
     * @return array Returns an array with calculated data.
2307
     */
2308
    public function minus_di(array $high, array $low, array $close, int $timePeriod = 14): array
2309
    {
2310
        $result = trader_minus_di($high, $low, $close, $timePeriod);
2311
2312
        $this->handleErrors();
2313
2314
        return $result;
2315
    }
2316
2317
    /**
2318
     * Minus Directional Movement.
2319
     *
2320
     * @param array $high       High price, array of real values.
2321
     * @param array $low        Low price, array of real values.
2322
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2323
     *
2324
     * @return array Returns an array with calculated data.
2325
     */
2326
    public function minus_dm(array $high, array $low, int $timePeriod = 14): array
2327
    {
2328
        $result = trader_minus_dm($high, $low, $timePeriod);
2329
2330
        $this->handleErrors();
2331
2332
        return $result;
2333
    }
2334
2335
    /**
2336
     * Momentum.
2337
     *
2338
     * @param array $real       Array of real values.
2339
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2340
     *
2341
     * @return array Returns an array with calculated data.
2342
     */
2343
    public function mom(array $real, int $timePeriod = 10): array
2344
    {
2345
        $result = trader_mom($real, $timePeriod);
2346
2347
        $this->handleErrors();
2348
2349
        return $result;
2350
    }
2351
2352
    /**
2353
     * Vector Arithmetic Mult.
2354
     *
2355
     * Calculates the vector dot product of real0 with real1 and returns the resulting vector.
2356
     *
2357
     * @param array $real0 Array of real values.
2358
     * @param array $real1 Array of real values.
2359
     *
2360
     * @return array Returns an array with calculated data.
2361
     */
2362
    public function mult(array $real0, array $real1): array
2363
    {
2364
        $result = trader_mult($real0, $real1);
2365
2366
        $this->handleErrors();
2367
2368
        return $result;
2369
    }
2370
2371
    /**
2372
     * Normalized Average True Range.
2373
     *
2374
     * @param array $high       High price, array of real values.
2375
     * @param array $low        Low price, array of real values.
2376
     * @param array $close      Closing price, array of real values.
2377
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2378
     *
2379
     * @return array Returns an array with calculated data.
2380
     */
2381
    public function natr(array $high, array $low, array $close, int $timePeriod = 14): array
2382
    {
2383
        $result = trader_natr($high, $low, $close, $timePeriod);
2384
2385
        $this->handleErrors();
2386
2387
        return $result;
2388
    }
2389
2390
    /**
2391
     * On Balance Volume.
2392
     *
2393
     * @param array $real   Array of real values.
2394
     * @param array $volume Volume traded, array of real values.
2395
     *
2396
     * @return array Returns an array with calculated data.
2397
     */
2398
    public function obv(array $real, array $volume): array
2399
    {
2400
        $result = trader_obv($real, $volume);
2401
2402
        $this->handleErrors();
2403
2404
        return $result;
2405
    }
2406
2407
    /**
2408
     * Plus Directional Indicator.
2409
     *
2410
     * @param array $high       High price, array of real values.
2411
     * @param array $low        Low price, array of real values.
2412
     * @param array $close      Closing price, array of real values.
2413
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2414
     *
2415
     * @return array Returns an array with calculated data.
2416
     */
2417
    public function plus_di(array $high, array $low, array $close, int $timePeriod = 14): array
2418
    {
2419
        $result = trader_plus_di($high, $low, $close, $timePeriod);
2420
2421
        $this->handleErrors();
2422
2423
        return $result;
2424
    }
2425
2426
    /**
2427
     * Plus Directional Movement.
2428
     *
2429
     * @param array $high       High price, array of real values.
2430
     * @param array $low        Low price, array of real values.
2431
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2432
     *
2433
     * @return array Returns an array with calculated data.
2434
     */
2435
    public function plus_dm(array $high, array $low, int $timePeriod = 14): array
2436
    {
2437
        $result = trader_plus_di($high, $low, $timePeriod);
2438
2439
        $this->handleErrors();
2440
2441
        return $result;
2442
    }
2443
2444
    /**
2445
     * Percentage Price Oscillator.
2446
     *
2447
     * @param array $real       Array of real values.
2448
     * @param int   $fastPeriod Number of period for the fast MA. Valid range from 2 to 100000.
2449
     * @param int   $slowPeriod Number of period for the slow MA. Valid range from 2 to 100000.
2450
     * @param int   $mAType     Type of Moving Average. MA_TYPE_* series of constants should be used.
2451
     *
2452
     * @return array Returns an array with calculated data.
2453
     */
2454
    public function ppo(array $real, int $fastPeriod = 12, int $slowPeriod = 26, int $mAType = 0): array
2455
    {
2456
        $result = trader_plus_di($real, $fastPeriod, $slowPeriod, $mAType);
2457
2458
        $this->handleErrors();
2459
2460
        return $result;
2461
    }
2462
2463
    /**
2464
     * Rate of change : ((price/prevPrice)-1)*100.
2465
     *
2466
     * @param array $real       Array of real values.
2467
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2468
     *
2469
     * @return array Returns an array with calculated data.
2470
     */
2471
    public function roc(array $real, int $timePeriod = 10): array
2472
    {
2473
        $result = trader_roc($real, $timePeriod);
2474
2475
        $this->handleErrors();
2476
2477
        return $result;
2478
    }
2479
2480
    /**
2481
     * Rate of change Percentage: (price-prevPrice)/prevPrice.
2482
     *
2483
     * @param array $real       Array of real values.
2484
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2485
     *
2486
     * @return array Returns an array with calculated data.
2487
     */
2488
    public function rocp(array $real, int $timePeriod = 10): array
2489
    {
2490
        $result = trader_rocp($real, $timePeriod);
2491
2492
        $this->handleErrors();
2493
2494
        return $result;
2495
    }
2496
2497
    /**
2498
     * Rate of change ratio 100 scale: (price/prevPrice)*100.
2499
     *
2500
     * @param array $real       Array of real values.
2501
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2502
     *
2503
     * @return array Returns an array with calculated data.
2504
     */
2505
    public function rocr100(array $real, int $timePeriod = 10): array
2506
    {
2507
        $result = trader_rocr100($real, $timePeriod);
2508
2509
        $this->handleErrors();
2510
2511
        return $result;
2512
    }
2513
2514
    /**
2515
     * Rate of change ratio: (price/prevPrice).
2516
     *
2517
     * @param array $real       Array of real values.
2518
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2519
     *
2520
     * @return array Returns an array with calculated data.
2521
     */
2522
    public function rocr(array $real, int $timePeriod = 10): array
2523
    {
2524
        $result = trader_rocr($real, $timePeriod);
2525
2526
        $this->handleErrors();
2527
2528
        return $result;
2529
    }
2530
2531
    /**
2532
     * Relative Strength Index.
2533
     *
2534
     * @param array $real       Array of real values.
2535
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2536
     *
2537
     * @return array Returns an array with calculated data.
2538
     */
2539
    public function rsi(array $real, int $timePeriod = 14): array
2540
    {
2541
        $result = trader_rocr($real, $timePeriod);
2542
2543
        $this->handleErrors();
2544
2545
        return $result;
2546
    }
2547
2548
    /**
2549
     * Parabolic SAR.
2550
     *
2551
     * @param array $high         High price, array of real values.
2552
     * @param array $low          Low price, array of real values.
2553
     * @param float $acceleration Acceleration Factor used up to the Maximum value. Valid range from 0 to REAL_MAX.
2554
     * @param float $maximum      Acceleration Factor Maximum value. Valid range from 0 to REAL_MAX.
2555
     *
2556
     * @return array Returns an array with calculated data.
2557
     */
2558
    public function sar(array $high, array $low, float $acceleration = 0.02, float $maximum = 0.2): array
2559
    {
2560
        $result = trader_sar($high, $low, $acceleration, $maximum);
2561
2562
        $this->handleErrors();
2563
2564
        return $result;
2565
    }
2566
2567
    /**
2568
     * Parabolic SAR - Extended.
2569
     *
2570
     * @param array $high                  High price, array of real values.
2571
     * @param array $low                   Low price, array of real values.
2572
     * @param float $startValue            Start value and direction. 0 for Auto, >0 for Long, <0 for Short. Valid range from TRADER_REAL_MIN to TRADER_REAL_MAX.
2573
     * @param float $offsetOnReverse       Percent offset added/removed to initial stop on short/long reversal. Valid range from 0 to TRADER_REAL_MAX.
2574
     * @param float $accelerationInitLong  Acceleration Factor initial value for the Long direction. Valid range from 0 to TRADER_REAL_MAX.
2575
     * @param float $accelerationLong      Acceleration Factor for the Long direction. Valid range from 0 to TRADER_REAL_MAX.
2576
     * @param float $accelerationMaxLong   Acceleration Factor maximum value for the Long direction. Valid range from 0 to TRADER_REAL_MAX.
2577
     * @param float $accelerationInitShort Acceleration Factor initial value for the Short direction. Valid range from 0 to TRADER_REAL_MAX.
2578
     * @param float $accelerationShort     Acceleration Factor for the Short direction. Valid range from 0 to TRADER_REAL_MAX.
2579
     * @param float $accelerationMaxShort  Acceleration Factor maximum value for the Short direction. Valid range from 0 to TRADER_REAL_MAX.
2580
     *
2581
     * @return array Returns an array with calculated data.
2582
     */
2583
    public function sarext(
2584
        array $high,
2585
        array $low,
2586
        float $startValue = 0.0,
2587
        float $offsetOnReverse = 0.0,
2588
        float $accelerationInitLong = 0.02,
2589
        float $accelerationLong = 0.02,
2590
        float $accelerationMaxLong = 0.2,
2591
        float $accelerationInitShort = 0.02,
2592
        float $accelerationShort = 0.02,
2593
        float $accelerationMaxShort = 0.2
2594
    ): array {
2595
        $result = trader_sarext(
2596
            $high,
2597
            $low,
2598
            $startValue,
2599
            $offsetOnReverse,
2600
            $accelerationInitLong,
2601
            $accelerationLong,
2602
            $accelerationMaxLong,
2603
            $accelerationInitShort,
2604
            $accelerationShort,
2605
            $accelerationMaxShort
2606
        );
2607
2608
        $this->handleErrors();
2609
2610
        return $result;
2611
    }
2612
2613
    /**
2614
     * Set compatibility mode.
2615
     *
2616
     * Set compatibility mode which will affect the way calculations are done by all the extension functions.
2617
     *
2618
     * @param int $compatId Compatibility Id. TRADER_COMPATIBILITY_* series of constants should be used.
2619
     */
2620
    public function set_compat(int $compatId)
2621
    {
2622
        trader_set_compat($compatId);
2623
    }
2624
2625
    /**
2626
     * Set unstable period.
2627
     *
2628
     * Influences unstable period factor for functions, which are sensible to it. More information about unstable periods can be found on the » TA-Lib API documentation page.
2629
     *
2630
     * @param int $functionId Function ID the factor should be set for. FUNC_UNST_* constant series can be used to affect the corresponding function.
2631
     * @param int $timePeriod Unstable period value.
2632
     */
2633
    public function set_unstable_period(int $functionId, int $timePeriod)
2634
    {
2635
        trader_set_unstable_period($functionId, $timePeriod);
2636
    }
2637
2638
    /**
2639
     * Vector Trigonometric Sin.
2640
     *
2641
     * Calculates the sine for each value in real and returns the resulting array.
2642
     *
2643
     * @param array $real Array of real values.
2644
     *
2645
     * @return array Returns an array with calculated data.
2646
     */
2647
    public function sin(array $real): array
2648
    {
2649
        $result = trader_sin($real);
2650
2651
        $this->handleErrors();
2652
2653
        return $result;
2654
    }
2655
2656
    /**
2657
     * Vector Trigonometric Sinh.
2658
     *
2659
     * Calculates the hyperbolic sine for each value in real and returns the resulting array.
2660
     *
2661
     * @param array $real Array of real values.
2662
     *
2663
     * @return array Returns an array with calculated data.
2664
     */
2665
    public function sinh(array $real): array
2666
    {
2667
        $result = trader_sinh($real);
2668
2669
        $this->handleErrors();
2670
2671
        return $result;
2672
    }
2673
2674
    /**
2675
     * Simple Moving Average.
2676
     *
2677
     * @param array $real       Array of real values.
2678
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2679
     *
2680
     * @return array Returns an array with calculated data.
2681
     */
2682
    public function sma(array $real, int $timePeriod = 30): array
2683
    {
2684
        $result = trader_sma($real, $timePeriod);
2685
2686
        $this->handleErrors();
2687
2688
        return $result;
2689
    }
2690
2691
    /**
2692
     * Vector Square Root.
2693
     *
2694
     * Calculates the square root of each value in real and returns the resulting array.
2695
     *
2696
     * @param array $real Array of real values.
2697
     *
2698
     * @return array Returns an array with calculated data.
2699
     */
2700
    public function sqrt(array $real): array
2701
    {
2702
        $result = trader_sqrt($real);
2703
2704
        $this->handleErrors();
2705
2706
        return $result;
2707
    }
2708
2709
    /**
2710
     * Standard Deviation.
2711
     *
2712
     * @param array $real       Array of real values.
2713
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2714
     * @param float $nbDev      Number of deviations
2715
     *
2716
     * @return array Returns an array with calculated data.
2717
     */
2718
    public function stddev(array $real, int $timePeriod = 5, float $nbDev = 1.0): array
0 ignored issues
show
Unused Code introduced by
The parameter $timePeriod is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $nbDev is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
2719
    {
2720
        $result = trader_stddev($real);
2721
2722
        $this->handleErrors();
2723
2724
        return $result;
2725
    }
2726
2727
    /**
2728
     * Stochastic.
2729
     *
2730
     * @param array $high         High price, array of real values.
2731
     * @param array $low          Low price, array of real values.
2732
     * @param array $close        Time period for building the Fast-K line. Valid range from 1 to 100000.
2733
     * @param int   $fastK_Period Time period for building the Fast-K line. Valid range from 1 to 100000.
2734
     * @param int   $slowK_Period Smoothing for making the Slow-K line. Valid range from 1 to 100000, usually set to 3.
2735
     * @param int   $slowK_MAType Type of Moving Average for Slow-K. MA_TYPE_* series of constants should be used.
2736
     * @param int   $slowD_Period Smoothing for making the Slow-D line. Valid range from 1 to 100000.
2737
     * @param int   $slowD_MAType Type of Moving Average for Slow-D. MA_TYPE_* series of constants should be used.
2738
     *
2739
     * @return array Returns an array with calculated data.
2740
     */
2741
    public function stoch(
2742
        array $high,
2743
        array $low,
2744
        array $close,
2745
        int $fastK_Period = 5,
2746
        int $slowK_Period = 3,
2747
        int $slowK_MAType = 0,
2748
        int $slowD_Period = 3,
2749
        int $slowD_MAType = 0
2750
    ): array {
2751
        $result = trader_stoch(
2752
            $high,
2753
            $low,
2754
            $close,
2755
            $fastK_Period,
2756
            $slowK_Period,
2757
            $slowK_MAType,
2758
            $slowD_Period,
2759
            $slowD_MAType
2760
        );
2761
2762
        $this->handleErrors();
2763
2764
        return $result;
2765
    }
2766
2767
    /**
2768
     * Stochastic Fast.
2769
     *
2770
     * @param array $high         High price, array of real values.
2771
     * @param array $low          Low price, array of real values.
2772
     * @param array $close        Time period for building the Fast-K line. Valid range from 1 to 100000.
2773
     * @param int   $fastK_Period Time period for building the Fast-K line. Valid range from 1 to 100000.
2774
     * @param int   $fastD_Period Smoothing for making the Fast-D line. Valid range from 1 to 100000, usually set to 3.
2775
     * @param int   $fastD_MAType Type of Moving Average for Fast-D. MA_TYPE_* series of constants should be used.
2776
     *
2777
     * @return array Returns an array with calculated data.
2778
     */
2779
    public function stochf(
2780
        array $high,
2781
        array $low,
2782
        array $close,
2783
        int $fastK_Period = 5,
2784
        int $fastD_Period = 3,
2785
        int $fastD_MAType = 0
2786
    ): array {
2787
        $result = trader_stochf(
2788
            $high,
2789
            $low,
2790
            $close,
2791
            $fastK_Period,
2792
            $fastD_Period,
2793
            $fastD_MAType
2794
        );
2795
2796
        $this->handleErrors();
2797
2798
        return $result;
2799
    }
2800
2801
    /**
2802
     * Stochastic Relative Strength Index.
2803
     *
2804
     * @param array $real         Array of real values.
2805
     * @param int   $timePeriod   Number of period. Valid range from 2 to 100000.
2806
     * @param int   $fastK_Period Time period for building the Fast-K line. Valid range from 1 to 100000.
2807
     * @param int   $fastD_Period Smoothing for making the Fast-D line. Valid range from 1 to 100000, usually set to 3.
2808
     * @param int   $fastD_MAType Type of Moving Average for Fast-D. MA_TYPE_* series of constants should be used.
2809
     *
2810
     * @return array Returns an array with calculated data.
2811
     */
2812
    public function stochrsi(
2813
        array $real,
2814
        int $timePeriod = 14,
2815
        int $fastK_Period = 5,
2816
        int $fastD_Period = 3,
2817
        int $fastD_MAType = 0
2818
    ): array {
2819
        $result = trader_stochrsi(
2820
            $real,
2821
            $timePeriod,
2822
            $fastK_Period,
2823
            $fastD_Period,
2824
            $fastD_MAType
2825
        );
2826
2827
        $this->handleErrors();
2828
2829
        return $result;
2830
    }
2831
2832
    /**
2833
     * Vector Arithmetic Subtraction.
2834
     *
2835
     * Calculates the vector subtraction of real1 from real0 and returns the resulting vector.
2836
     *
2837
     * @param array $real0 Array of real values.
2838
     * @param array $real1 Array of real values.
2839
     *
2840
     * @return array Returns an array with calculated data.
2841
     */
2842
    public function sub(array $real0, array $real1): array
2843
    {
2844
        $result = trader_sub($real0, $real1);
2845
2846
        $this->handleErrors();
2847
2848
        return $result;
2849
    }
2850
2851
    /**
2852
     * Summation.
2853
     *
2854
     * @param array $real       Array of real values.
2855
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2856
     *
2857
     * @return array Returns an array with calculated data.
2858
     */
2859
    public function sum(array $real, int $timePeriod = 30): array
2860
    {
2861
        $result = trader_sum($real, $timePeriod);
2862
2863
        $this->handleErrors();
2864
2865
        return $result;
2866
    }
2867
2868
    /**
2869
     * Triple Exponential Moving Average (T3).
2870
     *
2871
     * @param array $real       Array of real values.
2872
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2873
     * @param float $vFactor    Volume Factor. Valid range from 1 to 0.
2874
     *
2875
     * @return array Returns an array with calculated data.
2876
     */
2877
    public function t3(array $real, int $timePeriod = 5, float $vFactor = 0.7): array
2878
    {
2879
        $result = trader_t3($real, $timePeriod, $vFactor);
2880
2881
        $this->handleErrors();
2882
2883
        return $result;
2884
    }
2885
2886
    /**
2887
     * Vector Trigonometric Tan.
2888
     *
2889
     * Calculates the tangent for each value in real and returns the resulting array.
2890
     *
2891
     * @param array $real Array of real values.
2892
     *
2893
     * @return array Returns an array with calculated data.
2894
     */
2895
    public function tan(array $real): array
2896
    {
2897
        $result = trader_tan($real);
2898
2899
        $this->handleErrors();
2900
2901
        return $result;
2902
    }
2903
2904
    /**
2905
     * Vector Trigonometric Tanh.
2906
     *
2907
     * Calculates the hyperbolic tangent for each value in real and returns the resulting array.
2908
     *
2909
     * @param array $real Array of real values.
2910
     *
2911
     * @return array Returns an array with calculated data.
2912
     */
2913
    public function tanh(array $real): array
2914
    {
2915
        $result = trader_tanh($real);
2916
2917
        $this->handleErrors();
2918
2919
        return $result;
2920
    }
2921
2922
    /**
2923
     * Triple Exponential Moving Average.
2924
     *
2925
     * @param array $real       Array of real values.
2926
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2927
     *
2928
     * @return array Returns an array with calculated data.
2929
     */
2930
    public function tema(array $real, int $timePeriod = 30): array
2931
    {
2932
        $result = trader_tema($real, $timePeriod);
2933
2934
        $this->handleErrors();
2935
2936
        return $result;
2937
    }
2938
2939
    /**
2940
     * True Range.
2941
     *
2942
     * @param array $high  High price, array of real values.
2943
     * @param array $low   Low price, array of real values.
2944
     * @param array $close Closing price, array of real values.
2945
     *
2946
     * @return array Returns an array with calculated data.
2947
     */
2948
    public function trange(array $high, array $low, array $close): array
2949
    {
2950
        $result = trader_trange($high, $low, $close);
2951
2952
        $this->handleErrors();
2953
2954
        return $result;
2955
    }
2956
2957
    /**
2958
     * Triangular Moving Average.
2959
     *
2960
     * @param array $real       Array of real values.
2961
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2962
     *
2963
     * @return array Returns an array with calculated data.
2964
     */
2965
    public function trima(array $real, int $timePeriod = 30): array
2966
    {
2967
        $result = trader_trima($real, $timePeriod);
2968
2969
        $this->handleErrors();
2970
2971
        return $result;
2972
    }
2973
2974
    /**
2975
     * 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA.
2976
     *
2977
     * @param array $real       Array of real values.
2978
     * @param int   $timePeriod [OPTIONAL] [DEFAULT 30] Number of period. Valid range from 2 to 100000.
2979
     *
2980
     * @return array Returns an array with calculated data.
2981
     */
2982
    public function trix(array $real, int $timePeriod = 30): array
2983
    {
2984
        $result = trader_trix($real, $timePeriod);
2985
2986
        $this->handleErrors();
2987
2988
        return $result;
2989
    }
2990
2991
    /**
2992
     * Time Series Forecast.
2993
     *
2994
     * @param array $real       Array of real values.
2995
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
2996
     *
2997
     * @return array Returns an array with calculated data.
2998
     */
2999
    public function tsf(array $real, int $timePeriod = 14): array
3000
    {
3001
        $result = trader_tsf($real, $timePeriod);
3002
3003
        $this->handleErrors();
3004
3005
        return $result;
3006
    }
3007
3008
    /**
3009
     * Typical Price.
3010
     *
3011
     * @param array $high  High price, array of real values.
3012
     * @param array $low   Low price, array of real values.
3013
     * @param array $close Closing price, array of real values.
3014
     *
3015
     * @return array Returns an array with calculated data.
3016
     */
3017
    public function typprice(array $high, array $low, array $close): array
3018
    {
3019
        $result = trader_typprice($high, $low, $close);
3020
3021
        $this->handleErrors();
3022
3023
        return $result;
3024
    }
3025
3026
    /**
3027
     * Ultimate Oscillator.
3028
     *
3029
     * @param array $high        High price, array of real values.
3030
     * @param array $low         Low price, array of real values.
3031
     * @param array $close       Closing price, array of real values.
3032
     * @param int   $timePeriod1 Number of bars for 1st period. Valid range from 1 to 100000.
3033
     * @param int   $timePeriod2 Number of bars for 2nd period. Valid range from 1 to 100000.
3034
     * @param int   $timePeriod3 Number of bars for 3rd period. Valid range from 1 to 100000.
3035
     *
3036
     * @return array Returns an array with calculated data.
3037
     */
3038
    public function ultosc(
3039
        array $high,
3040
        array $low,
3041
        array $close,
3042
        int $timePeriod1 = 7,
3043
        int $timePeriod2 = 14,
3044
        int $timePeriod3 = 28
3045
    ): array {
3046
        $result = trader_ultosc($high, $low, $close, $timePeriod1, $timePeriod2, $timePeriod3);
3047
3048
        $this->handleErrors();
3049
3050
        return $result;
3051
    }
3052
3053
    /**
3054
     * Variance.
3055
     *
3056
     * @param array $real       Array of real values.
3057
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
3058
     * @param float $nbDev      Number of deviations
3059
     *
3060
     * @return array Returns an array with calculated data.
3061
     */
3062
    public function var(array $real, int $timePeriod = 5, float $nbDev = 1.0): array
3063
    {
3064
        $result = trader_var($real, $timePeriod, $nbDev);
3065
3066
        $this->handleErrors();
3067
3068
        return $result;
3069
    }
3070
3071
    /**
3072
     * Weighted Close Price.
3073
     *
3074
     * @param array $high  High price, array of real values.
3075
     * @param array $low   Low price, array of real values.
3076
     * @param array $close Closing price, array of real values.
3077
     *
3078
     * @return array Returns an array with calculated data.
3079
     */
3080
    public function wclprice(array $high, array $low, array $close): array
3081
    {
3082
        $result = trader_wclprice($high, $low, $close);
3083
3084
        $this->handleErrors();
3085
3086
        return $result;
3087
    }
3088
3089
    /**
3090
     * Williams' %R.
3091
     *
3092
     * @param array $high       High price, array of real values.
3093
     * @param array $low        Low price, array of real values.
3094
     * @param array $close      Closing price, array of real values.
3095
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
3096
     *
3097
     * @return array Returns an array with calculated data.
3098
     */
3099
    public function willr(array $high, array $low, array $close, int $timePeriod = 14): array
3100
    {
3101
        $result = trader_willr($high, $low, $close, $timePeriod);
3102
3103
        $this->handleErrors();
3104
3105
        return $result;
3106
    }
3107
3108
    /**
3109
     * Weighted Moving Average.
3110
     *
3111
     * @param array $real       Array of real values.
3112
     * @param int   $timePeriod Number of period. Valid range from 2 to 100000.
3113
     *
3114
     * @return array Returns an array with calculated data.
3115
     */
3116
    public function wma(array $real, int $timePeriod = 30): array
3117
    {
3118
        $result = trader_wma($real, $timePeriod);
3119
3120
        $this->handleErrors();
3121
3122
        return $result;
3123
    }
3124
3125
    /**
3126
     * Handle errors.
3127
     *
3128
     * @throws \BadFunctionCallException
3129
     */
3130
    abstract protected function handleErrors();
3131
}
3132