Skip to content
All library documents

Debugging a Multi-Asset Moving Average and CCI Alert Strategy

Article FMZ forum · Author: ewang23

Summary

This post shares a tick-driven script intended to send alerts when a bar crosses above a 200-period moving average after price was below it, with CCI above a threshold. It checks multiple crypto symbols and timeframes, waits for a new bar, then logs a message intended for WeChat delivery. The post asks why backtests produce no alerts and live trading reports errors; it does not include a diagnosis or verified fix.

The code keeps a per-symbol state flag to remember that price was below the moving average. It also contains a commented-out profit-taking routine, but no active order placement or backtest results. Potential behavior depends on platform-specific functions, data handling, threshold parameters, and whether the alert integration is configured. The snippet therefore illustrates a signal concept and debugging context rather than evidence that the strategy works.

Key ideas

  • The alert condition combines a prior below-average state, a current open above the moving average, and CCI above a threshold.
  • The script evaluates signals only when it detects a newly formed bar.
  • A state array tracks the below-average condition separately for each symbol.
  • The post reports missing backtest alerts and live errors but gives no confirmed cause or remedy.

Tags

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