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