0% found this document useful (0 votes)
372 views8 pages

FLI Code

This document defines a study for a follow line indicator with multiple inputs to customize parameters. It includes: 1) Definitions for calculating Bollinger Bands and determining trend signals based on the bands. 2) Logic to calculate a trend line that follows the highs and lows based on the trend signals and an ATR filter setting. 3) Numerous input parameters to customize aspects like the period, deviations, resolution, moving average type, and options for adding/reducing signals. 4) Functions for calculating moving averages on different time frames and smoothing values to determine the follow line.

Uploaded by

Perter Dermin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
372 views8 pages

FLI Code

This document defines a study for a follow line indicator with multiple inputs to customize parameters. It includes: 1) Definitions for calculating Bollinger Bands and determining trend signals based on the bands. 2) Logic to calculate a trend line that follows the highs and lows based on the trend signals and an ATR filter setting. 3) Numerous input parameters to customize aspects like the period, deviations, resolution, moving average type, and options for adding/reducing signals. 4) Functions for calculating moving averages on different time frames and smoothing values to determine the follow line.

Uploaded by

Perter Dermin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

// © Dreadblitz

//@version=4
study(shorttitle="FLI_AAFLI", title="Follow Line Indicator", overlay=true)
//
BBperiod1 = input(defval = 21, title = "BB Period", type =
input.integer, minval = 1)
BBdeviations1 = input(defval = 2.00, title = "BB Deviations", type =
input.float, minval = 0.1, step=0.05)
UseATRfilter1 = input(defval = true, title = "ATR Filter", type = input.bool)
ATRperiod1 = input(defval = 5, title = "ATR Period", type =
input.integer, minval = 1)
hl = input(defval = false, title = "Hide Labels", type = input.bool)
//
BBUpper1=sma (close,BBperiod1)+stdev(close, BBperiod1)*BBdeviations1
BBLower1=sma (close,BBperiod1)-stdev(close, BBperiod1)*BBdeviations1
//
TrendLine1 = 0.0
iTrend1 = 0.0
buy = 0.0
sell = 0.0
//
BBSignal1 = close>BBUpper1? 1 : close<BBLower1? -1 : 0
//
if BBSignal1 == 1 and UseATRfilter1 == 1
TrendLine1:=low-atr(ATRperiod1)
if TrendLine1<TrendLine1[1]
TrendLine1:=TrendLine1[1]
if BBSignal1 == -1 and UseATRfilter1 == 1
TrendLine1:=high+atr(ATRperiod1)
if TrendLine1>TrendLine1[1]
TrendLine1:=TrendLine1[1]
if BBSignal1 == 0 and UseATRfilter1 == 1
TrendLine1:=TrendLine1[1]
//
if BBSignal1 == 1 and UseATRfilter1 == 0
TrendLine1:=low
if TrendLine1<TrendLine1[1]
TrendLine1:=TrendLine1[1]
if BBSignal1 == -1 and UseATRfilter1 == 0
TrendLine1:=high
if TrendLine1>TrendLine1[1]
TrendLine1:=TrendLine1[1]
if BBSignal1== 0 and UseATRfilter1 == 0
TrendLine1:=TrendLine1[1]
//
iTrend1:=iTrend1[1]
if TrendLine1>TrendLine1[1]
iTrend1:=1
if TrendLine1<TrendLine1[1]
iTrend1:=-1
///////
//
buy:=iTrend1[1]==-1 and iTrend1==1 ? 1 : na
sell:=iTrend1[1]==1 and iTrend1==-1? 1 : na
//
plot(TrendLine1, color=iTrend1 > 0?
color.blue:color.red ,style=plot.style_line,linewidth=2,transp=0,title="Trend
Line")
plotshape(buy == 1 and hl == false? TrendLine1-atr(😎 :na, text='💣', style=
shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white,
offset=0, transp=0,size=size.auto)
plotshape(sell == 1 and hl == false ?TrendLine1+atr(8):na, text='🔨',
style=shape.labeldown, location=location.absolute, color=color.red,
textcolor=color.white, offset=0, transp=0,size=size.auto)
///////
// © Dreadblitz
//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
//Display and Alert
buys = 0.0
sells = 0.0
buycandle = open < close
sellcandle = open > close
buys:=iTrend1==1 ? 1 : na
sells:=iTrend1==-1? 1 : na
buyorder = buycandle and (buys == 1 and hl == false? TrendLine1-atr(😎 :na) and
(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)
sellorder = sellcandle and (sells == 1 and hl == false ?TrendLine1+atr(8):na) and
(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)
plotshape(sellorder, title="Add Sell 1", text="Sell", location=location.abovebar,
style=shape.labeldown, size=size.normal, color=color.red,
textcolor=color.white,transp=0)
plotshape(buyorder, title="Add Buy 1", text="Buy", location=location.belowbar,
style=shape.labelup, size=size.normal, color=color.green,
textcolor=color.white,transp=0)
//
alertcondition(sellorder ,title="Sell",message="Sell")
alertcondition(buyorder ,title="Buy",message="Buy")
alertcondition(buyorder or sellorder ,title="Buy/Sell",message="Buy/Sell")

You might also like