Coding for Heiken Ashi

I would like to have coding for the following :

  1. As per Heiken Ashi Candlestick calculation, where open and low are same, I would like to buy

  2. Where open and high are same, I would like to sell.

  3. Stop loss : lowest low of the last two candles for buy; highest high of the last two candles for sell

  4. Profit target - 2.5 : 1

Is it possible?

If it is not possible to create full coding, atleast can i get coding for buy and sell signals alone?

Hello here is the code for your strategy. I have tried it out with the standard candle stick.

Buy expression: open=low

Sell expression: open=high

The stop loss expression you can place in exit buy/sell

Exit buy: last < ref(low, 1)

Exit sell: last > ref(high, 1)

You can try out this.

BUY
SET HC = (OPEN+HIGH+LOW+CLOSE)/4

SET HO = (REF(OPEN,1) + REF(CLOSE,1))/2

SET HH = MAXOF(HIGH, MAXOF(HC, HO))

SET HW = MINOF(LOW, HO, HC)

HO = HW

SELL

SET HC = (OPEN+HIGH+LOW+CLOSE)/4

SET HO = (REF(OPEN,1) + REF(CLOSE,1))/2

SET HH = MAXOF(HIGH, MAXOF(HC, HO))

SET HW = MINOF(LOW, HO, HC)

HH = HO

please specify the platform for which you need code

the platform is Zerodha trader and PI in future.