Need heiken ashi code

Hi, I need heiken ashi code for simple buy and sell signal… 1.It should buy if current heiken ashi candle closes in green 2…It should sell if current heiken ashi closes in red

please refer below link for the relevant answer

http://tradingqna.com/31314/need-codes-for-heikin-ashi-close-and-ema