Percent Above 200-Day MA
Install and import
npm install fintech-algorithmsimport { evaluateSnapshot } from "fintech-algorithms/market-breadth-and-internals/high-low-and-trend-breadth/percent-above-200-day-ma";Signature
evaluateSnapshot(snapshot, decisionTime)Worked example
executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.
Input
{
"session_date": "2026-06-30",
"effective_at": "2026-06-30T21:00:00Z",
"available_at": "2026-06-30T21:30:00Z",
"universe_id": "SYNTH-TREND-24",
"universe_revision": "2026-06-30-r1",
"calendar_id": "SYNTH-WEEKDAY",
"price_field": "adjusted_close",
"window_sessions": 200,
"securities": [
{
"security_id": "SYNTH-001",
"member_at_session": true,
"source_evidence_state": "ready",
"available_at": "2026-06-30T21:30:00Z",
"adjustment_basis": "split-adjusted-price-return",
"prices": [50, 50, 50, 50, 50, 50]
},
{
"security_id": "SYNTH-002",
"member_at_session": true,
"source_evidence_state": "ready",
"available_at": "2026-06-30T21:30:00Z",
"adjustment_basis": "split-adjusted-price-return",
"prices": [52, 52, 52, 52, 52, 52]
},
{
"security_id": "SYNTH-003",
"member_at_session": true,
"source_evidence_state": "ready",
"available_at": "2026-06-30T21:30:00Z",
"adjustment_basis": "split-adjusted-price-return",
"prices": [54, 54, 54, 54, 54, 54]
}
]
}"2026-06-30T22:00:00Z"Call
evaluateSnapshot(snapshot, decisionTime)Returns
object with 8 fields: status, reason, window_sessions, eligible_count, above_count, equal_count, percent_above, rows
{
"status": "resolved",
"reason": null,
"window_sessions": 200,
"eligible_count": 24,
"above_count": 15,
"equal_count": 1,
"percent_above": 62.5,
"rows": [
{
"security_id": "SYNTH-001",
"current_price": 60,
"moving_average": 50.05,
"above": true,
"equal": false
},
{
"security_id": "SYNTH-002",
"current_price": 62,
"moving_average": 52.05,
"above": true,
"equal": false
},
{
"security_id": "SYNTH-003",
"current_price": 64,
"moving_average": 54.05,
"above": true,
"equal": false
}
]
}Diagrams
How it works
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References
- Percent Above Moving Average
- Corporate Actions and Events Manual, Equities
- Rolling Mean Documentation
- Evidence decision