Hangi araci kurumdan muafiyet aldiniz? Ben de ugrasacam artik.
Printable View
Merhaba arkadaşlar bi konuda yardıma ihtiyacım var akşam seansının dahil olduğu x030-T için her ay sonu 18:00 de vade kapat nasıl yapabilirim. aşağıda örnek olarak hazırladığımız bir kodum var fakat akşam seansı için 22:59 da kapatıyor yani kontratı yeni vade taşımış oluyor
if (V[i].Date.Month != V[i + 1].Date.Month && V[i].Date.ToString("HH:mm:ss").CompareTo("17:59:59") > 0)*Sinyal*=*"F";
Kodunuz sadece backtestte işe yarıyor o yüzden basit bir yama çözüm önereyim.
Kırmızı ile işaretli yeri periyoda göre akşam seansındaki (4 saat) oluşabilecek maximum bar sayısı +1 olacak şekilde düzenleyin.
Örneğin 1 dakikalık periyotta max 240 bar oluşma ihtimali varsa V[i + 241] işinizi görecektir. Tabi for döngüsünün son bar değerini de bir o kadar düşürmek gerekiyor V.Count - 242 veya Sistem.BarSayisi - 242 gibi.
teşekkürler böyle yaparsak kod ayın son gününe baktığından dolayı 31 gün olan mart ayının son iş günü 29unu sinyal üretememiş oluyor.
var V = Sistem.GrafikVerileri;
var IND1 = Sistem.MA(10, "Simple", "Kapanis");// Buraya birinci liste indikatörü yaz
var IND2 = Sistem.MA(200, "Simple", "Kapanis");// buraya ikinci liste veya indikatörü yaz
var SonYon = "";
var Sinyal = "";
for (int i=1; i < Sistem.BarSayisi; i++)
{
if (IND1[i] > IND2[i]) Sinyal = "A";
if (IND1[i] < IND2[i]) Sinyal = "S";
if (i < V.Count - 242)
{
if (V[i].Date.Month != V[i + 241].Date.Month && V[i].Date.ToString("HH:mm:ss").CompareTo("17:59:59") > 0)
{
//if (V[i].Date.Month != V[i + 1].Date.Month && V[i + 1].Date.Month % 2 == 1)
Sinyal = "S";
Sistem.DikeyCizgiEkle(i, Color.Green, 2, 2);
***************}
}
if (Sinyal != SonYon && Sinyal != "")
{
SonYon = Sinyal;
Sistem.Yon[i] = SonYon;
}
}