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: drive.google.co...ERlOU9FelU/edit?usp=sharin...

List of my free indicators: bit.ly/1LQaPK8
List of my indicators at Appstore: blog.tradingview.com/?p=970
Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать этот скрипт на графике?
//
// @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)