Schaff Trend Cycle TOS to PRT Conversion

Forums ProRealTime English forum ProBuilder support Schaff Trend Cycle TOS to PRT Conversion

Viewing 12 posts - 1 through 12 (of 12 total)
  • #243766

    Hi. I’ve spent hours trying to convert this code myself, but have a LOT more learning to do. I’ve tried MANY STCs, but the input variables of this one work best for my preferences. It works perfectly as is, however, the only thing I’ve seen different that might be great to add, was a screenshot I included of a protected pine script that appears to change line color at the break of the trend.  TOS image below shows variable settings (16,35,5,3,85,17,Wilders) and green indicator line. The pine script image is the red and white indicator line. Again, this one was protected, so I couldn’t get any more detail on it. Thanks, in advance!

    ___________________________________________________________________________________________

    Thinkscript:

    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 what I found to work with or define FastKCustom:

    FastKCustom


    FastKCustom ( IDataHolder data , int length );

    Default values:

    length: 14

    Description

    Returns values from 0 through 100 depending on a price. If the price is the lowest for the last length bars then 0 is returned. If the price is the highest for the last lengthbars then 100 is returned.

    The function is calculated according to the following algorithm:

    FastKCustom = if Highest(close, 12) - Lowest(close, 12) > 0 then (close - Lowest(close, 12)) / (Highest(close, 12) - Lowest(close, 12))*100 else 0

    #243768

    Had trouble adding 2nd image of pinescript version referenced above

    #243776
    JS

    Hi,
    Did you know that there is a “Schaff Trend Cycle” indicator available in the library…?
    https://www.prorealcode.com/prorealtime-indicators/schaff-trend-cycle2/
    If this one doesn’t meet your needs, what would you like to change (besides the possible color)…?

    #243777

    Hi. Yes, i did see those. I played with whar limited variables they offered, and they are ver limited by comparison to the TOS version i use. As you can see in my image provided, I able to adjust to an almost exact match to other indicators(I know they use a lot of similar data in their makeup). Being able to adjust the various variables, I am also able to tune out “noise” in the signal. Additionally, the ease of tweaking settings to various timeframes is also critical to my trading preferences. But thank you for pointing that out.

    #243779
    JS

    Hi,

    Hereby the conversion of the TOS script:

     

    2 users thanked author for this post.
    #243780
    JS

    with the colours:

    #243791

    Hi. I’ve spent hours trying to convert this code myself, but have a LOT more learning to do. I’ve tried MANY STCs, but the input variables of this one work best for my preferences. It works perfectly as is, however, the only thing I’ve seen different that might be great to add, was a screenshot I included of a protected pine script that appears to change line color at the break of the trend. TOS image below shows variable settings (16,35,5,3,85,17,Wilders) and green indicator line. The pine script image is the red and white indicator line. Again, this one was protected, so I couldn’t get any more detail on it. Thanks, in advance!

    Is it RocketScalper on the Price ?
    Do you have the code of it ?

    #243795

    The Thinkorswim code I pasted above is the code I’m looking to duplicate. I’ve only played with it a few minutes so far, but the code provided by JS above, “with colours”, is about as SUPER close, and the color tweaks are GREAT. Just need to maybe set the variables up to be able to adjust minutely for different time frames and spen a little more time comparing the results.

    ALSO: THANK YOU ALL for the help. Your efforts are more than generous, and greatly appreciated.

    #243798

    This is stellar! Thank you! I am working on getting those beginning settings  set up as changeable variables. I manually adjusted the settings to match my preferred settings, and they look super close to matching my current use with TOS script. I’m still very green with ProRealCode, so if you get to making those changes to adding the variables before I do, I won’t be upset. 🙂 Thanks again!

    #243800
    JS

    When you import the “ITF file” (Indicators), you can then configure the parameters under “Settings”…

    1 user thanked author for this post.
    #243803

    Awesome. I previously copied and pasted. Got it now.

     

    1 user thanked author for this post.
    avatar JS
    #243804

    EXCELLENT!! Thanks again.

    1 user thanked author for this post.
    avatar JS
Viewing 12 posts - 1 through 12 (of 12 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login