Porting a MyLanguage WaveTrend Strategy to JavaScript
Summary
This tutorial explains how to translate a MyLanguage crossover strategy into JavaScript. The example calculates a WaveTrend-style oscillator from typical price using exponential averages, then smooths it with MyLanguage’s weighted SMA. Because the platform’s available SMA functions do not match that definition, the article implements the recursive weighted average directly. It also walks through building aligned arrays for intermediate calculations and handling invalid or insufficient indicator data.
The entry and exit logic uses crossings between the oscillator and its smoother, with the prior-bar signal timing carried into the JavaScript state machine. The article compares the original and ported strategy in backtests and explains how the framework processes bars, but it provides no numerical performance analysis in the text. Accurate porting depends on matching indicator definitions, signal timing, and data alignment; the described approach is an implementation tutorial, not evidence that the strategy is profitable.
Key ideas
- The example strategy derives a WaveTrend-style oscillator from typical price and exponential averages.
- MyLanguage’s weighted SMA differs from a simple moving average, so the tutorial implements it separately.
- Intermediate indicator arrays must remain aligned, with invalid values handled explicitly.
- Crossover signals use prior-bar timing, which must be preserved when translating strategy behavior.
- The article compares backtest runs but does not report quantitative performance conclusions.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.