Since Block: Complete Guide to Time-Based Logic in Algorithmic Trading

The Since block is a timing utility in Arrow Algo that counts the number of bars elapsed since a condition was last true. It sounds simple — and it is — but the Since block solves one of the most common and costly problems in systematic strategy design: unwanted re-entries and poorly timed signal sequences.

What Does the Since Block Do?

The Since block takes a boolean input — any condition that produces a true or false value — and outputs a running count of how many bars have passed since that condition was last true.

When the input condition fires (becomes true), the Since block resets its count to zero. On the next bar, it reads 1. The bar after that, 2. And so on — incrementing by one every bar until the condition fires again and resets to zero.

This creates a simple, precise answer to the question: “How long ago did this happen?” — measured not in time but in bars, which is the native unit of measurement in any bar-based trading strategy.

The Since block is part of Arrow Algo’s logic utility layer alongside the Crossover block and the Lag block. Where Crossover detects when a condition changes state, and Lag reads what a value was N bars ago, Since measures how long since a condition last triggered.

How Does the Since Block Output Work?

Understanding the output values is critical to using the Since block correctly.

Output = 0: The input condition is true on this bar — it fired right now. A Since output of 0 means the event is happening in the current bar.

Output = 1: The condition was true on the previous bar. One bar has elapsed since it fired.

Output = N: N bars have elapsed since the condition last fired.

The count increments every bar as long as the condition remains false. If the condition has never fired within the lookback window, the Since block returns a large number — effectively “a very long time ago.” This behaviour means you can use Since both to check recency (“did this happen recently?”) and to enforce a minimum gap (“has enough time passed since this happened?”).

One subtlety worth noting: if the condition fires on two consecutive bars, Since reads 0 on the first, resets to 0 on the second, and then begins counting again from 0 on the third bar. The count reflects the most recent trigger only.

When Should You Use the Since Block?

The Since block is most useful in three specific situations.

Re-entry prevention: A strategy fires a buy signal. The market consolidates for a few bars, the signal fires again, the strategy re-enters. And again. And again. Without a cooldown, many signal types will cluster — producing multiple entries in rapid succession during volatile conditions where a single entry was intended. The Since block puts a minimum bar gap between entries.

Recency filters: Some signals are only meaningful if they occurred recently. An RSI crossover that happened 20 bars ago is stale information. A Since block lets you check whether the crossover occurred within the last 3–5 bars before confirming an entry. This turns a raw signal into a time-validated signal.

Time-based exits: Some strategies benefit from a maximum trade duration. If a position has been open for more than N bars without hitting its target, closing it avoids holding a stagnant trade through a regime change. Combining Since with a trade-open condition creates a duration-based exit.

Three Ways to Apply the Since Block in Systematic Strategies

1. Entry cooldown
Connect your entry signal to a Since block. Add a condition block checking whether the Since output is greater than a minimum threshold — for example, greater than 10 bars. Connect this condition to an AND gate alongside the original entry signal. The strategy now requires both the entry signal to be true AND at least 10 bars to have elapsed since the last entry. Cluster entries become impossible.

2. Signal recency confirmation
Take a momentum signal — an EMA crossover, a Stochastic crossover, an RSI threshold breach. Connect that signal to a Since block. Add a condition checking whether Since is less than 5 (the signal fired within the last 5 bars). Connect this to your AND gate alongside current market conditions. The strategy only enters when the signal is fresh — not when it fired 15 bars ago and price has already moved significantly.

3. Maximum trade duration exit
Connect your position-open condition to a Since block. Add a condition checking whether Since is greater than your maximum duration — for example, 20 bars. Connect this to a Sell block. If the trade has been running for more than 20 bars without hitting its take-profit or stop-loss, it closes automatically. This prevents capital from being locked in a stagnant trade through changing market conditions.

Where the Since Block Goes Wrong

Confusing Since output = 0 with “no signal.” Since outputs 0 when the condition fires on the current bar — not when it has never fired. A condition checking Since > 0 will be true even when the signal just fired. For a cooldown that excludes the current bar, check Since > 1, not Since > 0.

Setting the cooldown too long for the strategy’s timeframe. A 10-bar cooldown on a 1-minute chart is very different from a 10-bar cooldown on a daily chart. Match the cooldown period to the typical trade duration and signal frequency for your specific strategy and timeframe. Back-test with different cooldown values to find the setting that reduces cluster entries without eliminating valid re-entries after genuine setups.

Using Since as a substitute for a proper exit strategy. A duration-based exit using Since is a useful safety net — not a primary exit strategy. Relying solely on “exit after N bars” means the exit timing has no relationship to market conditions. Use Since as a fallback exit alongside price-based stops and targets, not instead of them.

Forgetting that Since resets on every trigger. If your entry signal fires frequently, Since will reset often and the cooldown may rarely be active. Check how often the input condition fires before deciding on a cooldown length — a condition that fires every 2 bars needs a different approach than one that fires every 20 bars.

Adding the Since Block to Your Arrow Algo Strategy

In Arrow Algo’s visual block builder, the Since block appears in the logic utility section. Drag it onto your canvas and connect your chosen condition block to its input. The output slot produces the bar count, which you connect to a threshold comparison block.

To build an entry cooldown, wire it as follows: connect your entry signal output to the Since block input. Connect the Since output to a Greater Than block set to your chosen minimum gap (for example, 10). Connect the Greater Than block’s output to an AND gate alongside your original entry signal. That AND gate output connects to your Buy block. The cooldown is now active.

To build a recency filter, connect your signal to Since and use a Less Than block instead — checking whether Since is less than your recency window (for example, 3). Combine with other entry conditions in an AND gate.

Both setups take under two minutes to build on the canvas and require no code at any stage.

Key Takeaways

  • The Since block counts how many bars have elapsed since a condition last fired — output 0 means it fired this bar, output N means N bars have passed
  • Use it for three core purposes: entry cooldowns (prevent cluster entries), recency filters (confirm a signal is still fresh), and maximum duration exits (close stagnant trades)
  • Always match the cooldown or recency window to the typical signal frequency of your strategy and the timeframe you are trading
  • Since output = 0 means the condition fired now — use Since > 1 (not > 0) if you want to exclude the current firing bar from your cooldown check
  • Arrow Algo includes Since as a native block — wire it directly into your existing strategy canvas without writing any code

Disclaimer: This content is for educational purposes only and does not constitute financial advice. Trading involves significant risk and you should only trade with capital you can afford to lose. Past performance is not indicative of future results. Always conduct your own research before making any trading decisions.

Ready to build your own automated trading strategies without writing a single line of code? Start for free at Arrow Algo and join thousands of traders who’ve made the switch to systematic trading.

About the Author

Author Bio