admin管理员组

文章数量:1124161

I have a few different alerts running in TradingView using PineScript v5 which often get stopped due to being triggered too frequently. I believe TradingView limits alerts to 15 within a 3 minute period. Is it possible to add something to my strategy to where it will not trigger an alert if the oldest alert (15th) was less than 3 minutes ago?

I’m very novice when it comes to PineScript, or really any language for that matter. I understand how to look back 15 bars but don’t quite get how to look back 15 alerts. Below is a sample code which would trigger more frequently than TradingView allows. On a normal candle chart, this isn't an issue because the data is time based. I run into this issue when using non standard charts such as renko which are price based and can print multiple bricks within a matter of seconds during large market moves.

//@version=5
strategy(title="Close Over Under High Low", overlay = true)

//Order Entry Parameters
validLong = close > high[1]
validShort = close < low[1]
  
// Enter trades whenever a valid setup is detected
if validLong
    strategy.entry(id='Long', direction=strategy.long, when=validLong)
    alert('buy', alert.freq_once_per_bar)
if validShort
    strategy.entry(id='Short', direction=strategy.short, when=validShort)
    alert('sell', alert.freq_once_per_bar)

本文标签: pine scriptTradingViewLimit trades based on timeStack Overflow