RSI Stochastic Strategy

3L10Ns

New member
I stumbled across a 10-15 minute RSI Stochastic strategy that was posted on Tradingview, I set it up and it appears to give some good entries.

10 min to 15 min (works best) RSI Stoch Strategy: https://www.tradingview.com/chart/EURUSD/g4plwjJq-10-min-to-15-min-works-best-RSI-Stoch-Strategy/

So I figured I would start trying convert the built-in Indicator in TOS, not getting consistent alerts when oversold / Overbought are crossed.

1. Anyone know if this has already been composed?
2. My Noob code to follow..
 

BenTen

Administrative
Staff member
Staff
VIP
ThinkorSwim already provides you with their Stochastic Crossover indicator. Here is the code:

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2009-2020
#

#wizard input: stochasticMode
#wizard text: crosses
#wizard input: crossingType
#wizard text: Inputs: k period:
#wizard input: KPeriod

input KPeriod = 14;
input stochasticMode = {default StochasticFast, StochasticSlow};
input crossingType = {default Overbought, Oversold};

def stochastic;
switch (stochasticMode) {
case StochasticFast:
    stochastic = StochasticFull(KPeriod = KPeriod, slowing_period = 1).FullK;
case StochasticSlow:
    stochastic = StochasticFull(KPeriod = KPeriod, slowing_period = 3).FullK;
}

plot signal;
switch (crossingType) {
case Overbought:
    signal = crosses(stochastic, 80, CrossingDirection.Above);
case Oversold:
    signal = crosses(stochastic, 20, CrossingDirection.Below);
}

signal.DefineColor("OverBought", GetColor(1));
signal.DefineColor("OverSold", GetColor(9));
signal.AssignValueColor(if crossingType == CrossingType.oversold then signal.color("oversold") else signal.color("overbought"));
signal.SetPaintingStrategy(if crossingType == CrossingType.Oversold
      then PaintingStrategy.BOOLEAN_ARROW_UP
      else PaintingStrategy.BOOLEAN_ARROW_DOWN);

You can start building on top of that.
 

rad14733

Well-known member
VIP
I played with this strategy several months ago... Not sure if I have any code or notes kicking around but I know there are several YouTube videos on the subject... That was where I got my inspiration... 💡

Post what you have and we'll go from there... (y)
 

3L10Ns

New member
Rich (BB code):
#
# RSI_Stochastic_1min_Dev001
#

declare lower;

input RSI_length = 4;
input over_bought = 75;
input over_sold = 25;
input RSI_average_type = AverageType.WILDERS;
input RSI_price = close;
input KPeriod = 5;
input DPeriod = 3;
input slowing_period = 3;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK & RSI_"};

def RSI = RSI(price = RSI_price, length = RSI_length, averageType = RSI_average_type);

plot FullK = StochasticFull(over_bought, over_sold, KPeriod, DPeriod, RSI, RSI, RSI, slowing_period, averageType).FullK;
def FullD = StochasticFull(over_bought, over_sold, KPeriod, DPeriod, RSI, RSI, RSI, slowing_period, averageType).FullD;
plot OverBought = over_bought;
plot RSI_ = RSI ;
plot OverSold = over_sold;

def upK = FullK crosses above OverSold;
def upD = FullD crosses above OverSold;
def downK = FullK crosses below OverBought;
def downD = FullD crosses below OverBought;
def downRSI = RSI_ crosses below OverBought;
def upRSI = RSI_ crosses above OverSold;

plot UpSignal;
plot DownSignal;
switch (showBreakoutSignals) {
case "No":
    UpSignal = Double.NaN;
    DownSignal = Double.NaN;
#case "On FullK":
    #UpSignal = if upK then OverSold else Double.NaN;
    #DownSignal = if downK then OverBought else Double.NaN;
#case "On FullD":
   # UpSignal = if upD then OverSold else Double.NaN;
   # DownSignal = if downD then OverBought else Double.NaN;
case "On FullK & RSI_":
    UpSignal = if upK and upRSI then OverSold else Double.NaN;
    DownSignal = if downK and downrsi then OverBought else Double.NaN;
}

UpSignal.SetHiding(showBreakoutSignals == showBreakoutSignals."No");
DownSignal.SetHiding(showBreakoutSignals == showBreakoutSignals."No");

FullK.SetDefaultColor(GetColor(5));
#FullD.SetDefaultColor(GetColor(0));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
 

Similar threads

Top