M Language Basics for Futures and Cryptocurrency Trading Scripts
Summary
This tutorial introduces the M Language used in a trading platform to write indicators and trading logic for commodity futures and cryptocurrency contracts. It explains scalar and sequence data, numeric, string, and Boolean values, variable naming, and assignment conventions. It also describes arithmetic, comparison, and logical operators, plus how functions accept parameters and return values, using moving averages of closing prices as an example.
The document also catalogs trading-related data and platform functions, including account balances, margin, available spot currency, and tick-level bid and ask prices and sizes. Its examples show how scripts can reference price series, calculate indicators, emit logs, and size a position as a fraction of account equity. This is reference material for understanding the platform’s scripting interface rather than a trading strategy or empirical study. The available text is incomplete, includes platform-specific terminology, and does not establish that its examples are valid across systems or contract types.
Key ideas
- M Language distinguishes single values from sequences such as a series of closing prices.
- Assignment operators determine whether a value is hidden, plotted, or displayed in a status area.
- Conditions use Boolean results, while arithmetic operators return numeric values.
- Functions such as a moving average take data and period parameters and return a result that can be stored.
- The reference describes access to account, margin, and tick quote data for futures and cryptocurrency contracts.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.