79599245

Date: 2025-04-29 21:55:18
Score: 0.5
Natty:
Report link

This still triggers a "too frequent alert" stop sometimes when the market moves extremely fast but for the most part, solves my problem. I had to set to 15 initially but it seems that 14 makes TradingView's limitation happier.

// === Array to store entry timestamps ===
var array<int> entryTimes = array.new_int()

// Detecting a new entry (when total closed + open increases)
var int lastTotalTrades = 0
currentTotalTrades = strategy.closedtrades + strategy.opentrades

if currentTotalTrades > lastTotalTrades
    array.push(entryTimes, time)
    lastTotalTrades := currentTotalTrades
    lastTotalTrades

// Check 14th most recent trade
canTrade = true
if array.size(entryTimes) >= 14
    timeOf14thLastTrade = array.get(entryTimes, array.size(entryTimes) - 14)
    timeSince14thTrade = (time - timeOf14thLastTrade) / 1000 // in seconds
    canTrade := timeSince14thTrade >= 180
    canTrade
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Chris