Hi. Tried on my own but still can’t get what I’m looking for. This is an entry signal I use for options scalping on a 2min chart. Looks to be STC based, from my little knowledge.
TOS script:
input fastLength = 6;
input slowLength = 50;
input kperiod = 10;
input dperiod = 3;
input overboughtLevel = 75;
input oversoldLevel = 15;
def STC = SchaffTrendCycle(“fast length” = fastLength, “slow length” = slowLength, “k period” = kperiod, “dperiod” = dperiod);
def STCCrossAboveOversold = STC > oversoldLevel and STC[1] <= oversoldLevel;
plot UpArrow = if STCCrossAboveOversold then low - 2 else Double.NaN;
UpArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
UpArrow.SetLineWeight(1);
UpArrow.SetDefaultColor(Color.UPTICK);
______________________________________________________
Not sure if needed or not, but here is the TOS STC script, incase its useful from the above reference:
declare lower;
input fastLength = 23;
input slowLength = 50;
input KPeriod = 10;
input DPeriod = 3;
input over_bought = 75;
input over_sold = 25;
input averageType = AverageType.EXPONENTIAL;
def macd = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
def fastK1 = FastKCustom(macd, KPeriod);
def fastD1 = MovingAverage(averageType, fastK1, DPeriod);
def fastK2 = FastKCustom(fastD1, KPeriod);
plot STC = MovingAverage(averageType, fastK2, DPeriod);
plot OverBought = over_bought;
plot OverSold = over_sold;
STC.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(7));
OverSold.SetDefaultColor(GetColor(7));
This is a pretty solid signal. Have used it successfully for months. Works very well trading SPX options in particular.
Forgot to attach a screenshot of signals.
Thanks!
It occasionally throws false signals, but I use other indicators and price action to minimize poor entries.
This is the oscillator:
//---------------------------------------------------------//
//PRC_Trend Cycle STC
//version = 0
//20.02.2025
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//---------------------------------------------------------//
// Inputs
//---------------------------------------------------------//
fastLength = 23 // Fast moving average length (MACD)
slowLength = 50 // Slow moving average length (MACD)
KPeriod = 10 // %K period for stochastic
DPeriod = 3 // %D period for stochastic smoothing
overBought = 75 // Overbought level
overSold = 25 // Oversold level
averageType = 1 // Type of moving average used in calculations
//---------------------------------------------------------//
// MACD Calculation
//---------------------------------------------------------//
mymacd= average[fastLength,averageType](close)-average[slowLength,averageType](close)
// First Stochastic Stage on MACD
LowestMACD = LOWEST[ KPeriod ](mymacd)
HighestMACD = HIGHEST[ KPeriod ](mymacd)
IF HighestMACD - LowestMACD <> 0 THEN
FastK1 = ((mymacd - LowestMACD) / (HighestMACD - LowestMACD)) * 100
ELSE
FastK1 = 0
ENDIF
FastD1 = AVERAGE[DPeriod,averageType](FastK1) // Smoothed FastK1
// Second Stochastic Stage on FastD1
LowestFastD1 = LOWEST[KPeriod](FastD1)
HighestFastD1 = HIGHEST[KPeriod](FastD1)
IF HighestFastD1 - LowestFastD1 <> 0 THEN
FastK2 = ((FastD1 - LowestFastD1) / (HighestFastD1 - LowestFastD1)) * 100
ELSE
FastK2 = 0
ENDIF
// Final STC Calculation
STC = AVERAGE[DPeriod,averageType](FastK2)
//---------------------------------------------------------//
// Plot
//---------------------------------------------------------//
// Detection of Crossovers from the Oversold Zone
STCCrossAboveOversold = STC crosses over Oversold
if STCCrossAboveOversold then
drawpoint(barindex,STC,5)coloured("green",40)
drawpoint(barindex,STC,2)coloured("green",200)
endif
// Color Assignment
IF STC > OverBought THEN
r = 255
g = 0
b = 0 // Red for overbought
ELSIF STC < OverSold THEN
r = 0
g = 255
b = 0 // Green for oversold
ELSE
r = 128
g = 128
b = 128 // Grey for neutral zone
ENDIF
//---------------------------------------------------------//
// Return Oscillator below price
//---------------------------------------------------------//
RETURN STC AS "STC Oscilador" COLOURED(r,g,b) STYLE(LINE,2), OverBought AS "Sobrecompra" COLOURED("red") STYLE(dottedline), OverSold AS "Sobreventa" COLOURED("green") STYLE(dottedline)
And this is the indicator to be inserted on price chart:
//---------------------------------------------------------//
//PRC_Trend Cycle STC
//version = 0
//20.02.2025
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//---------------------------------------------------------//
// Inputs
//---------------------------------------------------------//
fastLength = 23 // Fast moving average length (MACD)
slowLength = 50 // Slow moving average length (MACD)
KPeriod = 10 // %K period for stochastic
DPeriod = 3 // %D period for stochastic smoothing
overBought = 75 // Overbought level
overSold = 25 // Oversold level
averageType = 1 // Type of moving average used in calculations
//---------------------------------------------------------//
// MACD Calculation
//---------------------------------------------------------//
mymacd= average[fastLength,averageType](close)-average[slowLength,averageType](close)
// First Stochastic Stage on MACD
LowestMACD = LOWEST[ KPeriod ](mymacd)
HighestMACD = HIGHEST[ KPeriod ](mymacd)
IF HighestMACD - LowestMACD <> 0 THEN
FastK1 = ((mymacd - LowestMACD) / (HighestMACD - LowestMACD)) * 100
ELSE
FastK1 = 0
ENDIF
FastD1 = AVERAGE[DPeriod,averageType](FastK1) // Smoothed FastK1
// Second Stochastic Stage on FastD1
LowestFastD1 = LOWEST[KPeriod](FastD1)
HighestFastD1 = HIGHEST[KPeriod](FastD1)
IF HighestFastD1 - LowestFastD1 <> 0 THEN
FastK2 = ((FastD1 - LowestFastD1) / (HighestFastD1 - LowestFastD1)) * 100
ELSE
FastK2 = 0
ENDIF
// Final STC Calculation
STC = AVERAGE[DPeriod,averageType](FastK2)
//---------------------------------------------------------//
// Plot
//---------------------------------------------------------//
// Detection of Crossovers from the Oversold Zone
STCCrossAboveOversold = STC crosses over Oversold
if STCCrossAboveOversold then
drawarrowup(barindex,low)coloured("green")
//drawpoint(barindex,STC,5)coloured("green",40)
//drawpoint(barindex,STC,2)coloured("green",200)
endif
// Color Assignment
IF STC > OverBought THEN
r = 255
g = 0
b = 0 // Red for overbought
ELSIF STC < OverSold THEN
r = 0
g = 255
b = 0 // Green for oversold
ELSE
r = 128
g = 128
b = 128 // Grey for neutral zone
ENDIF
//---------------------------------------------------------//
// Return Oscillator below price
//---------------------------------------------------------//
RETURN //STC AS "STC Oscilador" COLOURED(r,g,b) STYLE(LINE,2), OverBought AS "Sobrecompra" COLOURED("red") STYLE(dottedline), OverSold AS "Sobreventa" COLOURED("green") STYLE(dottedline)
Thanks, Ivan. I got so excited to dig into them, I forgot to say thanks. Much appreciated!
Hi Ivan,
quite interesting. It would be possible to have on screen also the opposite situation:
– drawpoint function when oscillator cross below overbought
– red arrow on price in the price indicator
Thanks a lot
Hi. You just need to add the crossover condition to the downside of the OB level. Add this code:
STCCrossUnderOverbought = STC crosses under overBought
if STCCrossUnderOverbought then
drawarrowdown(barindex,high)coloured("red")
endif