# Slow Stoch Indicator inspired by BreakpointTrades.com
# Written by Matt Ward
#######################################################
# Version 1.0 3/17/21
# It triggers on two conditions. The first is when the slow stoch is above "bull upper" (default 80)
# and the fast stock crosses below "bull lower" (default 20). The second is when the slow stoch is
# below "bear lower" (default 20) and the fast stoch crosses above "bear upper" (default 80). You can
# change the stoch speeds using the inputs "fast stoch" (default 10) and "slow stoch" (default 60).
#######################################################
# Version 1.1 3/21/21
# Added Alerts. If the alerts are turned on then and the script triggers then it will write to the
# Message Center and play a sound. You can chose which sound on the settings screen
# The way I use this is to have a 2x2 chart window open with 5 min charts for the SPY, QQQ, IWM and DIA.
# This way I get a real time alert when the trigger conditions are met.
#######################################################
Input FastStoch = 10;
Input SlowStoch = 60;
Input BullUpper = 80;
Input BullLower = 20;
Input BearUpper = 80;
Input BearLower = 20;
Input AlertsOn = yes;
Input AlertSound = Sound.DING;
def StochSlowSlow = StochasticSlow(80,20,SlowStoch,3,high,low,close,AverageType.SIMPLE).SlowK;
def StochSlowFast = StochasticSlow(80,20,FastStoch,3,high,low,close,AverageType.SIMPLE).SlowK;
def BullCondition = StochSlowSlow >= BullUpper && (StochasticSlow(80,20,FastStoch,3,high,low,close,AverageType.SIMPLE).SlowK) crosses below BullLower;
def BearCondition = StochSlowSlow <= BearLower && (StochasticSlow(80,20,FastStoch,3,high,low,close,AverageType.SIMPLE).SlowK) crosses above BearUpper;
plot Bear = BearCondition;
Bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bear.SetDefaultColor(COLOR.RED);
plot Bull = BullCondition;
Bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bull.SetDefaultColor(COLOR.GREEN);
Alert( if AlertsOn and BearCondition then yes else no, "MBW BPT Slow stoch Bear Condition", Alert.BAR, AlertSound);
Alert(if AlertsOn and BullCondition then yes else no, "MBW BPT Slow Stoch Bull Condition", Alert.BAR, AlertSound);