PHP Code:
//@version=5
indicator("Kapsamlı Al-Sat Sinyal İndikatörü", shorttitle="Sinyal", overlay=true)
// === OSİLATÖR SİNYALLERİ ===
// RSI
rsi_length = 14
rsi_value = ta.rsi(close, rsi_length)
rsi_signal = rsi_value < 30 ? 1 : rsi_value > 70 ? -1 : 0
// Stokastik %K (14, 3, 3)
stoch_k = ta.sma(ta.stoch(close, high, low, 14), 3)
stoch_signal = stoch_k < 20 ? 1 : stoch_k > 80 ? -1 : 0
// CCI (20)
cci_length = 20
cci_value = ta.cci(close, cci_length)
cci_signal = cci_value < -100 ? 1 : cci_value > 100 ? -1 : 0
// ADX (14)
adx_length = 14
[diplus, diminus, adx_value] = ta.dmi(adx_length, adx_length)
adx_signal = diplus > diminus and adx_value > 25 ? 1 : diminus > diplus and adx_value > 25 ? -1 : 0
// Awesome Oscillator (Müthiş Osilatör)
ao_value = ta.sma(hl2, 5) - ta.sma(hl2, 34)
ao_signal = ao_value > 0 and ao_value > ao_value[1] ? 1 : ao_value < 0 and ao_value < ao_value[1] ? -1 : 0
// Momentum
mom_length = 10
mom_value = ta.mom(close, mom_length)
mom_signal = mom_value > 0 ? 1 : mom_value < 0 ? -1 : 0
// MACD (12, 26)
[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
macd_signal = macdLine > 0 ? 1 : macdLine < 0 ? -1 : 0
// Stochastic RSI (3, 3, 14, 14)
rsi_stoch = ta.rsi(close, 14)
stoch_rsi_k = ta.sma(ta.stoch(rsi_stoch, rsi_stoch, rsi_stoch, 14), 3)
stoch_rsi_signal = stoch_rsi_k < 20 ? 1 : stoch_rsi_k > 80 ? -1 : 0
// Williams %R (14)
williams_r = ta.wpr(14)
williams_signal = williams_r < -80 ? 1 : williams_r > -20 ? -1 : 0
// Bull Bear Power (Boğa Ayı Gücü)
ema13 = ta.ema(close, 13)
bull_power = high - ema13
bear_power = low - ema13
bb_signal = bull_power > 0 and bull_power > bull_power[1] ? 1 : bear_power < 0 and bear_power < bear_power[1] ? -1 : 0
// Ultimate Oscillator (7, 14, 28) - Manuel hesaplama
uo_bp1 = close - (low < close[1] ? low : close[1])
uo_tr1 = (high > close[1] ? high : close[1]) - (low < close[1] ? low : close[1])
uo_avg7 = ta.sma(uo_bp1, 7) / ta.sma(uo_tr1, 7)
uo_avg14 = ta.sma(uo_bp1, 14) / ta.sma(uo_tr1, 14)
uo_avg28 = ta.sma(uo_bp1, 28) / ta.sma(uo_tr1, 28)
uo_value = 100 * (4 * uo_avg7 + 2 * uo_avg14 + uo_avg28) / 7
uo_signal = uo_value < 30 ? 1 : uo_value > 70 ? -1 : 0
// Osilatör sinyallerini topla
osc_buy_signals = (rsi_signal == 1 ? 1 : 0) + (stoch_signal == 1 ? 1 : 0) + (cci_signal == 1 ? 1 : 0) +
(adx_signal == 1 ? 1 : 0) + (ao_signal == 1 ? 1 : 0) + (mom_signal == 1 ? 1 : 0) +
(macd_signal == 1 ? 1 : 0) + (stoch_rsi_signal == 1 ? 1 : 0) + (williams_signal == 1 ? 1 : 0) +
(bb_signal == 1 ? 1 : 0) + (uo_signal == 1 ? 1 : 0)
osc_sell_signals = (rsi_signal == -1 ? 1 : 0) + (stoch_signal == -1 ? 1 : 0) + (cci_signal == -1 ? 1 : 0) +
(adx_signal == -1 ? 1 : 0) + (ao_signal == -1 ? 1 : 0) + (mom_signal == -1 ? 1 : 0) +
(macd_signal == -1 ? 1 : 0) + (stoch_rsi_signal == -1 ? 1 : 0) + (williams_signal == -1 ? 1 : 0) +
(bb_signal == -1 ? 1 : 0) + (uo_signal == -1 ? 1 : 0)
// Osilatör sinyali
osc_buy = osc_buy_signals >= 6
osc_sell = osc_sell_signals >= 6
// === HAREKETLİ ORTALAMA SİNYALLERİ ===
// Hareketli ortalamalar
ema10 = ta.ema(close, 10)
sma10 = ta.sma(close, 10)
ema20 = ta.ema(close, 20)
sma20 = ta.sma(close, 20)
ema30 = ta.ema(close, 30)
sma30 = ta.sma(close, 30)
ema50 = ta.ema(close, 50)
sma50 = ta.sma(close, 50)
ema100 = ta.ema(close, 100)
sma100 = ta.sma(close, 100)
ema200 = ta.ema(close, 200)
sma200 = ta.sma(close, 200)
// Ichimoku Ana Hattı
ichimoku_base = (ta.highest(high, 9) + ta.lowest(low, 9)) / 2
// WMA20
wma20 = ta.wma(close, 20)
// Hull Moving Average (9)
hma9 = ta.hma(close, 9)
// Hareketli ortalama sinyalleri
ma_signals = array.new<int>()
array.push(ma_signals, close > ema10 ? 1 : close < ema10 ? -1 : 0)
array.push(ma_signals, close > sma10 ? 1 : close < sma10 ? -1 : 0)
array.push(ma_signals, close > ema20 ? 1 : close < ema20 ? -1 : 0)
array.push(ma_signals, close > sma20 ? 1 : close < sma20 ? -1 : 0)
array.push(ma_signals, close > ema30 ? 1 : close < ema30 ? -1 : 0)
array.push(ma_signals, close > sma30 ? 1 : close < sma30 ? -1 : 0)
array.push(ma_signals, close > ema50 ? 1 : close < ema50 ? -1 : 0)
array.push(ma_signals, close > sma50 ? 1 : close < sma50 ? -1 : 0)
array.push(ma_signals, close > ema100 ? 1 : close < ema100 ? -1 : 0)
array.push(ma_signals, close > sma100 ? 1 : close < sma100 ? -1 : 0)
array.push(ma_signals, close > ema200 ? 1 : close < ema200 ? -1 : 0)
array.push(ma_signals, close > sma200 ? 1 : close < sma200 ? -1 : 0)
array.push(ma_signals, close > ichimoku_base ? 1 : close < ichimoku_base ? -1 : 0)
array.push(ma_signals, close > wma20 ? 1 : close < wma20 ? -1 : 0)
array.push(ma_signals, close > hma9 ? 1 : close < hma9 ? -1 : 0)
// MA alım/satım sayısını hesapla
ma_buy_count = 0
ma_sell_count = 0
for i = 0 to array.size(ma_signals) - 1
signal = array.get(ma_signals, i)
if signal == 1
ma_buy_count += 1
else if signal == -1
ma_sell_count += 1
// Hareketli ortalama sinyali
ho_buy = ma_buy_count >= 8
ho_sell = ma_sell_count >= 8
// === ÖZET SİNYALLER ===
// Ana sinyaller
main_buy = osc_buy or ho_buy
main_sell = osc_sell or ho_sell
// Güçlü sinyaller (hem osilatör hem MA onayı)
strong_buy = osc_buy and ho_buy
strong_sell = osc_sell and ho_sell
// === GÖRSEL ÇIKTILAR ===
// Tablo oluştur
var table summary_table = table.new(position.top_right, 3, 6, bgcolor=color.white, border_width=1)
if barstate.islast
// Başlık
table.cell(summary_table, 0, 0, "Analiz", text_color=color.black, bgcolor=color.gray)
table.cell(summary_table, 1, 0, "Sinyal", text_color=color.black, bgcolor=color.gray)
table.cell(summary_table, 2, 0, "Sayı", text_color=color.black, bgcolor=color.gray)
// Osilatörler
osc_color = osc_buy ? color.green : osc_sell ? color.red : color.yellow
osc_text = osc_buy ? "BUY" : osc_sell ? "SELL" : "NÖTR"
table.cell(summary_table, 0, 1, "Osilatörler", text_color=color.black)
table.cell(summary_table, 1, 1, osc_text, text_color=color.white, bgcolor=osc_color)
table.cell(summary_table, 2, 1, str.tostring(osc_buy_signals) + "-" + str.tostring(osc_sell_signals), text_color=color.black)
// Hareketli Ortalamalar
ho_color = ho_buy ? color.green : ho_sell ? color.red : color.yellow
ho_text = ho_buy ? "HO BUY" : ho_sell ? "HO SELL" : "NÖTR"
table.cell(summary_table, 0, 2, "Har. Ortalamaları", text_color=color.black)
table.cell(summary_table, 1, 2, ho_text, text_color=color.white, bgcolor=ho_color)
table.cell(summary_table, 2, 2, str.tostring(ma_buy_count) + "-" + str.tostring(ma_sell_count), text_color=color.black)
// Özet
summary_color = strong_buy ? color.green : strong_sell ? color.red : main_buy ? color.lime : main_sell ? color.orange : color.yellow
summary_text = strong_buy ? "GÜÇLÜ AL" : strong_sell ? "GÜÇLÜ SAT" : main_buy ? "AL" : main_sell ? "SAT" : "NÖTR"
table.cell(summary_table, 0, 3, "ÖZET", text_color=color.black, bgcolor=color.gray)
table.cell(summary_table, 1, 3, summary_text, text_color=color.white, bgcolor=summary_color)
table.cell(summary_table, 2, 3, "", text_color=color.black)
// Grafik üzerinde sinyaller
plotshape(strong_buy, title="Güçlü Alım", location=location.belowbar, style=shape.labelup,
size=size.normal, color=color.green, text="GÜÇLÜ AL", textcolor=color.white)
plotshape(strong_sell, title="Güçlü Satım", location=location.abovebar, style=shape.labeldown,
size=size.normal, color=color.red, text="GÜÇLÜ SAT", textcolor=color.white)
plotshape(main_buy and not strong_buy, title="Alım", location=location.belowbar, style=shape.triangleup,
size=size.small, color=color.lime, text="AL")
plotshape(main_sell and not strong_sell, title="Satım", location=location.abovebar, style=shape.triangledown,
size=size.small, color=color.orange, text="SAT")
// Uyarılar
alertcondition(strong_buy, title="Güçlü Alım Sinyali", message="GÜÇLÜ ALIM SİNYALİ! Hem osilatörler hem de hareketli ortalamalar alım sinyali veriyor.")
alertcondition(strong_sell, title="Güçlü Satım Sinyali", message="GÜÇLÜ SATIM SİNYALİ! Hem osilatörler hem de hareketli ortalamalar satım sinyali veriyor.")
alertcondition(main_buy, title="Alım Sinyali", message="ALIM SİNYALİ! 6+ osilatör veya 8+ hareketli ortalama alım sinyali veriyor.")
alertcondition(main_sell, title="Satım Sinyali", message="SATIM SİNYALİ! 6+ osilatör veya 8+ hareketli ortalama satım sinyali veriyor.")
Yer İmleri