Skip to content
All library documents

Heikin Ashi Candle Direction Strategy with Optional Risk Exits

Article Strategy library · Author: markontie

Summary

This script uses the direction of Heikin Ashi candles on a selectable timeframe to set a simple trade bias. In buy-only mode, a bullish candle opens a long when no long is held, and a bearish candle closes it. In sell-only mode, a bearish candle opens a short and a bullish candle closes it. The script also offers a date filter, stop-loss and take-profit inputs, and chart markers for signals.

The displayed code supplies example settings, including a daily Heikin Ashi timeframe and percentage-based exits, but the excerpt ends partway through its plotting logic and provides no backtest results. The stop and target orders are linked to the long entry, so the shown risk exits do not cover the sell-only short mode. In addition, the higher-timeframe series uses lookahead enabled, which can expose future bar information in historical calculations and make apparent backtest behavior unreliable. The code therefore describes a basic directional rule, but the excerpt does not establish its performance or a sound validation method.

Key ideas

  • Bullish and bearish Heikin Ashi candle direction determines entries and exits.
  • The strategy can be configured for long-only or short-only trading and includes a date window.
  • Stop-loss and take-profit orders in the shown code are attached to the long entry only.
  • The higher-timeframe data request enables lookahead, which can distort historical signal timing.
  • The excerpt contains no reported performance evidence and is cut off before the script ends.

Tags

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