Stochastic cross in extremes

Stochastic cross in extremes is an alert that checks every 1 hour, can fire every time its condition is met, waits 3 bars between alerts and shows whe

core language

stochastic-cross-in-extremes.abx
1alert "Stochastic cross in extremes"
2check: every 1h
3repeat: every time
4cooldown: 3 bars
5show_on_chart: true
6
7k_line = stoch().k
8d_line = stoch().d
9
10when crosses_above(k_line, d_line) and k_line < 20:
11notify "Stochastic bullish cross at {k_line:0} on {market.symbol}"
12
13when crosses_below(k_line, d_line) and k_line > 80:
14notify "Stochastic bearish cross at {k_line:0} on {market.symbol}"
What this script says

Stochastic cross in extremes is an alert that checks every 1 hour, can fire every time its condition is met, waits 3 bars between alerts and shows where it fires on the chart.

It calculates k_line as the k of the stochastic and d_line as the d of the stochastic.

When k_line crosses above d_line and k_line is below 20, it sends the notification "Stochastic bullish cross at {k_line:0} on {market.symbol}".

When k_line crosses below d_line and k_line is above 80, it sends the notification "Stochastic bearish cross at {k_line:0} on {market.symbol}".

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account