#
# 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);