RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • blsimpv
    • blsprice
    • macd

macd — Compute the Moving Average Convergence/Divergence indicator.

macd(Data) computes the 12-period minus 26-period exponential moving-average line and the 9-period exponential signal line.

Syntax

MACDLine = macd(Data)
[MACDLine, SignalLine] = macd(Data)

Inputs

NameTypeRequiredDefaultDescription
DataAnyYes—Price data as an M-by-4 matrix, table, or timetable.

Returns

NameTypeDescription
MACDLineAnyMoving Average Convergence/Divergence series.
SignalLineAnyNine-period exponential moving average of the MACD line.

Returned values from macd depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:macd:InvalidInputInput is not a numeric M-by-4 matrix or table/timetable with High, Low, Open, and Close variables.macd: invalid input
RunMat:macd:OutputCountMore than two output arguments are requested.macd: too many output arguments
RunMat:macd:InternalOutput construction fails.macd: internal error

How macd works

  • MATLAB-compatible matrix input must be a double M-by-4 array with High, Low, Open, and Close prices in columns 1 through 4.
  • In runmat compatibility mode, raw native-single and integer M-by-4 matrices are accepted as a RunMat extension and computed in the double MACD domain; integer prices that are not exactly representable in binary64 reject before computation.
  • Table and timetable inputs must contain High, Low, Open, and Close variables, matched case-insensitively.
  • Table and timetable High, Low, Open, and Close variables must be numeric M-by-1 vectors. Integer variables use authoritative native storage until a checked binary64 EMA boundary and produce double Close output data.
  • The returned MACDLine and SignalLine preserve the input row count and container type.
  • For table and timetable inputs, outputs contain a Close variable with the computed series.
  • Empty M-by-4 inputs return empty M-by-1 outputs; NaNs propagate through the exponential moving-average recurrence.

Example

Compute MACD and signal line

[m,s] = macd(priceData)

Using macd with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how macd changes the result.

Run a small macd example, explain the result, then change one input and compare the output.

Related Finance functions

blsimpv · blsprice

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how macd is executed, line by line, in Rust.

  • View the source for macd in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How macd works
  • Example
  • Compute MACD and signal line
  • Using macd with coding agents
  • Related Finance functions
  • Open-source implementation
  • About RunMat