LazyBear

Indicator: Trend Trigger Factor

Introduced by M.H.Pee, Trend Trigger Factor             is designed to keep the trader trading with the trend.

System rules according to the developer:
* If the 15-day TTF             is above 100 (indicating an uptrend), you will want to be in long positions.
* If the 15-day TTF             is below -100, you will want to be short.
* If it is between -100 and 100, you should remain with the current position.

More info:
Original Article by Mr.Pee: https://drive.google.com/file/d/0Bx48Du_2aPFncGhwWERlOU9FelU/edit?usp=sharing
Remove from Favorite Scripts Add to Favorite Scripts
//
// @author LazyBear
// 
study("Trend Trigger Factor [LazyBear]", shorttitle="TTF_LB")
length=input(15)
bt = input( 100, title="Buy Trigger")
st = input( -100, title="Sell Trigger")
markCrossovers=input(false, type=bool)

prev(s,i) =>
    y=abs(round(i))
    s[y]

calc_ttf( periods ) =>
    bp = highest( high, periods ) - prev( lowest( low, periods ), - periods )
    sp = prev( highest( high, periods ), - periods ) - lowest( low, periods )
    100 * (bp - sp) / ( 0.5*( bp + sp) )

ttf = calc_ttf( length )
plot(0, color=gray)
btl=plot(bt, color=gray, style=3)
stl=plot(st, color=gray, style=3)

long_f = cross( ttf, st ) and rising(ttf, 1)
short_f = cross(ttf, bt ) and falling(ttf, 1)

bs = (ttf > bt) ? bt : ttf
us = (ttf < st) ? st : ttf
bl=plot(bs, color=white)
ul=plot(us, color=white)
tl=plot(ttf, title="TTF", color=markCrossovers ? (long_f ? green : short_f ? red : blue) : maroon, linewidth=2)
fill(bl, tl, color=green, transp=75)
fill(ul, tl, color=red, transp=75)
Yet another useful indicator... Thanks LB
Reply
LazyBear PRO primaindustria
yw :)
Reply
pcmourao LazyBear
Hey LB, is it possible for you to write a script that automatically identify's Gartley and Harmonic Patterns? Something like this script for MT4 http://www.fx-mt4.info/view-review/zup-v135-harmonic-patterns-indicator . It automatically draws on the chart the pattern as it's forming based on price and Fib levels until the pattern is complete.
Reply
Pine script currently has no support for many of the constructs needed to do a script like this. Will post one as soon as we get the support (or I find a workaround).
Reply
pcmourao LazyBear
I don't understand much about sctipting, but I have seen some scripts that identify possible entry point's based on Bollingerbands, basically it reaches that limit in price, that coincides with the band and then it gives out some sort of signal that says it's a possible inversion. To make this script i'm talking about, can't you do the same thing based on price and fibonacci levels obeying to predetermined conditions until the conclusion of the gartley?
Reply
With my end-user (limited) understanding of Pinescript, I think not. May be someone else can proto this.
Reply
You should be advanced into a Mod position:) You would be the only one that earned it in a hard way. Great and appreciate it work.
Reply
LazyBear PRO sublimares2
thanks sublimares2. :)
Reply
LudmilaHanania sublimares2
Totally agree about LazyBear, he is doing a marvellous job with the indicators.
Reply
LazyBear PRO LudmilaHanania
Thanks
Reply
what kind of statement the following codes are? A switch statement: #prev(s,i) =>
# y=abs(round(i))
# s

#calc_ttf( periods ) =>
# bp = highest( high, periods ) - prev( lowest( low, periods ), - periods )
# sp = prev( highest( high, periods ), - periods ) - lowest( low, periods )
# 100 * (bp - sp) / ( 0.5*( bp + sp) )

Thanks.
Reply
Interesting in understanding the following formula, for which values of s and i dont understand. prev(s,i) =>
y=abs(round(i))
s Thanks.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Forex Signal Finder 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 Account and Billing Sign Out