- เทคนิคของ Indicator:
- ใช้ MFI, RSI, Stochastics, Z-Score, Pivot Points และ EMA 50 และ EMA 200 ในการตรวจจับสัญญาณ.
- สร้างการเตือนเมื่อเทียนใกล้เข้าสู่โซนสูงสุดก่อนหน้า, จุด Pivot, หรือเมื่อเกิด Death Cross หรือ Golden Cross.
- บอกสัญญาณซื้อและขาย:
- ซื้อ: เมื่อเกิด Golden Cross หรือเมื่อเทียนใกล้จุด Pivot หรือโซนสูงสุดก่อนหน้า.
- ขาย: เมื่อเกิด Death Cross หรือเมื่อเทียนใกล้จุด Pivot หรือโซนสูงสุดก่อนหน้า.
ใช้งานในโปรแกรม TradingView https://www.tradingview.com/?aff_id=134641
เปิดบัญชีทดลอง: การเริ่มต้นของ Passive Income https://bit.ly/3Sdkir2
Golden Cross
Death Cross
Previous Pivot Points
Various Alerts
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Steversteves
//@version=5
indicator("Technical Candle Alerts [SS]", overlay=true, max_labels_count = 500, max_bars_back = 5000)
import Steversteves/SPTS_StatsPakLib/4 as spts
// ___
// / __|_ _ ___ _ _ _ __ ___
// | (_ | '_/ _ \ || | '_ (_-<
// \___|_| \___/\_,_| .__/__/
// |_|
g1 = "General Settings", g2 = "Technical Displays", g3 = "Pivot Settings", g4 = "RSI Settings", g5 = "Stochastic Settings", g6 = "MFI Settings", g7 = "Z-Score Settings"
// _ _ ___ _
// | | | |___ ___ _ _ |_ _|_ _ _ __ _ _| |_ ___
// | |_| (_-</ -_) '_| | || ' \| '_ \ || | _(_-<
// \___//__/\___|_| |___|_||_| .__/\_,_|\__/__/
// |_|
// General Settings
autolen = input.bool(true, "Use Autolength from Trend", group = g1)
inputlen = input.int(75, "Manual Length Input", group = g1)
wait = input.int(5, "Wait Time for Signals")
// Technical Displays
showpiv = input.bool(true, "Show Pivots", group = g2)
showmfi = input.bool(true, "Show MFI", group = g2)
showrsi = input.bool(true, "Show RSI", group = g2)
showsto = input.bool(true, "Show Stochastics", group = g2)
showz = input.bool(true, "Show Z-Score", group = g2)
showcomb = input.bool(true, "Show Combination Signals", group = g2 )
showema = input.bool(true, "Show Golden and Death Cross", group = g2)
// Pivots
piv_leftbars = input.int(15, "Pivot Left Bars", group = g3)
piv_rightbars = input.int(15, "Pivot Right Bars", group = g3)
// RSI Settings // Stochastic Settings // MFI // Z-Score
rsi_src = input.source(close, "RSI Source", group = g4), sto_src = input.source(close, "Stochastic Source", group = g5), mfi_src = input.source(hlc3, "MFI Source", group = g6), z_src = input.source(close, "Z-Score Source", group = g7)
rsi_len = input.int(14, "RSI Length", group = g4), sto_len = input.int(14, "Stochastic Length", group = g5), mfi_len = input.int(14, "MFI Length", group = g6), z_len = input.int(14, "Z-Score Length", group = g7)
// Autotrend
trend_finder(len)=>
ta.correlation(close, time, len)
t50 = trend_finder(50), t100 = trend_finder(100), t150 = trend_finder(150), t200 = trend_finder(200), t250 = trend_finder(250), t300 = trend_finder(300), t350 = trend_finder(350),
t400 = trend_finder(400), t450 = trend_finder(450), t500 = trend_finder(500)
find_trend_len = math.max(t50, t100, t150, t200, t250, t300, t350, t400, t450, t500)
int trend_len = find_trend_len == t50 ? 50 : find_trend_len == t100 ? 100 : find_trend_len == t150 ? 150 : find_trend_len == 200 ? 200 : find_trend_len == 250 ? 250 : find_trend_len == t300 ? 300 : find_trend_len == t350 ? 350 : find_trend_len == t400 ? 400 : find_trend_len == t450 ? 450 : find_trend_len == t500 ? 500 : 100
int len = 0
if autolen
len := trend_len
else
len := inputlen
// Condition Alerts
mfi = ta.mfi(mfi_src, mfi_len)
sto = ta.stoch(sto_src, high, low, sto_len)
rsi = ta.rsi(rsi_src, rsi_len)
z = spts.f_zscore(z_src, z_len)
pivothigh = ta.pivothigh(piv_leftbars, piv_rightbars)
pivotlow = ta.pivotlow(piv_leftbars, piv_rightbars)
ema200 = ta.ema(close, 200)
ema50 = ta.ema(close, 50)
piv_hi_true = pivothigh > 0
piv_lo_true = pivotlow > 0
piv_hi_a = array.new<float>()
piv_lo_a = array.new<float>()
atr_hi_a = array.new<float>()
atr_lo_a = array.new<float>()
for i = 0 to len
if piv_hi_true[i]
array.push(piv_hi_a, pivothigh[i])
if piv_lo_true[i]
array.push(piv_lo_a, pivotlow[i])
max_mfi = ta.highest(mfi, len)
min_mfi = ta.lowest(mfi, len)
max_sto = ta.highest(sto, len)
min_sto = ta.lowest(sto, len)
max_rsi = ta.highest(rsi, len)
min_rsi = ta.lowest(rsi, len)
max_z = ta.highest(z, len)
min_z = ta.lowest(z, len)
max_hi_atr = array.max(atr_hi_a)
max_lo_atr = array.max(atr_lo_a)
bool mfi_at_max = mfi >= max_mfi
bool mfi_at_min = mfi <= min_mfi
bool sto_at_max = sto >= max_sto
bool sto_at_min = sto <= min_sto
bool rsi_at_max = rsi >= max_rsi
bool rsi_at_min = rsi <= min_rsi
bool z_at_max = z >= max_z
bool z_at_min = z<= min_z
bool deathcross = ta.crossunder(ema50, ema200)
bool goldencross = ta.crossover(ema50, ema200)
color red = color.red
color green = color.lime
color gold = color.rgb(235, 161, 52)
color silver = color.silver
color transp = color.new(color.white, 100)
var int rsi_wait = 0
var int mfi_wait = 0
var int z_wait = 0
var int sto_wait = 0
var int mfi_sto_w = 0
var int mfi_rsi_w = 0
var int mfi_z_w = 0
var int sto_rsi = 0
var int sto_z = 0
var int z_rsi = 0
if deathcross and showema
label.new(bar_index, high, text = "Death Cross", color = transp, textcolor = silver)
else if goldencross and showema
label.new(bar_index, low, text = "Golden Cross", color = transp, textcolor = gold, style = label.style_label_up)
if mfi_at_max and not sto_at_max and not rsi_at_max and not z_at_max and showmfi
mfi_wait += 1
if mfi_wait >= wait
label.new(bar_index, high, text = "Max MFI \n" + str.tostring(math.round(mfi,2)), color = transp, textcolor = red)
mfi_wait := 0
else if mfi_at_max and sto_at_max and showcomb
mfi_sto_w += 1
if mfi_sto_w >= wait
label.new(bar_index, high, text = "Max MFI & Stochastic", color = transp, textcolor = red)
mfi_sto_w := 0
else if mfi_at_max and rsi_at_max and showcomb
mfi_rsi_w += 1
if mfi_rsi_w >= wait
label.new(bar_index, high, text = "Max MFI & RSI", color = transp, textcolor = red)
mfi_rsi_w := 0
else if mfi_at_max and z_at_max and showcomb
mfi_z_w += 1
if mfi_z_w >= wait
label.new(bar_index, high, text = "Max MFI & Z", color = transp, textcolor = red)
mfi_z_w := 0
else if sto_at_max and rsi_at_max and showcomb
sto_rsi += 1
if sto_rsi >= wait
label.new(bar_index, high, text = "Max Stoch and RSI", color = transp, textcolor = red)
sto_rsi := 0
else if sto_at_max and z_at_max and showcomb
sto_z += 1
if sto_z >= wait
label.new(bar_index, high, text = "Max Stoch and Z", color = transp, textcolor = red)
sto_z := 0
else if z_at_max and rsi_at_max and showcomb
z_rsi += 1
if z_rsi >= wait
label.new(bar_index, high, text = "Max Z and RSI", color = transp, textcolor = red)
z_rsi := 0
else if rsi_at_max and not mfi_at_max and not sto_at_max and not z_at_max and showrsi
rsi_wait += 1
if rsi_wait >= wait
label.new(bar_index, high, text = "Max RSI \n" + str.tostring(math.round(rsi,2)), color = transp, textcolor = red)
rsi_wait := 0
else if z_at_max and not mfi_at_max and not sto_at_max and not rsi_at_max and showz
z_wait += 1
if z_wait >= wait
label.new(bar_index, high, text = "Max Z \n" + str.tostring(math.round(z,2)), color = transp, textcolor = red)
z_wait := 0
else if mfi_at_min and not sto_at_min and not rsi_at_min and not z_at_min and showmfi
mfi_wait += 1
if mfi_wait >= wait
label.new(bar_index, low, text = "Min MFI \n" + str.tostring(math.round(mfi,2)), color = transp, textcolor = green, style = label.style_label_up)
mfi_wait := 0
else if rsi_at_min and not sto_at_min and not mfi_at_min and not z_at_min and showrsi
rsi_wait += 1
if rsi_wait >= wait
label.new(bar_index, low, text = "Min RSI \n" + str.tostring(math.round(rsi,2)), color = transp, textcolor = green, style = label.style_label_up)
rsi_wait := 0
else if z_at_min and not sto_at_min and not mfi_at_min and not rsi_at_min and showz
z_wait += 1
if z_wait >= wait
label.new(bar_index, low, text = "Min Z \n" + str.tostring(math.round(z,2)), color = transp, textcolor = green, style = label.style_label_up)
z_wait := 0
else if mfi_at_min and rsi_at_min and showcomb
mfi_rsi_w += 1
if mfi_rsi_w >= wait
label.new(bar_index, low, text = "Min MFI and RSI", color = transp, textcolor = green, style = label.style_label_up)
mfi_rsi_w := 0
else if mfi_at_min and sto_at_min and showcomb
mfi_sto_w += 1
if mfi_sto_w >= wait
label.new(bar_index, low, text = "Min MFI and Stoch", color = transp, textcolor = green, style = label.style_label_up)
mfi_sto_w := 0
else if mfi_at_min and z_at_min and showcomb
mfi_z_w += 1
if mfi_z_w >= wait
label.new(bar_index, low, text = "Min MFI and Z", color = transp, textcolor = green, style = label.style_label_up)
mfi_z_w := 0
else if sto_at_min and rsi_at_min and showcomb
sto_rsi += 1
if sto_rsi >= wait
label.new(bar_index, low, text = "Min Stoch & RSI", color = transp, textcolor = green, style = label.style_label_up)
sto_rsi := 0
else if sto_at_min and z_at_min and showcomb
sto_z += 1
if sto_z >= wait
label.new(bar_index, low, text = "Min Stoch & Z", color = transp, textcolor = green, style = label.style_label_up)
sto_z := 0
else if z_at_min and rsi_at_min and showcomb
z_rsi += 1
if z_rsi >= wait
label.new(bar_index, low, text = "Min Z & RSI", color = transp, textcolor = green, style = label.style_label_up)
z_rsi := 0
var int piv_hi_wait = 0
var int piv_lo_wait = 0
bool pivhi = na
bool pivlo = na
if array.size(piv_hi_a) - 1 > 0 and showpiv
for i = 0 to array.size(piv_hi_a) - 1
if array.get(piv_hi_a, i) == high or array.get(piv_hi_a, i) == low or array.get(piv_hi_a, i) == close or array.get(piv_hi_a, i) == open and not sto_at_max and not rsi_at_max and not z_at_max
piv_hi_wait += 1
if piv_hi_wait >= wait
label.new(bar_index, high, text = "Previous \n Pivot High", color = transp, textcolor = red)
pivhi := true
piv_hi_wait := 0
if array.size(piv_lo_a) - 1 > 0 and showpiv
for i = 0 to array.size(piv_lo_a) - 1
if array.get(piv_lo_a, i) == high or array.get(piv_lo_a, i) == low or array.get(piv_lo_a, i) == close or array.get(piv_lo_a, i) == open and not sto_at_max and not rsi_at_max and not z_at_max
piv_lo_wait += 1
if piv_lo_wait >= wait
label.new(bar_index, high, text = "Previous \n Pivot Low", color = transp, textcolor = green)
pivlo := true
piv_lo_wait := 0
alertcondition(deathcross, "Deathcross", "Sell")
alertcondition(goldencross, "Golden Cross", "Buy")
alertcondition(mfi_at_max, "MFI at Max", "Sell")
alertcondition(mfi_at_min, "MFI at Min", "Buy")
alertcondition(sto_at_max, "Stochastics at Max", "Sell")
alertcondition(sto_at_min, "Stochastics at Min", "Buy")
alertcondition(z_at_max, "Z-Score at Max", "Sell")
alertcondition(z_at_min, "Z-Score at Min", "Buy")
alertcondition(rsi_at_max, "RSI at Max", "Sell")
alertcondition(rsi_at_min, "RSI at Min", "Buy")
alertcondition(pivhi, "At Previous Pivot High", "Sell")
alertcondition(pivlo, "At Previous Pivot Low", "Buy")
https://www.tradingview.com/script/oKYLxaRl-Technical-Candle-Alerts-SS/