I would like to have coding for the following :
-
As per Heiken Ashi Candlestick calculation, where open and low are same, I would like to buy
-
Where open and high are same, I would like to sell.
-
Stop loss : lowest low of the last two candles for buy; highest high of the last two candles for sell
-
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.