x3 listesi 0 değil işte. sorunda orda
sıralamadan dolayımı 0 görüyor acaba
bak kodun kısası şu
var V = Sistem.GrafikVerileri ;
// hesapla
var PD = Sistem.BilancoPD();
var NK = Sistem.BilancoNetKar();
var x3 = Sistem.Liste(V.Count, 0);
var x2 = Sistem.MA(x3, "Simple", 10);
for (int i = 1; i < V.Count; i++)
x3[i] = (NK[i]/PD[i]);
resmide bu şu alttakı x3 bir tane ma giydirecem.
![]()
Senin almaya cesaret edemediğin riskleri alanlar, senin yaşamak istediğin hayatı yaşarlar..
Sokrates twit @erhanacikgoz1
Sn Keçi konusu açıldı ve kimseyi yanlış yönlendirmeyelim diye birkaç siteye bakıp doğrusunu bulmaya çalıştım. Daha önceden formulünü okuduğum Investopedia hatalı görünüyor. Diğerlerinin hepsinde formul aşağıdaki gibi:
Kaynaklar:HTML Kod:1. The Heikin-Ashi Close is simply an average of the open, high, low and close for the current period. HA-Close = (Open(0) + High(0) + Low(0) + Close(0)) / 4 2. The Heikin-Ashi Open is the average of the prior Heikin-Ashi candlestick open plus the close of the prior Heikin-Ashi candlestick. HA-Open = (HA-Open(-1) + HA-Close(-1)) / 2 3. The Heikin-Ashi High is the maximum of three data points: the current period's high, the current Heikin-Ashi candlestick open or the current Heikin-Ashi candlestick close. HA-High = Maximum of the High(0), HA-Open(0) or HA-Close(0) 4. The Heikin-Ashi low is the minimum of three data points: the current period's low, the current Heikin-Ashi candlestick open or the current Heikin-Ashi candlestick close. HA-Low = Minimum of the Low(0), HA-Open(0) or HA-Close(0)
http://stockcharts.com/school/doku.p...is:heikin_ashi
https://www.mql5.com/en/forum/175407
http://forexop.com/candlesticks/heikin-ashi-system/
Bu arada kendi kodumu da güncelledim.
Bu kodu derleyebilmek için User.dll'e Max ve Min metodlarının da eklenmesi gerektiğini farketttim:Kod:public List<cxBar> HeikinAshi(List<cxBar> bars) { var ha = bars.Select(b => b.Clone()).ToList(); try { for (int i = 1; i < bars.Count; i++) { ha[i].Close = (bars[i].Open + bars[i].High + bars[i].Low + bars[i].Close) / 4; ha[i].Open = (ha[i - 1].Open + ha[i - 1].Close) / 2; ha[i].High = Max(bars[i].High, ha[i].Open, ha[i].Close); ha[i].Low = Min(bars[i].Low, ha[i].Open, ha[i].Close); } } catch (Exception ex) { //Log(string.Format("ToHeikinAshi failed. Ex: {0}", ex)); } return ha; }
İhtyacı olan arkadaşlar faydalanabilirler diye düşünüyorum.Kod:public T Max<T>(params T[] args) { return args.Max(); } public T Min<T>(params T[] args) { return args.Min(); }
Sn Erhan, kodunuzda x3'e atama yaptığınız yer ile ortalama aldığınız yeri değiştirmeniz lazım. Siz önce oralama alıyor daha sonra x3'e atama yapıyorsunuz. Şöyle olmalı:
Kod:var V = Sistem.GrafikVerileri; var PD = Sistem.BilancoPD(); var NK = Sistem.BilancoNetKar(); var x1 = Sistem.Liste(V.Count, 0); var x3 = Sistem.Liste(V.Count, 0); for (int i = 1; i < V.Count; i++) x3[i] = (NK[i] / PD[i]); for (int i = 1; i < V.Count; i++) x1[i] = x3[i] > x2[i] ? 1 : x3[i] < x2[i] ? -1 : x1[i - 1]; var x2 = Sistem.MA(x3, "Simple", 10); // sistem var SonYon = ""; for (int i = 1; i < V.Count; i++) { if (x1[i] == 1 && SonYon != "A") // AL { Sistem.Yon[i] = "A"; SonYon = Sistem.Yon[i]; } else if (x1[i] == -1 && SonYon != "S") // SAT { Sistem.Yon[i] = "S"; SonYon = Sistem.Yon[i]; } else if (x1[i] == 0 && (SonYon == "A" || SonYon == "S")) // FLAT { Sistem.Yon[i] = "F"; SonYon = Sistem.Yon[i]; } } Sistem.Cizgiler[0].Deger = x3; // panel2 Sistem.Cizgiler[1].Deger = x2;
ONU DENEMIŞTIM AMA
'x2' yerel değişkeni bildirilmeden önce kullanılamaz
Senin almaya cesaret edemediğin riskleri alanlar, senin yaşamak istediğin hayatı yaşarlar..
Sokrates twit @erhanacikgoz1
Yer İmleri