Stochastic Stop Entries and Cancellation Alerts in Pine Script
Summary
This example combines a stochastic crossover entry signal with pivot-based stop levels to illustrate pending orders and alert messages for broker execution. A long setup occurs when the stochastic %K crosses above %D below an upper threshold; a short setup uses the opposite crossover above a lower threshold. Entries are stop orders offset from the close, while exits use a pivot-derived stop and a configurable profit target.
The script cancels an unfilled pending order when price crosses the relevant stop level while the strategy is flat, and sends separate alerts for entries and cancellations. Its published test settings specify BTC/USDT futures on Binance over a one-year period using four-hour bars and a 15-minute base period. No performance results are provided. The example focuses on alert and order-handling mechanics, and does not establish profitability or explain how its alert messages should be adapted to a particular broker.
Key ideas
- Stochastic crossovers below or above threshold levels trigger long or short stop entries.
- Pivot highs and lows define stop levels for the corresponding positions.
- Pending entry orders are canceled when price crosses the stop level while the strategy is flat.
- Separate alerts communicate entry parameters and pending-order cancellation events.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.