Indicator · Pine Script v4 · Own pane

Angle Attack Follow Line Indicator

by theonetrade· code credited to Dreadblitz

Calculates trend direction and slope angles by combining a Follow Line algorithm, ATR volatility filtering, and optional higher-timeframe trend conditions.

View on GitHub

GitHub stars34on the repository
Pine versionv4older, still runs
Lines of code346
Settings40inputs
LicenceMIT
Last update2 weeks ago8 Nov 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

346 lines of Pine Script v4 from assets/indicator/bit-exact/angle_attack_follow_line_indicator_t3aX6BKM.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

angle_attack_follow_line_indicator_t3aX6BKM.pine
// © Dreadblitz
//@version=4
study(shorttitle="AAFLI", title="Angle Attack Follow Line Indicator ", overlay=false, max_bars_back=1000)

//INPUTS ————————————————————————————————————————————————————————————
FL            = input(title  = "🔰🔰🔰🔰 FOLLOW LINE CURRENT CHART RESOLUTION 🔰🔰🔰🔰", defval = true, type = input.bool)

BBperiod      = input(defval = 21,   title = "Period",    type = input.integer, minval = 1)
BBdeviations  = input(defval = 1.00, title = "Deviations",    type = input.float, minval = 0.1, step=0.05)
UseATRfilter  = input(defval = true, title = "ATR Filter",  type = input.bool)
ATRperiod     = input(defval = 5,    title = "ATR Period",    type = input.integer, minval = 1)

FLH           = input(title  = "🔰🔰🔰🔰🔰 FOLLOW LINE HIGHER TIME FRAME 🔰🔰🔰🔰🔰", defval = true, type = input.bool)

AIB           = input(defval = true, title = "Activate Indicator Background",  type = input.bool)
TYPE          = input(title  ="Type Of MA", defval="SMA", options=["RMA", "SMA", "EMA", "WMA", "VWMA", "SMMA", "KMA", "TMA", "HullMA", "DEMA", "TEMA", "CTI"])
RES           = input("240", type=input.resolution, title="Resolution")
LEN           = input(21, title = "Period", type=input.integer)
BBdeviations_ = input(defval = 1.00,title = "Deviations",    type = input.float, minval = 0.1, step=0.05)
ATRperiod_    = input(defval = 5,title = "ATR Period",    type = input.integer, minval = 1)
SOUR          = input(type=input.source,title = "Source", defval=close)

MD            = input(title  = "🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰 MODE 🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰", defval = true, type = input.bool)

MODE          = input(title  ="Type Of Mode", defval="NO FILTER HIGHER TIME FRAME", options=["NO FILTER HIGHER TIME FRAME", "FILTER HIGHER TIME FRAME"])

AC            = input(title  = "🔰🔰🔰🔰🔰🔰🔰🔰 ANGLE CONFIGURATION 🔰🔰🔰🔰🔰🔰🔰", defval = true, type = input.bool)

i_lookback    = input(8,     "Angle Period", input.integer, minval = 1)
i_atrPeriod   = input(10,    "ATR Period",   input.integer, minval = 1)

BSA           = input(title  = "🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰 BUY/SELL 🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰", defval = true, type = input.bool)

Buy_0         = input(defval = true, title = "Buy Change Follow Line",  type = input.bool)
Sell_0        = input(defval = true, title = "Sell Change Follow Line",  type = input.bool)

OTA           = input(title  = "🔰🔰🔰🔰🔰🔰🔰🔰🔰 OPTIONS TO ADD 🔰🔰🔰🔰🔰🔰🔰🔰", defval = true, type = input.bool)

Add_Buy_0     = input(defval = true, title = "Option 1 to Add Buy",  type = input.bool)
Add_Sell_0    = input(defval = true, title = "Option 1 to Add Sell",  type = input.bool)
Add_Buy_1     = input(defval = false, title = "Option 2 to Add Buy",  type = input.bool)
Add_Sell_1    = input(defval = false, title = "Option 2 to Add Sell",  type = input.bool)
Add_Buy_2     = input(defval = false, title = "Option 3 to Add Buy",  type = input.bool)
Add_Sell_2    = input(defval = false, title = "Option 3 to Add Sell",  type = input.bool)

OTR           = input(title  = "🔰🔰🔰🔰🔰🔰🔰🔰 OPTIONS TO REDUCE 🔰🔰🔰🔰🔰🔰🔰🔰", defval = true, type = input.bool)

Max_level_1   = input(defval = 40,   title = "Max Angle Level 1",    type = input.integer, minval = 1)
Max_level_2   = input(defval = 65,   title = "Max Angle Level 2",    type = input.integer, minval = 1)
Min_level_1   = input(defval = -40,  title = "Min Angle Level 1",    type = input.integer, minval = -100)
Min_level_2   = input(defval = -65,  title = "Min Angle Level 2",    type = input.integer, minval = -100)
Red_Buy_0     = input(defval = true, title = "Option 1 to Reduce Buy Max Angle Level 1",  type = input.bool)
Red_Buy_1     = input(defval = true, title = "Option 2 to Reduce Buy Max Angle Level 2",  type = input.bool)
Red_Buy_2     = input(defval = false,title = "Option 3 to Reduce Buy 2 Bars Above Max Angle Level 2",  type = input.bool)
Red_Buy_3     = input(defval = true, title = "Option 4 to Reduce Buy 3 Bars Above Max Angle Level 2",  type = input.bool)
Red_Buy_4     = input(defval = false,title = "Option 5 to Reduce Buy 4 Bars Above Max Angle Level 2",  type = input.bool)
Red_Sell_0    = input(defval = true, title = "Option 1 to Reduce Sell Min Angle Level 1",  type = input.bool)
Red_Sell_1    = input(defval = true, title = "Option 2 to Reduce Sell Min Angle Level 1",  type = input.bool)
Red_Sell_2    = input(defval = false,title = "Option 3 to Reduce Sell 2 bars Below Min Angle Level 2",  type = input.bool)
Red_Sell_3    = input(defval = true, title = "Option 4 to Reduce Sell 3 bars Below Min Angle Level 2",  type = input.bool)
Red_Sell_4    = input(defval = false,title = "Option 5 to Reduce Sell 4 bars Below Min Angle Level 2",  type = input.bool)


OTH           = input(title  = "🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰 OTHERS 🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰", defval = true, type = input.bool)

i_barColor    = input(true, "Bar Color?")
h_lables      = input(false, "Hide Labels")


// FOLLOW LINE —————————————————————————————————————————————————————

BBUpper=sma (close,BBperiod)+stdev(close, BBperiod)*BBdeviations
BBLower=sma (close,BBperiod)-stdev(close, BBperiod)*BBdeviations
TrendLine = 0.0
iTrend = 0.0
BBSignal = close>BBUpper? 1 : close<BBLower? -1 : 0
if BBSignal == 1 and UseATRfilter == 1
    TrendLine:=low-atr(ATRperiod)
    if TrendLine<TrendLine[1] 
        TrendLine:=TrendLine[1]
if BBSignal == -1 and UseATRfilter == 1
    TrendLine:=high+atr(ATRperiod)
    if TrendLine>TrendLine[1]
        TrendLine:=TrendLine[1]
if BBSignal == 0 and UseATRfilter == 1
    TrendLine:=TrendLine[1]
if BBSignal == 1 and UseATRfilter == 0
    TrendLine:=low
    if TrendLine<TrendLine[1] 
        TrendLine:=TrendLine[1]
if BBSignal == -1 and UseATRfilter == 0
    TrendLine:=high
    if TrendLine>TrendLine[1]
        TrendLine:=TrendLine[1]
if BBSignal == 0 and UseATRfilter == 0
    TrendLine:=TrendLine[1]
iTrend:=iTrend[1]
if TrendLine>TrendLine[1] 
    iTrend:=1
if TrendLine<TrendLine[1] 
    iTrend:=-1

// FOLLOW LINE HIGHER TIME FRAME ——————————————————————————————

cd = 0.0
cti(sm, src, cd) =>
    di = (sm - 1.0) / 2.0 + 1.0
    c1 = 2 / (di + 1.0)
    c2 = 1 - c1
    c3 = 3.0 * (cd * cd + cd * cd * cd)
    c4 = -3.0 * (2.0 * cd * cd + cd + cd * cd * cd)
    c5 = 3.0 * cd + 1.0 + cd * cd * cd + 3.0 * cd * cd
    i1 = 0.0
    i2 = 0.0
    i3 = 0.0
    i4 = 0.0
    i5 = 0.0
    i6 = 0.0
    i1 := c1*src + c2*nz(i1[1])
    i2 := c1*i1 + c2*nz(i2[1])
    i3 := c1*i2 + c2*nz(i3[1])
    i4 := c1*i3 + c2*nz(i4[1])
    i5 := c1*i4 + c2*nz(i5[1])
    i6 := c1*i5 + c2*nz(i6[1])
        
    bfr = -cd*cd*cd*i6 + c3*(i5) + c4*(i4) + c5*(i3)
    bfr

smma(src, len) =>
    smma = 0.0
    smma := na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len
    smma

ma(smoothing, src, length) => 
    if smoothing == "RMA"
        rma(src, length)
    else
        if smoothing == "SMA"
            sma(src, length)
        else 
            if smoothing == "EMA"
                ema(src, length)
            else 
                if smoothing == "WMA"
                    wma(src, length)
                else
                    if smoothing == "VWMA"
                        vwma(src, length)
                    else
                        if smoothing == "SMMA"
                            smma(src, length)
                        else
                            if smoothing == "HullMA"
                                wma(2 * wma(src, length / 2) - wma(src, length), round(sqrt(length)))
                            else
                                if smoothing == "LSMA"
                                    src
                                else
                                    if smoothing == "KMA"
                                        xPrice = src
                                        xvnoise = abs(xPrice - xPrice[1])
                                        nfastend = 0.666
                                        nslowend = 0.0645
                                        nsignal = abs(xPrice - xPrice[length])
                                        nnoise = sum(xvnoise, length)
                                        nefratio = iff(nnoise != 0, nsignal / nnoise, 0)
                                        nsmooth = pow(nefratio * (nfastend - nslowend) + nslowend, 2) 
                                        nAMA = 0.0
                                        nAMA := nz(nAMA[1]) + nsmooth * (xPrice - nz(nAMA[1]))
                                        nAMA
                                    else
                                        if smoothing == "TMA"
                                            sma(sma(close, length), length)
                                        else
                                            if smoothing == "DEMA"
                                                emaValue = ema(src, length)
                                                2 * emaValue - ema(emaValue, length)
                                            else
                                                if smoothing == "TEMA"
                                                    ema1 = ema(src, length)
                                                    ema2 = ema(ema1, length)
                                                    ema3 = ema(ema2, length)
                                                    (3 * ema1) - (3 * ema2) + ema3
                                                else
                                                    if smoothing == "CTI"
                                                        cti(length, src, cd)
                                                    else
                                                        src

MA = ma(TYPE, SOUR, LEN)
MA_MTF = security(syminfo.tickerid, RES, MA)
close_ = security(syminfo.tickerid, RES, close)
low_ = security(syminfo.tickerid, RES, low)
high_ = security(syminfo.tickerid, RES, high)
atr_ = security(syminfo.tickerid, RES, atr(ATRperiod_))

BBUpper_=MA_MTF+stdev(close_, LEN)*BBdeviations_
BBLower_=MA_MTF-stdev(close_, LEN)*BBdeviations_

TrendLine_MTF = 0.0
iTrend_ = 0.0

BBSignal_ = close_>BBUpper_? 1 : close_<BBLower_? -1 : 0
 
if BBSignal_ == 1 
    TrendLine_MTF:=low_-atr_
    if TrendLine_MTF<TrendLine_MTF[1] 
        TrendLine_MTF:=TrendLine_MTF[1]
if BBSignal_ == -1 
    TrendLine_MTF:=high_+atr_
    if TrendLine_MTF>TrendLine_MTF[1]
        TrendLine_MTF:=TrendLine_MTF[1]
if BBSignal_ == 0 
    TrendLine_MTF:=TrendLine_MTF[1]

iTrend_:=iTrend_[1]
if TrendLine_MTF>TrendLine_MTF[1] 
    iTrend_:=1
if TrendLine_MTF<TrendLine_MTF[1] 
    iTrend_:=-1

// ANGLE FL———————————————————————————————————————————————————————————— 

f_angle(_src, _lookback, _atrPeriod) =>
    rad2degree = 180 / 3.14159265359
    ang = rad2degree * atan((_src[0] - _src[_lookback]) / atr(_atrPeriod))
    ang
    
_angle_fl = f_angle(TrendLine, i_lookback, i_atrPeriod)


// BUY/SELL AND NO FILTER HIGHER TIME FRAME  ————————————————————————————————————————————————————————————

buy_0 = iTrend[1] < 0 and iTrend > 0 and Buy_0 and MODE == "NO FILTER HIGHER TIME FRAME" ? 1 :0 
sell_0 = iTrend[1] > 0 and iTrend < 0 and Sell_0 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 

// BUY/SELL AND FILTER HIGHER TIME FRAME  ————————————————————————————————————————————————————————————

buy_0_A = iTrend[1] < 0 and iTrend > 0 and Buy_0 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==1 ? 1 :0 
sell_0_A = iTrend[1] > 0 and iTrend < 0 and Sell_0 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==-1? 1 :0 


//ADD AND NO FILTER HIGHER TIME FRAME ————————————————————————————————————————————————————————————

add_buy_1 = _angle_fl [2] > 0 and _angle_fl [1] == 0 and _angle_fl == 0 and iTrend > 0 and Add_Buy_0 and MODE == "NO FILTER HIGHER TIME FRAME" ? 1 :0 

add_sell_1 = _angle_fl [2] < 0 and _angle_fl [1] == 0 and _angle_fl == 0 and iTrend < 0 and Add_Sell_0 and MODE == "NO FILTER HIGHER TIME FRAME" ? 1 :0 

add_buy_2 = _angle_fl [5] > 0 and _angle_fl [4] == 0 and _angle_fl[3] == 0 and _angle_fl[2] == 0 and _angle_fl[1] == 0 and _angle_fl == 0 and iTrend > 0 and Add_Buy_1 and MODE == "NO FILTER HIGHER TIME FRAME" ? 1 :0 

add_sell_2 = _angle_fl [5] < 0 and _angle_fl [4] == 0 and _angle_fl[3] == 0 and _angle_fl[2] == 0 and _angle_fl[1] == 0 and _angle_fl == 0 and iTrend < 0 and Add_Sell_1 and MODE == "NO FILTER HIGHER TIME FRAME" ? 1 :0 

add_buy_3 = _angle_fl [8] > 0 and _angle_fl [7] == 0 and _angle_fl[6] == 0 and _angle_fl[5] == 0 and _angle_fl[4] == 0 and _angle_fl[3] == 0 and _angle_fl[2] == 0 and _angle_fl[1] == 0 and _angle_fl == 0 and iTrend > 0 and Add_Buy_2 and MODE == "NO FILTER HIGHER TIME FRAME" ? 1 :0 

add_sell_3 = _angle_fl [8] < 0 and _angle_fl [7] == 0 and _angle_fl[6] == 0 and _angle_fl[5] == 0 and _angle_fl[4] == 0 and _angle_fl[3] == 0 and _angle_fl[2] == 0 and _angle_fl[1] == 0 and _angle_fl == 0 and iTrend < 0 and Add_Sell_2 and MODE == "NO FILTER HIGHER TIME FRAME" ? 1 :0 

//ADD AND FILTER HIGHER TIME FRAME ————————————————————————————————————————————————————————————

add_buy_1_A = _angle_fl [2] > 0 and _angle_fl [1] == 0 and _angle_fl == 0 and iTrend > 0 and Add_Buy_0 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==1? 1 :0 

add_sell_1_A = _angle_fl [2] < 0 and _angle_fl [1] == 0 and _angle_fl == 0 and iTrend < 0 and Add_Sell_0 and MODE == "FILTER HIGHER TIME FRAME"and iTrend_==-1? 1 :0 

add_buy_2_A = _angle_fl [5] > 0 and _angle_fl [4] == 0 and _angle_fl[3] == 0 and _angle_fl[2] == 0 and _angle_fl[1] == 0 and _angle_fl == 0 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==1 and Add_Buy_1? 1 :0 

add_sell_2_A = _angle_fl [5] < 0 and _angle_fl [4] == 0 and _angle_fl[3] == 0 and _angle_fl[2] == 0 and _angle_fl[1] == 0 and _angle_fl == 0 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==-1 and Add_Sell_1 ? 1 :0 

add_buy_3_A = _angle_fl [8] > 0 and _angle_fl [7] == 0 and _angle_fl[6] == 0 and _angle_fl[5] == 0 and _angle_fl[4] == 0 and _angle_fl[3] == 0 and _angle_fl[2] == 0 and _angle_fl[1] == 0 and _angle_fl == 0 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==1 and Add_Buy_2? 1 :0 

add_sell_3_A = _angle_fl [8] < 0 and _angle_fl [7] == 0 and _angle_fl[6] == 0 and _angle_fl[5] == 0 and _angle_fl[4] == 0 and _angle_fl[3] == 0 and _angle_fl[2] == 0 and _angle_fl[1] == 0 and _angle_fl == 0 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==-1 and Add_Sell_2 ? 1 :0 


//REDUCE AND NO FILTER HIGHER TIME FRAME ————————————————————————————————————————————————————————————

Redu_buy_1 = _angle_fl [1] < Max_level_1 and _angle_fl > Max_level_1 and Red_Buy_0 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 
Redu_buy_2 = _angle_fl [1] < Max_level_2 and _angle_fl > Max_level_2 and Red_Buy_1 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 
Redu_buy_3 = _angle_fl [2] < Max_level_2 and _angle_fl [1] > Max_level_2 and _angle_fl > Max_level_2 and Red_Buy_2 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 
Redu_buy_4 = _angle_fl [3] < Max_level_2 and _angle_fl [2] > Max_level_2 and _angle_fl [1] > Max_level_2 and _angle_fl > Max_level_2 and Red_Buy_3 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 
Redu_buy_5 = _angle_fl [4] < Max_level_2 and _angle_fl [3] > Max_level_2 and _angle_fl [2] > Max_level_2 and _angle_fl [1] > Max_level_2 and _angle_fl > Max_level_2 and Red_Buy_4 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 

Redu_sell_1 = _angle_fl [1] > Min_level_1 and _angle_fl < Min_level_1 and Red_Sell_0 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 
Redu_sell_2 = _angle_fl [1] > Min_level_2 and _angle_fl < Min_level_2 and Red_Sell_1 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 
Redu_sell_3 = _angle_fl [2] > Min_level_2 and _angle_fl [1] < Min_level_2 and _angle_fl < Min_level_2 and Red_Sell_2 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 
Redu_sell_4 = _angle_fl [3] > Min_level_2 and _angle_fl [2] < Min_level_2 and _angle_fl [1] < Min_level_2 and _angle_fl < Min_level_2 and Red_Sell_3 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 
Redu_sell_5 = _angle_fl [4] > Min_level_2 and _angle_fl [3] < Min_level_2 and _angle_fl [2] < Min_level_2 and _angle_fl [1] < Min_level_2 and _angle_fl < Min_level_2 and Red_Sell_4 and MODE == "NO FILTER HIGHER TIME FRAME"? 1 :0 

//REDUCE AND FILTER HIGHER TIME FRAME ————————————————————————————————————————————————————————————

Redu_buy_1_A = _angle_fl [1] < Max_level_1 and _angle_fl > Max_level_1 and Red_Buy_0 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==1? 1 :0 
Redu_buy_2_A = _angle_fl [1] < Max_level_2 and _angle_fl > Max_level_2 and Red_Buy_1 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==1? 1 :0 
Redu_buy_3_A = _angle_fl [2] < Max_level_2 and _angle_fl [1] > Max_level_2 and _angle_fl > Max_level_2 and Red_Buy_2 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==1? 1 :0 
Redu_buy_4_A = _angle_fl [3] < Max_level_2 and _angle_fl [2] > Max_level_2 and _angle_fl [1] > Max_level_2 and _angle_fl > Max_level_2 and Red_Buy_3 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==1? 1 :0 
Redu_buy_5_A = _angle_fl [4] < Max_level_2 and _angle_fl [3] > Max_level_2 and _angle_fl [2] > Max_level_2 and _angle_fl [1] > Max_level_2 and _angle_fl > Max_level_2 and Red_Buy_4 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==1? 1 :0 

Redu_sell_1_A = _angle_fl [1] > Min_level_1 and _angle_fl < Min_level_1 and Red_Sell_0 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==-1? 1 :0 
Redu_sell_2_A = _angle_fl [1] > Min_level_2 and _angle_fl < Min_level_2 and Red_Sell_1 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==-1? 1 :0 
Redu_sell_3_A = _angle_fl [2] > Min_level_2 and _angle_fl [1] < Min_level_2 and _angle_fl < Min_level_2 and Red_Sell_2 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==-1? 1 :0 
Redu_sell_4_A = _angle_fl [3] > Min_level_2 and _angle_fl [2] < Min_level_2 and _angle_fl [1] < Min_level_2 and _angle_fl < Min_level_2 and Red_Sell_3 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==-1? 1 :0 
Redu_sell_5_A = _angle_fl [4] > Min_level_2 and _angle_fl [3] < Min_level_2 and _angle_fl [2] < Min_level_2 and _angle_fl [1] < Min_level_2 and _angle_fl < Min_level_2 and Red_Sell_4 and MODE == "FILTER HIGHER TIME FRAME" and iTrend_==-1? 1 :0 

// PLOT ————————————————————————————————————————————————————————————

_color_fl = iTrend > 0?color.blue:color.red

plot(_angle_fl,"Angle Follow Line", _color_fl, 3, plot.style_line)
plot(_angle_fl,"Angle Follow Line Histogram", _color_fl, 3, plot.style_histogram)

hline(Max_level_1, title='Max Angle Level 1', color=color.blue, linestyle=hline.style_dotted, linewidth=1)
hline(Max_level_2, title='Max Angle Level 2', color=color.blue, linestyle=hline.style_dotted, linewidth=1)
hline(Min_level_1, title='Min Angle Level 1', color=color.red, linestyle=hline.style_dotted, linewidth=1)
hline(Min_level_2, title='Min Angle Level 2', color=color.red, linestyle=hline.style_dotted, linewidth=1)


plotshape(h_lables == false and (sell_0 or sell_0_A) ? 5 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white,transp=0)
plotshape(h_lables == false and (buy_0 or buy_0_A)? -5 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.blue, textcolor=color.white,transp=0)

plotshape(h_lables == false and (add_sell_1 or add_sell_1_A or add_sell_2 or add_sell_3 or add_sell_2_A or add_sell_3_A) ? _angle_fl +5 : na, title="Add Sell 1", text="Add", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white,transp=0)
plotshape(h_lables == false and (add_buy_1 or add_buy_1_A or add_buy_2 or add_buy_3 or add_buy_2_A or add_buy_3_A) ? _angle_fl -5 : na, title="Add Buy 1", text="Add", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.blue, textcolor=color.white,transp=0)

plotshape(h_lables == false and (Redu_buy_1 or Redu_buy_1_A)? _angle_fl +5 : na, title="Reduce Buy 1", text="Red", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.white,transp=0)
plotshape(h_lables == false and (Redu_buy_2 or Redu_buy_2_A)? _angle_fl +5 : na, title="Reduce Buy 2", text="Red", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.white,transp=0)
plotshape(h_lables == false and (Redu_buy_3 or Redu_buy_3_A)? _angle_fl +5 : na, title="Reduce Buy 3", text="Red", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.white,transp=0)
plotshape(h_lables == false and (Redu_buy_4 or Redu_buy_4_A)? _angle_fl +5 : na, title="Reduce Buy 4", text="Red", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.white,transp=0)
plotshape(h_lables == false and (Redu_buy_5 or Redu_buy_5_A)? _angle_fl +5 : na, title="Reduce Buy 5", text="Red", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.white,transp=0)

plotshape(h_lables == false and (Redu_sell_1 or Redu_sell_1_A) ? _angle_fl -5 : na, title="Reduce Sell 1", text="Red", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.red, textcolor=color.white,transp=0)
plotshape(h_lables == false and (Redu_sell_2 or Redu_sell_2_A)? _angle_fl -5 : na, title="Reduce Sell 2", text="Red", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.red, textcolor=color.white,transp=0)
plotshape(h_lables == false and (Redu_sell_3 or Redu_sell_3_A)? _angle_fl -5 : na, title="Reduce Sell 3", text="Red", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.red, textcolor=color.white,transp=0)
plotshape(h_lables == false and (Redu_sell_4 or Redu_sell_4_A)? _angle_fl -5 : na, title="Reduce Sell 4", text="Red", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.red, textcolor=color.white,transp=0)
plotshape(h_lables == false and (Redu_sell_5 or Redu_sell_5_A)? _angle_fl -5 : na, title="Reduce Sell 5", text="Red", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.red, textcolor=color.white,transp=0)

bgcolor(iTrend_ > 0 and AIB? color.blue : iTrend_ < 0 and AIB? color.red:na, transp=70)

barcolor(iTrend > 0?color.blue:color.red)

// ALERTS————————————————————————————————————————————————————————————

alertcondition(sell_0 or sell_0_A,title="Sell",message="Sell")
alertcondition(buy_0 or buy_0_A,title="Buy",message="Buy")

alertcondition(add_sell_1 or add_sell_1_A or add_sell_2 or add_sell_3 or add_sell_2_A or add_sell_3_A,title="Add Sell",message="Add Sell")
alertcondition(add_buy_1 or add_buy_1_A or add_buy_2 or add_buy_3 or add_buy_2_A or add_buy_3_A,title="Add Buy",message="Add Buy")

alertcondition(Redu_buy_1 or Redu_buy_1_A or Redu_buy_2 or Redu_buy_2_A or Redu_buy_3 or Redu_buy_3_A or Redu_buy_4 or Redu_buy_4_A or Redu_buy_5 or Redu_buy_5_A,title="Reduce Buy",message="Reduce Buy")
alertcondition(Redu_sell_1 or Redu_sell_1_A or Redu_sell_2 or Redu_sell_2_A or Redu_sell_3 or Redu_sell_3_A or Redu_sell_4 or Redu_sell_4_A or Redu_sell_5 or Redu_sell_5_A,title="Reduce Sell",message="Reduce Sell")

alertcondition(sell_0 or sell_0_A or buy_0 or buy_0_A or add_sell_1 or add_sell_1_A or add_sell_2 or add_sell_3 or add_sell_2_A or add_sell_3_A or add_buy_1 or add_buy_1_A or add_buy_2 or add_buy_3 or add_buy_2_A or add_buy_3_A or Redu_buy_1 or Redu_buy_1_A or Redu_buy_2 or Redu_buy_2_A or Redu_buy_3 or Redu_buy_3_A or Redu_buy_4 or Redu_buy_4_A or Redu_buy_5 or Redu_buy_5_A or Redu_sell_1 or Redu_sell_1_A or Redu_sell_2 or Redu_sell_2_A or Redu_sell_3 or Redu_sell_3_A or Redu_sell_4 or Redu_sell_4_A or Redu_sell_5 or Redu_sell_5_A ,title="Buy/Sell/Add/Reduce",message="Buy/Sell/Add/Reduce")

Overview

The indicator measures angle trajectory over a customizable lookback period and plots momentum metrics in a separate pane. Traders can choose from multiple moving average types, adjust resolution filters, and toggle granular buy and sell signal additions.

Details

Published by

theonetrade on GitHub

Code credit

Dreadblitz, as written in the script's header

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

algorithmic-tradingbacktestingbitcoinccxtcrypto-tradingllm-agentoffline-backtestingopen-source-tradingpine-scriptpine-to-pythonpinescriptpynecorepythonquantquantitative-financestrategy-backtestingtechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
🔰🔰🔰🔰 FOLLOW LINE CURRENT CHART RESOLUTION 🔰🔰🔰🔰booltrueFL
Periodint21BBperiod
Deviationsfloat1.00BBdeviations
ATR FilterbooltrueUseATRfilter
ATR Periodint5ATRperiod
🔰🔰🔰🔰🔰 FOLLOW LINE HIGHER TIME FRAME 🔰🔰🔰🔰🔰booltrueFLH
Activate Indicator BackgroundbooltrueAIB
Type Of MAstringSMATYPE
Resolutiontimeframe240RES
Periodint21LEN
Deviationsfloat1.00BBdeviations_
ATR Periodint5ATRperiod_
Show all 40 settings
SettingTypeDefaultVariable
SourcesourcecloseSOUR
🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰 MODE 🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰booltrueMD
Type Of ModestringNO FILTER HIGHER TIME FRAMEMODE
🔰🔰🔰🔰🔰🔰🔰🔰 ANGLE CONFIGURATION 🔰🔰🔰🔰🔰🔰🔰booltrueAC
Angle Periodint8i_lookback
ATR Periodint10i_atrPeriod
🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰 BUY/SELL 🔰🔰🔰🔰🔰🔰🔰🔰🔰🔰booltrueBSA
Buy Change Follow LinebooltrueBuy_0
Sell Change Follow LinebooltrueSell_0
🔰🔰🔰🔰🔰🔰🔰🔰🔰 OPTIONS TO ADD 🔰🔰🔰🔰🔰🔰🔰🔰booltrueOTA
Option 1 to Add BuybooltrueAdd_Buy_0
Option 1 to Add SellbooltrueAdd_Sell_0
Option 2 to Add BuyboolfalseAdd_Buy_1
Option 2 to Add SellboolfalseAdd_Sell_1
Option 3 to Add BuyboolfalseAdd_Buy_2
Option 3 to Add SellboolfalseAdd_Sell_2
🔰🔰🔰🔰🔰🔰🔰🔰 OPTIONS TO REDUCE 🔰🔰🔰🔰🔰🔰🔰🔰booltrueOTR
Max Angle Level 1int40Max_level_1
Max Angle Level 2int65Max_level_2
Min Angle Level 1int-40Min_level_1
Min Angle Level 2int-65Min_level_2
Option 1 to Reduce Buy Max Angle Level 1booltrueRed_Buy_0
Option 2 to Reduce Buy Max Angle Level 2booltrueRed_Buy_1
Option 3 to Reduce Buy 2 Bars Above Max Angle Level 2boolfalseRed_Buy_2
Option 4 to Reduce Buy 3 Bars Above Max Angle Level 2booltrueRed_Buy_3
Option 5 to Reduce Buy 4 Bars Above Max Angle Level 2boolfalseRed_Buy_4
Option 1 to Reduce Sell Min Angle Level 1booltrueRed_Sell_0
Option 2 to Reduce Sell Min Angle Level 1booltrueRed_Sell_1
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

MultiIndicator

by capissimo
114 stars

MultiIndicator combines multiple technical indicators into a single separate pane to save chart space. It calculates and displays market regime detection based on ordinary least squares regression, a Holt exponential smoothing crossover, normalized RSI, ADX, a

Indicator v4 Oscillators & momentumTrend
Updated 2 years ago · None stated GitHub repository of MultiIndicator
29 stars

The Supertrended RSI [AlgoAlpha] indicator plots the Relative Strength Index combined with a Supertrend overlay in a separate indicator pane. It first computes standard RSI, with an optional Hull Moving Average smoothing step, and computes a secondary moving a

Indicator v5 Oscillators & momentumTrend
Updated 1 year ago · Custom licence GitHub repository of Supertrended RSI [AlgoAlpha]

This indicator computes and plots multiple technical analysis features on a separate pane. It calculates EMA-based trend indicators including fast and slow EMAs along with their slope, momentum oscillators such as RSI, Stochastic RSI, and MACD histogram, WaveT

Indicator v6 TrendOscillators & momentum
Updated 4 weeks ago · MIT GitHub repository of Vein Feature Exporter Core 4H [WavesUnchained]
3 stars

Short Term Alpha Indicator calculates a weighted alpha from price change multiplied by volume, then derives EMAs at fast, medium, and slow lengths. It computes ROC values for the EMAs and applies percentile rank functions to identify deviations. These deviatio

Indicator v5 Oscillators & momentumMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Short Term Alpha Indicator

QQE + AK Trend + EFI

by realanthonyc
2 stars

This Pine Script indicator combines QQE, AK Trend, and EFI indicators. It calculates the QQE using RSI with smoothing and displays it as a histogram in a separate pane. The AK Trend line is formed by two exponential moving averages whose scale adjusts accordin

Indicator v6 Oscillators & momentumTrend
Updated 11 months ago · MPL-2.0 GitHub repository of QQE + AK Trend + EFI

DMI Improve

by JohnsonHsiao
1 stars

This indicator improves the standard Directional Movement Index by adjusting plus and minus directional movement calculations with a weight factor and SMA adjustments for sensitivity. It calculates and plots improved DI+ and DI- lines in a separate pane. Setti

Indicator v5 TrendOscillators & momentum
Updated 4 years ago · None stated GitHub repository of DMI Improve

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers