0% found this document useful (0 votes)
17 views

3

Uploaded by

8cf64vbfyf
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)
17 views

3

Uploaded by

8cf64vbfyf
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/ 2

instrument {

name = 'Eng+Filter3',
short_name = 'Eng+Filter',
icon="indicators:MACD",
overlay = true
}

MaPeriod = input (5, "Ma Period", input.integer, 1)


MASource = input (1, "Ma Method", input.string_selection, averages.titles)

period = input (5, "Atr Period", input.integer, 1 )


fn = input (averages.ssma, "Atr Ma Method", input.string_selection,
averages.titles)

period1 = input (14, "Aroon Period", input.integer, 1, 200)


AroonValue = input (20, "Aroon Oscillator Level", input.double, 0.01, 100)

adx_period = input (14, "Adx Period", input.integer, 1)


di_period = adx_period
threshold = input (20, "Adx Level", input.double, 0, 100)

input_group {
"Buy",
colorBuy = input { default = "green", type = input.color},
}

input_group {
"Sell",
colorSell = input { default = "red", type = input.color},
}

----Start Aroon Oscillator


aroonOsc = ((bars_since_lowest (period1) - bars_since_highest (period1)) /
period1 )*100
----Finished Aroon Oscillator

----Start ATR
local avgTr = averages [fn]
local AtrX = avgTr(tr,period)
----Finished ATR

----Start MA
local avgMa = averages [MASource]
local MaX = avgMa(close,MaPeriod)
----Finished MA

----Start ADX
up_move = change (high)
down_move = -change (low)

pdm = iff (up_move > down_move and nz(up_move) > 0, up_move, 0)


mdm = iff (down_move > up_move and nz(down_move) > 0, down_move, 0)

atr = rma(tr, di_period)

pdi = 100 * rma (pdm / atr, di_period) -- DI+


mdi = 100 * rma (mdm / atr, di_period) -- DI-
adx = 100 * rma (abs (pdi - mdi) / (pdi + mdi), adx_period)
----Finished ADX

----Main Condition entry order


EngBuy = iff(close > open[1] and close > open and close[1] < open[1] and abs(close-
open) > abs(close[1]-open[1]) and abs(close-open) < abs(close[1]-open[1])*5 and
close > MaX ,true, false)
EngSell = iff(close < open[1] and close < open and close[1] > open[1] and
abs(close-open) > abs(close[1]-open[1]) and abs(close-open) < abs(close[1]-
open[1])*5 and close < MaX ,true, false)
----Finished Main Condition entry order

----Start filter fake signal


filterBuy = iff(abs(high-low) > AtrX and aroonOsc > AroonValue and adx > threshold
and adx[1] < adx,true,false)
filterSell = iff(abs(high-low) > AtrX and aroonOsc < -AroonValue and adx >
threshold and adx[1] < adx ,true,false)
----Finished filter fake signal

plot_shape(EngBuy == true and filterBuy == true,


"HIGHER",
shape_style.arrowup,
shape_size.huge,
colorBuy,
shape_location.belowbar,
0,
"ENG",
colorBuy
)

plot_shape(EngSell == true and filterSell == true ,


"LOWER",
shape_style.arrowdown,
shape_size.huge,
colorSell,
shape_location.abovebar,
0,
"ENG",
colorSell
)

You might also like