PHPackages                             romulodl/macd - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. romulodl/macd

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

romulodl/macd
=============

MACD without the PECL trader extension

v3.0.0(5y ago)125261[3 issues](https://github.com/romulodl/macd/issues)[1 PRs](https://github.com/romulodl/macd/pulls)1Apache-2.0PHPCI passing

Since May 27Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/romulodl/macd)[ Packagist](https://packagist.org/packages/romulodl/macd)[ RSS](/packages/romulodl-macd/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (2)Versions (6)Used By (1)

Moving Average Convergence/Divergence
=====================================

[](#moving-average-convergencedivergence)

Calculate the MACD of giving values.

[![Ema](https://github.com/romulodl/macd/workflows/Macd/badge.svg)](https://github.com/romulodl/macd/workflows/Macd/badge.svg)

Instalation
-----------

[](#instalation)

```
composer require romulodl/macd

```

or add `romulodl/macd` to your `composer.json`. Please check the latest version in releases.

Usage
-----

[](#usage)

```
$macd = new Romulodl\Macd();
$macd->calculate(array $values, int $short_period = 12, int $long_period = 26, int $signal_period = 9);
//returns an array values with the macd and signals
//for example
//
[
  [
    100, // macd value
    90 // signal value
  ],
  [
    99, //macd value from the previous candle
    89 // signal value from the previous candle
  ]
]
```

For example:

```
$macd = new Romulodl\Macd();
$macd->calculate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]);
```

Why did you do this?
--------------------

[](#why-did-you-do-this)

The PECL Trading extension is crap and not everyone wants to install it. I am building a trading bot and building more complex trading indicators that uses the MACD as a basic step.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance56

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~138 days

Total

3

Last Release

1907d ago

Major Versions

v1.0.0 → v2.0.02020-05-28

v2.0.0 → v3.0.02021-02-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/727de2473b3f8e612546e83f5831779cd5928b4af8ed6ca3f91a533b522b7a0a?d=identicon)[romulodl](/maintainers/romulodl)

---

Top Contributors

[![romulodl](https://avatars.githubusercontent.com/u/922624?v=4)](https://github.com/romulodl "romulodl (4 commits)")

---

Tags

macdtradetrading

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/romulodl-macd/health.svg)

```
[![Health](https://phpackages.com/badges/romulodl-macd/health.svg)](https://phpackages.com/packages/romulodl-macd)
```

###  Alternatives

[label84/laravel-hours-helper

Creates a Collection of times with a given interval.

27591.2k](/packages/label84-laravel-hours-helper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
