Trend Cycle STC to Prorealtime

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #243902 quote
    gp38super
    Participant
    New

    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.

    #243903 quote
    gp38super
    Participant
    New

    Forgot to attach a screenshot of signals.

    Thanks!

    Screenshot-2025-02-15-at-9.48.14 PM.png Screenshot-2025-02-15-at-9.48.14 PM.png
    #243905 quote
    gp38super
    Participant
    New

    It occasionally throws false signals, but I use other indicators and price action to minimize poor entries.

    #244108 quote
    Iván González
    Moderator
    Master

    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)
    gp38super thanked this post
    #244150 quote
    gp38super
    Participant
    New

    Thanks, Ivan. I got so excited to dig into them, I forgot to say thanks. Much appreciated!

    #244186 quote
    Msport71
    Participant
    Junior

    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

    Screenshot-2025-02-22-at-08-52-37-STC-Indicator-Schaff-Trend-Cycle-Better-Trading-Strategy-You-Must-Watch-YouTube.jpg Screenshot-2025-02-22-at-08-52-37-STC-Indicator-Schaff-Trend-Cycle-Better-Trading-Strategy-You-Must-Watch-YouTube.jpg
    #244262 quote
    Iván González
    Moderator
    Master

    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
    Msport71 thanked this post
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Trend Cycle STC to Prorealtime


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
gp38super @gp38super Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by Iván González
1 year ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/16/2025
Status: Active
Attachments: 2 files
Logo Logo
Loading...