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

DoubleEngulfing LuaScript

Excelente

Uploaded by

Pedro Rodriguez
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)
168 views

DoubleEngulfing LuaScript

Excelente

Uploaded by

Pedro Rodriguez
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/ 4

instrument {

name = 'Double Engulfing',


short_name = 'Double-ENG',
icon = 'https://document-export.canva.com/UjD-E/DAEnFrUjD-
E/14/thumbnail/0001.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-
Credential=AKIAQYCGKMUHWDTJW6UD%2F20210814%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-
Date=20210814T120715Z&X-Amz-Expires=12731&X-Amz-
Signature=e97e7d83edf91bc687024798b4e226870762f7481609649ca6fc8f532a5d78df&X-Amz-
SignedHeaders=host&response-expires=Sat%2C%2014%20Aug%202021%2015%3A39%3A26%20GMT',
overlay = true
}

MaFast_period = input(12,"Ma Fast period",input.integer,1,1000,1)


MaFast_average = input(2,"Ma Fast average", input.string_selection,averages.titles)
MaFast_title = input(1,"Ma Fast title", input.string_selection,inputs.titles)

MaSlow_period = input(26,"Ma Slow period",input.integer,1,1000,1)


MaSlow_average = input(2,"Ma Slow average", input.string_selection,averages.titles)
MaSlow_title = input(1,"Ma Slow title", input.string_selection,inputs.titles)

MaTrend_period = input(100,"Ma Trend period",input.integer,1,1000,5)


MaTrend_average = input(2,"Ma Trend average",
input.string_selection,averages.titles)
MaTrend_title = input(1,"Ma Trend title", input.string_selection,inputs.titles)

input_group {
"Area Up and Down",
colorAreaUp = input { default = "rgba(34, 139, 34, 0.3)", type = input.color },

colorAreaDown = input { default = "rgba(220, 20, 60, 0.3)", type =


input.color },
visibleArea = input { default = true, type = input.plot_visibility }
}

input_group {
"Ma Fast Line",
colorFast = input { default = "#ff56e8", type = input.color },
widthFast = input { default = 1, type = input.line_width},
visibleFast = input { default = false, type = input.plot_visibility }
}

input_group {
"Ma Slow Line",
colorSlow = input { default = "#2d2af7", type = input.color },
widthSlow = input { default = 2, type = input.line_width},
visibleSlow = input { default = false, type = input.plot_visibility }
}

input_group {
"Ma Trend Line",
colorTrend = input { default = "#f74200", type = input.color },
widthTrend = input { default = 3, type = input.line_width},
visibleTrend = input { default = false, type = input.plot_visibility }
}

input_group {
"Buy Engulfing",
colorBuy = input { default = "green", type = input.color },
visibleBuy = input { default = false, type = input.plot_visibility }
}

input_group {
"Sell Engulfing",
colorSell = input { default = "red", type = input.color },
visibleSell = input { default = false, type = input.plot_visibility }
}

input_group {
"Buy Double Engulfing",
colorBuy1 = input { default = "rgba(34, 139, 34, 0.8)", type = input.color },
visibleBuy1 = input { default = true, type = input.plot_visibility }
}

input_group {
"Sell Double Engulfing",
colorSell1 = input { default = "rgba(220, 20, 60, 0.8)", type = input.color },
visibleSell1 = input { default = true, type = input.plot_visibility }
}

local avgFast = averages[MaFast_average]


local titleFast = inputs[MaFast_title]

local avgSlow = averages[MaSlow_average]


local titleSlow = inputs[MaSlow_title]

local avgTrend = averages[MaTrend_average]


local titleTrend = inputs[MaTrend_title]

if visibleFast == true then


plot(avgFast(titleFast,MaFast_period),"Ma Fast",colorFast,widthFast)
end

if visibleSlow == true then


plot(avgSlow(titleSlow,MaSlow_period),"Ma Slow",colorSlow,widthSlow)
end

if visibleTrend == true then


plot(avgTrend(titleTrend,MaTrend_period),"Ma Trend",colorTrend,widthTrend)
end

candle_time = {"1s", "5s", "10s", "15s", "30s", "1m", "2m", "5m", "10m", "15m",
"30m", "1H", "2H", "4H", "8H", "12H", "1D", "1W", "1M", "1Y"}
candle_time_res = input(6,"Candle check
resolution",input.string_selection,candle_time)

sec = security (current_ticker_id, candle_time[candle_time_res])

filter_source = {"1s", "5s", "10s", "15s", "30s", "1m", "2m", "5m", "10m", "15m",
"30m", "1H", "2H", "4H", "8H", "12H", "1D", "1W", "1M", "1Y"}
filter_pa_index = input(8,"Candle check
resolution",input.string_selection,filter_source)

filter_pa = security (current_ticker_id, filter_source[filter_pa_index])

--print(filter_source[filter_pa_index])
if (sec ~= nil) then

MaFast0 = avgFast(titleFast,MaFast_period) --Ma Fast bar 0


MaFast1 = MaFast0[1] --Ma Fast bar 1

MaSlow0 = avgSlow(titleSlow,MaSlow_period) --Ma Slow bar 0


MaSlow1 = MaSlow0[1]

MaTrend0 = avgTrend(titleTrend,MaTrend_period)
MaTrend1 = MaTrend0[1]

if(visibleBuy == true) then


plot_shape((close > open and close[1] < open[1] and close > MaFast0 and
MaFast0 > MaSlow0 and MaSlow0 > MaTrend0 and close > open[1] and open <= close[1]
and abs(close-open) > abs(close[1]-open[1])),
"Call",
shape_style.arrowup,
shape_size.huge,
colorBuy,
shape_location.belowbar,
0,
"Eng",
colorBuy
)
end

if (visibleSell == true) then


plot_shape((close < open and close[1] > open[1] and close < MaFast0 and
MaFast0 < MaSlow0 and MaSlow0 < MaTrend0 and close < open[1] and open >= close[1]
and abs(close-open) > abs(close[1]-open[1])),
"Put",
shape_style.arrowdown,
shape_size.huge,
colorSell,
shape_location.abovebar,
0,
"Eng",
colorSell
)
end

if(visibleBuy1 == true) then


if(filter_pa.close[1] > filter_pa.open[1] and filter_pa.close[2] <
filter_pa.open[2] and filter_pa.close[1] > filter_pa.open[2] and filter_pa.open[1]
<= filter_pa.close[2] and abs(filter_pa.close[1]-filter_pa.open[1]) >
abs(filter_pa.close[2]-filter_pa.open[2]) ) then
plot_shape((close > open and close[1] < open[1] and close > open[1] and
open <= close[1] and abs(close-open) > abs(close[1]-open[1])),
"Call1",
shape_style.arrowup,
shape_size.huge,
colorBuy1,
shape_location.belowbar,
0,
"DouEng",
colorBuy1
)
end
end

if (visibleSell1 == true) then


if(filter_pa.close[1] < filter_pa.open[1] and filter_pa.close[2] >
filter_pa.open[2] and filter_pa.close[1] < filter_pa.open[2] and filter_pa.open[1]
>= filter_pa.close[2] and abs(filter_pa.close[1]-filter_pa.open[1]) >
abs(filter_pa.close[2]-filter_pa.open[2]) ) then
plot_shape((close < open and close[1] > open[1] and close < open[1] and
open >= close[1] and abs(close-open) > abs(close[1]-open[1])),
"Put1",
shape_style.arrowdown,
shape_size.huge,
colorSell1,
shape_location.abovebar,
0,
"DouEng",
colorSell1
)
end
end

if (visibleArea == true) then


fill(MaFast0,MaSlow0,"Area", MaFast0 > MaSlow0 and colorAreaUp or MaFast0 <
MaSlow0 and colorAreaDown )

end

end

You might also like