Pa Patterns & Strategies
Pa Patterns & Strategies
Pa Patterns & Strategies
if not get_value(c)then
return b end;
local d=high<=c and high[0.30]<=c and high[3]<=c and high[4]<=c;
b:set(iff(d,c,b[1]))return b end;
local function e()local b=make_series()local c=low[2]if not get_value(c)then return
b end;
local d=low>=c and low[0.30]>=c and low[3]>=c and low[4]>=c;
b:set(iff(d,c,b[1]))return b end;
input_group{"Color",color=input{default="lime",type=input.color},width=input{defaul
t=1,type=input.line_width}}h=a()l=e()hline(h,"High",color,high_width)hline(l,"Low",
color,width)hline(highest(1)[1],"HH1",color,1)hline(lowest(10)
[1],"LL1",color,1)hline(highest(5)[1],"HH5",color,1)hline(lowest(5)
[1],"LL5",color,1)hline(highest(15)[1],"HH15",color,1)hline(lowest(15)
[1],"LL15",color,1)hline(highest(30)[1],"HH30",color,1)hline(lowest(30)
[1],"LL30",color,1)hline(highest(60)[1],"HH60",color,1)hline(lowest(60)
[1],"LL60",color,1)hline(highest(0.30)[1],"HH0.30",color,1)hline(lowest(0.30)
[1],"LL0.30",color,1)
input_group {
"Area Up and Down",
colorAreaUp = input { default = "rgba(34, 139, 34, 0.3)", type = input.color },
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 = false, type = input.plot_visibility }
}
input_group {
"Sell Double Engulfing",
colorSell1 = input { default = "rgba(220, 20, 60, 0.8)", type = input.color },
visibleSell1 = input { default = false, type = input.plot_visibility }
}
input_group {
"Buy Outside Bar",
colorBuy2 = input { default = "rgba(0, 0, 255, 0.8)", type = input.color },
visibleBuy2 = input { default = false, type = input.plot_visibility }
}
input_group {
"Sell Outside Bar",
colorSell2 = input { default = "rgba(255, 20, 147, 0.8)", type = input.color },
visibleSell2 = input { default = false, type = input.plot_visibility }
}
input_group {
"Buy X Macd",
colorBuy3 = input { default = "rgba(0, 0, 255, 0.8)", type = input.color },
visibleBuy3 = input { default = false, type = input.plot_visibility }
}
input_group {
"Sell X Macd",
colorSell3 = input { default = "rgba(255, 20, 147, 0.8)", type = input.color },
visibleSell3 = input { default = false, type = input.plot_visibility }
}
input_group {
"Buy X Zero",
colorBuy4 = input { default = "rgba(0, 250, 154, 0.80)", type = input.color },
visibleBuy4 = input { default = false, type = input.plot_visibility }
}
input_group {
"Sell X Zero",
colorSell4 = input { default = "rgba(255, 20, 147, 0.60)", type =
input.color },
visibleSell4 = input { default = false, type = input.plot_visibility }
}
input_group {
"Buy Histo X",
colorBuy5 = input { default = "rgba(0, 250, 154, 0.80)", type = input.color },
visibleBuy5 = input { default = true, type = input.plot_visibility }
}
input_group {
"Sell Histo X",
colorSell5 = input { default = "rgba(255, 20, 147, 0.60)", type =
input.color },
visibleSell5 = input { default = true, type = input.plot_visibility }
}
candle_time = {"1m","5m"}
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 = {"1m","5m"}
filter_pa_index = input(8,"Candle check
resolution",input.string_selection,filter_source)
--print(filter_source[filter_pa_index])
emaFast = avgFast(titleFast,MaFast_period)
emaSlow = avgSlow(titleSlow,MaSlow_period)
macd = emaFast - emaSlow
signal = avgSignal(macd,Signal_period)
--plot(macd,"macd", "Blue", 1)
--plot(signal,"signal", "Orange", 1)
--rect {
--first = 0,
--second = histo,
--color = histo >= histo[1] and "LimeGreen" or "Orange",
--width = 0.5
--}
MaTrend0 = avgTrend(titleTrend,MaTrend_period)
MaTrend1 = MaTrend0[1]
)
end
)
end
)
end
end
)
end
end
)
--end
end
)
--end
end
)
--end
end
)
--end
end
)
--end
end
)
--end
end
)
--end
end
)
--end
end
end
end
input_group {
"Ma Fast Line",
colorFast = input { default = "#ff56e8", type = input.color },
widthFast = input { default = 1, type = input.line_width},
visibleFast = input { default = true, 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 = true, 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 = true, type = input.plot_visibility }
}
input_group {
"Buy Arrow",
colorBuy = input { default = "green", type = input.color },
visibleBuy = input { default = true, type = input.plot_visibility }
}
input_group {
"Sell Arrow",
colorSell = input { default = "red", type = input.color },
visibleSell = input { default = true, type = input.plot_visibility }
}
MaTrend0 = avgTrend(titleTrend,MaTrend_period)
Matrend1 = MaTrend0[1]
plot_shape((close > open and close[1] < open[1] and close > Mafast0 and close >
MaSlow0 and close > 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,
"BUY",
colorBuy
)
plot_shape((close < open and close[1] > open[1] and close < Mafast0 and close <
MaSlow0 and close < 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,
"SELL",
colorSell
)
end