Loading…

Heikin Ashi Series Exporter

Heikin Ashi smoothing is easy to view on a chart but awkward to get out of the terminal for offline analysis - there is no built-in way to export just the transformed values. This script computes the standard Heikin Ashi open/high/low/ close for a chosen symbol and timeframe's history and writes both the HA values and the source OHLC to one CSV file, so the series can be analysed or re-plotted in a spreadsheet or external tool without hand-recomputing it from raw bars. HA_Open is recursive - each bar's HA_Open depends on the previous bar's HA_Open and HA_Close - so the whole requested range is walked oldest to newest in a single pass and recomputed from scratch every run. There is no persisted running state between runs to drift out of sync if bars are added, removed or the export range changes. Notes and limitations The oldest bar in the exported range seeds HA_Open as the average of that bar's own raw open and close (the standard convention when no earlier HA bar exists) rather than reaching further back into history than InpBarsToExport requests. A smaller InpBarsToExport therefore restarts the recursion from a slightly different seed than a larger one would - the values a few bars into the export can differ marginally from what a chart-attached HA indicator holding a longer running history would show, converging quickly as the series progresses. Export is limited to whatever bar history the terminal currently has loaded for the requested symbol/timeframe; a symbol not already in Market Watch, or a timeframe with thin cached history, may return fewer bars than requested.

Script · MT4 · v1.0 · Free

About Heikin Ashi Series Exporter

Heikin Ashi Series Exporter is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Symbol, Timeframe and Bars to export. MQL source code included.

Files in the download: HeikinAshiExporter.mq4, HeikinAshiExporter.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to export ("" = this chart's symbol)
TimeframePERIOD_CURRENTTimeframe to export
Bars to export500Most recent bars to export (0 = all available)
File nameHeikinAshiExporter.csvOutput file, written into MQL4\Files\

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Heiken Ashi · Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria