# Time filters and visual debugging

> Limit trading to chosen hours and draw lines, arrows and histograms to check what the graph does.

Source: https://quantraider.com/learn/strategy-builder/time-and-visuals

Course: Building strategies as node graphs (lesson 4 of 5) · Level: Intermediate · 4 min

A graph can look correct and still do something unexpected. You will learn to limit trading to chosen hours with the `Time` node and to draw lines, arrows and histograms so you can see what each part of the graph does.

## Limiting trading to a time window

Many strategies only make sense in certain sessions, because volume and spreads differ across the day. The `Time` node has one input, `Time`, which you connect to `Data.Time`, and one boolean output, `Active`. `Active` is true on candles inside the schedule you configure.

- **Schedule**: `At or after` is active from the start time onwards, and `Time range` is active between a start and an end.
- **Start** is inclusive and **end** is exclusive, so a range of 08:00 to 17:00 includes 08:00 and excludes 17:00.
- **Timezone** sets how clock times are read, and the session start days choose which days the schedule applies to.

To use it, combine `Active` with your entry condition using `And`: the trigger is then true only when the setup occurs and the time is allowed. Put the combined result into `Trigger`.

**Worked example: Filtering a crossing with a time range**

1. Set the `Time` node to the range 08:00 to 17:00 in UTC on weekdays, and `And` its `Active` output with the crossing trigger.
2. A crossing occurs on a candle stamped 06:00. `Active` is false, so the trigger is false.
3. A second crossing occurs on a candle stamped 09:00. `Active` is true, so the trigger is true.
4. A third crossing occurs on a candle stamped 17:00. The end is exclusive, so `Active` is false and the trigger is false.

Of three crossings, only one (09:00) becomes a trade entry; with hourly candles stamped at their start, the window contains 9 candles per day, from 08:00 to 16:00.

A time filter is also a parameter you can tune to history. Choose hours for a reason, such as when your market is most active, and check that results do not depend on one particular hour.

## Drawing what the graph sees

Three visualisation nodes draw on the chart, in panes of their own where the scale differs from price. Each has a colour setting, and `VisualizeArrow` also has a position setting such as above the bar.

- `VisualizeLine` takes `Data`, a number, and draws it as a line. Use it for `SMA`, `EMA`, `RSI`, `ATR` or any computed price such as a stop.
- `VisualizeArrow` takes `Signal`, a boolean, and draws an arrow on every candle where it is true. Use it on the trigger to see where the graph would enter.
- `VisualizeHistogram` takes `Data` and draws bars, for example the `Histogram` output of `MACD`.

A good habit is to draw both averages with `VisualizeLine`, the trigger with `VisualizeArrow`, and the stop and target prices as lines. If an arrow appears where there is no visible crossing, or a stop line sits on the wrong side of price, the graph is wrong and the picture tells you where to look.

## Checking trades in the replay

After the visual check, run a backtest and open the **Backtest** tab. It replays the historical candles and shows trades on the chart one by one, with drawing tools. Step through the first trades and compare each entry, stop and target with what you intended.

1. Pick several trades from different market conditions, not only the best ones.
2. Check that each entry candle really is a crossing and is inside the allowed hours.
3. Check that stops and targets are on the correct sides and at the distances you expect.
4. Fix the graph, rerun and look again before reading any performance numbers.

> **Look before you measure**
>
> Performance statistics from a graph that does not do what you think are meaningless. Verifying a handful of trades visually is cheap and catches most wiring mistakes.

> **Debug a graph visually**: Add `VisualizeLine` nodes for your indicators and a `VisualizeArrow` node on the trigger, then check the result on the chart. [Open the graph editor](https://quantraider.com/nodesystem)

## Key takeaways

- The `Time` node outputs `Active` for a configured window, with an inclusive start and an exclusive end, and combining it with `And` limits when entries can fire.
- `VisualizeLine`, `VisualizeArrow` and `VisualizeHistogram` draw indicator values, boolean signals and bars on the chart.
- Draw the trigger and the stop and target prices to catch wiring mistakes early.
- Step through trades in the Backtest tab replay before reading any performance statistics.

> Educational content, not financial advice. Trading involves risk of loss.
