-
// STOCHASTIC hesapla
Kod:
var STOCK = Sistem.StochasticOsc(5,3);
var STOCKHASTIC = Sistem.MA(STOCK, "Simple", 3);
// ortalama hesapla
var AVR = Sistem.MA(STOCKHASTIC, "Simple", 3);
// hesaplanan verileri çizgilere aktar ve açıklama ekle
Sistem.Cizgiler[0].Deger = STOCKHASTIC;
Sistem.Cizgiler[1].Deger = AVR;
-
Stoch %k %d
Kod:
// Stoch %k %d
/*
periodK = input(14, title="K", minval=1)
periodD = input(3, title="D (Smoothed K)", minval=1)
smoothK = input(3, title="Smooth", minval=1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, periodD)
adjk = (((sma(stoch(close, high, low, periodK), smoothK))/100)-.5)*2
adjd = ((d/100)-.5)*2
*/
var periodK = 14;
var periodD = 3;
var smoothK = 3;
var stoch = Sistem.StochasticOsc(periodK ,periodD );
var Sk = Sistem.MA(stoch, "Simple", smoothK);
var Sd = Sistem.MA(Sk, "Simple", periodD );
var adjk = Sistem.Liste(0);
var adjd = Sistem.Liste(0);
for (int i=1; i < Sistem.BarSayisi; i++)
{
adjk[i] = ((Sk[i]/100) - 0.5f)*2;
adjd[i] = ((Sd[i]/100) - 0.5f)*2;
}
Sistem.Cizgiler[0].Deger = adjk;
Sistem.Cizgiler[1].Deger = adjd;
Sistem.Cizgiler[2].Deger = Sistem.Liste(0.600f);
Sistem.Cizgiler[3].Deger = Sistem.Liste(-0.600f);
-
study("ABCD Patterns",overlay=true,max_bars_back=5000)
length = input(5)
up1 = pivothigh(high,length,length)
dn1 = pivotlow(low,length,length)
upcount = barssince(not na(up1))
dncount = barssince(not na(dn1))
ppp = (not na(dn1) and dncount[1]>upcount[1]) ? dn1 : (not na(up1) and dncount[1]<upcount[1]) ? up1 : na
up = (not na(up1) and dncount[1]<upcount[1]) ? up1 : na
dn = (not na(dn1) and dncount[1]>upcount[1]) ? dn1 : na
plot(up,title="pivot high",offset=-length)
plot(dn,title="pivot low",offset=-length)
plot(ppp,title="pivot line",offset=-length)
n = bar_index
a = valuewhen(not na(ppp),n,2)
b = valuewhen(not na(ppp),n,1)
c = valuewhen(not na(ppp),n,0)
av = valuewhen(not na(ppp),ppp,2)
bv = valuewhen(not na(ppp),ppp,1)
cv = valuewhen(not na(ppp),ppp,0)
//bullish AB=CD pattern
ABCD_bear = av<bv and (bv-cv)<=(0.89*(bv-av)) and (bv-cv)>=(0.38*(bv-av))
ABCD_bear1 = (high-cv)>=(bv-av) and ABCD_bear
label1 = ABCD_bear1 and not(ABCD_bear1[1]) ? label.new(bar_index,high,text="Bearish AB=CD",color=color.red,style=label.style_arrowdown ,yloc=yloc.abovebar,
textcolor=color.red,size=size.normal) : na
//buearish AB=CD pattern
ABCD_bull = av>bv and (cv-bv)<=(0.89*(av-bv)) and (cv-bv)>=(0.38*(av-bv))
ABCD_bull1 = (cv-low)>=(av-bv) and ABCD_bull
label2 = ABCD_bull1 and not(ABCD_bull1[1]) ? label.new(bar_index,low,text="Bullish AB=CD",color=color.green,style=label.style_arrowup ,yloc=yloc.belowbar,
textcolor=color.green,size=size.normal) : na
iyi akşamlar herkese hocalarım bazı terimleri çözemedim (not na(dn1) and dncount[1]>upcount[1]) ? dn1 : na) ve (bar index )(valuewhen)
-
// AKŞAM FLAT OL
// Akşam Flat ol , Girilen saatte sistem flat olur.
if ( V[i].Date.Hour == 17 && V[i].Date.Minute == 00) Sistem.Yon[i]="F";
Fakat girilen saatten sonra yeni sinyal gelirse işlem açar. Aşağıdaki grafikte 17: 00 de short tan flata geçmiş fakat 17:00 sonrasında indikatörlerde yeni kesişim oldugu için flattan shortta geçmiş.
- Gün sonu pozisyon kapatması için son bir bar öncesi olarak girilmelidir. 18:14 gibi
-
// SAAT ÖNCESİ SİNYAL ÜRETME
//Aşağıdaki kod sabah 09:35 öncesi barları dikkate almaz,
if (V[i].Date.ToString("HHmm").CompareTo("0935") >= 0)
-
// SAAT SONRASI SİNYAL ÜRETME
//Aşağıdaki kod sabah 18:00 sonrası barları dikkate almaz,
if (V[i].Date.ToString("HHmm").CompareTo("1800") <= 0)
-
// CUMA GÜNÜ 18:00 SONRASI SİNYAL ÜRETME
Günlerden cuma ve saat 18:00 i geçtiyse;
if (V[i].Date.DayOfWeek == DayOfWeek.Friday && V[i].Date.ToString("HHmm").CompareTo("1800") <= 0)
-
// CUMA GÜNÜ 18:14 SONRASI FLAT OL
Günlerden cuma ve saat 18:14 i geçtiyse;
if (V[i].Date.DayOfWeek == DayOfWeek.Friday && V[i].Date.Hour == 18 && V[i].Date.Minute == 14) Sistem.Yon[i]="F";