TradeZoro
Notifications

Cookbook

Trend filter background

Green when above a long average, red when below.

//@zscript 1
indicator("Trend filter", overlay=true)
len = input.int(100, "Length")
a = ta.sma(close, len)
plot(a, "Average", color=color.gray)
bgcolor(close > a ? color.new(color.green, 94) : color.new(color.red, 94))
50365042504850535059
Sample bars, not market data. Trend filter.

How it works

The simplest possible regime filter.

Education only. Not financial advice. Examples are teaching samples, not trading results.

Zscript is coming soon

The manual opens when Zscript launches.

Back to home