A dunce by the name of Don Steintz wasted a few months of peoples time fannying around with the idea a couple of years ago, and there are threads on practically every trading forum on planet earth. The fisaco started at FF, so its as good a starting point as any
The first post has executable versions of the indicator, but source code is also available within the thread. Forex-TSD probably has several hundred versions of the same garbage indicator (which is nothing more than a moving average cross anyway !)
Surely there must be better ways to waste your time than fannying about with heiken ashi ?