HPotter

Trend continuation factor, by M.H. Pee

Trend continuation factor, by M.H. Pee
The related article is copyrighted material from Stocks & Commodities .
Remove from Favorite Scripts Add to Favorite Scripts
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 13/11/2014
//    The related article is copyrighted material from Stocks & Commodities.
////////////////////////////////////////////////////////////
study(title="Trend continuation factor")
Length = input(35, minval=1)
hline(0, color=green, linestyle=line)
xChange = mom(close, 1)
xPlusChange = iff(xChange > 0, xChange, 0)
xMinusChange = iff(xChange < 0, (xChange * -1), 0)
xPlusCF = iff(xPlusChange == 0, 0, xPlusChange + nz(xPlusCF[1], 1))
xMinusCF = iff(xMinusChange == 0, 0, xMinusChange + nz(xMinusCF[1], 1))
xPlus = xPlusChange - xMinusCF
xMinus = xMinusChange - xPlusCF
xPlusTCF =  sum(xPlus, Length)
nMinusTCF = sum(xMinus, Length)
plot(xPlusTCF, color=blue, title="Plus TCF")
plot(nMinusTCF, color=red, title="Minus TCF")
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out