0

this is my entry condition

if buyConditionB and testPeriod
    strategy.entry("Long", strategy.long, qty=buyQty)
    alert('{"CustomId": "456","BuySide": "Long"}',freq=alert.freq_all)

if buyConditionS and testPeriod
    strategy.entry("Short", strategy.short, qty=buyQty)
    alert('{"CustomId": "123","BuySide": "Short"}',freq=alert.freq_all)

but seems it trigger alert from HA and normal candle if have buy or sell signal.

How to ensure i just want to receive HA signal only. (i created alert using HA cannot fix this issue)

Top Mix
  • 3
  • 1

1 Answers1

0

You need to make sure you get all your values from the Heikin Ashi chart. To do that, you need to create a new ticker id based on Heikin Ashi candles.

After that, you need to use the request.security() function to get data from the Heikin Ashi candles.

ha_ticker = ticker.heikinashi(syminfo.tickerid)
[buyConditionB_ha, buyConditionS_ha, testPeriod_ha] = request.security(ha_ticker, timeframe.period, [buyConditionB, buyConditionS, testPeriod])
vitruvius
  • 15,740
  • 3
  • 16
  • 26
  • please guide me how to create new ticket id based on HA candles? is this follow your comment above? something like this ha_low1 = request.security(ticker.heikinashi(syminfo.tickerid),timeframe.period,low[1]) all open/low/high/close using request.security() method – Top Mix Jun 25 '23 at 07:12
  • It is already in my code exmaple. The very first line. – vitruvius Jun 25 '23 at 07:41