Skip to content
All library documents

Adding Custom Moving-Average Blocks to a Visual Strategy Editor

Article FMZ digest · Author: 发明者量化-小小梦

Summary

This tutorial explains how to extend a visual strategy editor with custom modules by defining blocks in a JavaScript template. It uses a built-in trading library as an example of the block definition format, then walks through adding a simple test block and a moving-average block. The definitions specify the block’s display text, input fields, output type, and the JavaScript expression generated when the block is used.

The moving-average example retrieves market records, checks that enough data is available for the requested period, and then calls the platform’s technical-analysis function. The article says to save the template and enable it in the strategy before using the new blocks; screenshots illustrate the resulting modules and output. This is a platform-specific implementation guide rather than a trading-method evaluation. It demonstrates the mechanics of defining and using a custom indicator block, but gives no assessment of data reliability, error handling beyond the record-length check, or trading performance.

Key ideas

  • Custom visual modules can be defined in a JavaScript template using block metadata and a generated code expression.
  • A block definition can specify its label, inputs, output type, and execution template.
  • The example moving-average block fetches market records and checks that enough observations exist before calculating the indicator.
  • A saved template must be enabled in the strategy before its custom blocks become available.
  • The tutorial demonstrates platform mechanics and does not evaluate a trading strategy or its performance.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.