Originally Posted by
mash1453
Selamlar,
Bir robotun hesaplamasını değiştirmem gerekiyor ancak çok uğraşmama rağmen yapamadım... Yardımcı olursanız çok memnun olurum.... Sadece al-sat noktalarının hesabını aşağıdaki tilson T3 sistemine göre yapılması gerekiyor.....
Robot;
//sistem alsat yapıyor ve ana para bilgisi tutup güncelliyor
bool DevamEt = true;
if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday) DevamEt = false;
if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday) DevamEt = false;
if (Sistem.Saat.CompareTo("17:59:59") > 0 || Sistem.Saat.CompareTo("10:00:01") < 0) DevamEt=false;
///kullanıcı ve hesap sınırlaması/////
if(DevamEt)
{
var calis =float.Parse(Sistem.Parametreler[0]);
var LimitPara=float.Parse(Sistem.Parametreler[1]);
var BistHesap = Sistem.BistHesapOku();
var Limit = BistHesap.IslemLimit;
Sistem.Parametreler[1] = Limit.ToString();
////////////////////////////////////////Bölüm 0 - TT ye git sinyal takip ve alım satım işlemleri /////////////////////
var SpotHisselerTxt= File.ReadAllLines("C:\\iDeal\\SPT.txt").ToList();
for (var No = 0; No < SpotHisselerTxt.Count; No++) {
var adetFiyatToplam = SpotHisselerTxt[No];
var afListe =adetFiyatToplam.Split(';');
var Sembol = string.Format(afListe[0]);
var adet = decimal.Parse(afListe[1]);
var maliyet = decimal.Parse(afListe[2]);
var sd = string.Format(afListe[3]);
var periyot = string.Format(afListe[4]);
var atr= string.Format(afListe[5]);
var multiatr =float.Parse(afListe[6]);
var para = decimal.Parse(afListe[7]);
var carpan = float.Parse(afListe[8]);
var C = Sistem.GrafikFiyatOku(Sembol, periyot,"Kapanis");
var H = Sistem.GrafikFiyatOku(Sembol, periyot,"Yuksek");
var L = Sistem.GrafikFiyatOku(Sembol, periyot,"Dusuk");
var O = Sistem.GrafikFiyatOku(Sembol, periyot,"Acilis");
var Tavan = Sistem.Tavan(Sembol);
var Taban = Sistem.Taban(Sembol);
var Veri = Sistem.YuzeyselVeriOku(Sembol);
var Derinlik = Sistem.DerinlikVerisiOku(Sembol);
var AlisFiyatKademe0 = (decimal)Derinlik.Bids[0].Price;
var SatisFiyatKademe0 = (decimal)Derinlik.Asks[0].Price;
var AlisLotKademe0 = (decimal)Derinlik.Bids[0].Size;
var bt = Veri.FI182;
var VeriC = Sistem.GrafikVerileriniOku(Sembol, periyot);
if ( Tavan != C[C.Count-1] && Taban != C[C.Count-1] )
{
var MP = Sistem.GrafikFiyatSec(VeriC,"OrtaNokta");
var ATRX = Sistem.AverageTrueRange(VeriC,1);
var ATR = Sistem.MA(ATRX, "Simple", atr);
var STR = Sistem.Liste(VeriC,0);
var STS = Sistem.Liste(VeriC,0);
var FUB = Sistem.Liste(VeriC,0);
var FLB = Sistem.Liste(VeriC,0);
var ST = Sistem.Liste(VeriC,0);
var SuperTrend = Sistem.Liste(VeriC,0);
for (int i=1; i < VeriC.Count; i++)
{
STR[i] = MP[i] + (multiatr*ATR[i]);
STS[i] = MP[i] - (multiatr*ATR[i]);
}
for (int i=1;i<VeriC.Count;i++)
{
FUB[i] = (STR[i] < FUB[i-1] || C[i-1] > FUB[i-1]) ? STR[i] : FUB[i-1];
FLB[i] = (STS[i] > FLB[i-1] || C[i-1] < FLB[i-1]) ? STS[i] : FLB[i-1];
ST[i] = (ST[i-1] == FUB[i-1] && C[i] < FUB[i]) ? FUB[i] : (ST[i-1] == FUB[i-1] && C[i] > FUB[i]) ? FLB[i] : (ST[i-1] == FLB[i-1] && C[i] > FLB[i]) ? FLB[i] : (ST[i-1] == FLB[i-1] && C[i] < FLB[i] ? FUB[i] : FUB[i]);
}
var SonYon = "";
for (int i=1; i < VeriC.Count; i++)
{
if(C[i-1] < ST[i-1] && SonYon !="A")
{
SonYon = "A";
}
if(C[i-1] > ST[i-1] && SonYon !="S")
{
SonYon = "S";
}
}
///////////////////////////// SonYonList[VeriC.Count-2]== 100 && ///////////////////////////////////////////////////////////////////////////////////////////////
if ( SonYon== "A" && bt ==0 && sd.Equals("F") && calis>1 && ((carpan>1 && carpan<10) || (carpan>11 && C[C.Count-3] < ST[C.Count-3])) && (float)LimitPara>(float)para && AlisLotKademe0>0) // yön alış ve brüt takas değilse ve carpan 2 ve calıs 2 ise hemal hem sat
{
var miktar = Math.Floor((carpan*(float)para)/Tavan);
Sistem.EmirSembol = Sembol;
Sistem.EmirIslem = "ALIS";
Sistem.EmirMiktari = miktar;
Sistem.EmirFiyati = Tavan;
Sistem.EmirSuresi = "GUN";
Sistem.EmirTipi = "Limit";
Sistem.EmirGonder();
adetFiyatToplam = adetFiyatToplam.Remove(0,1);
adetFiyatToplam = Sembol+";"+ miktar + ";" + SatisFiyatKademe0 + ";" + "A" + ";" + periyot +";"+atr + ";"+ multiatr + ";"+ para + ";"+ carpan;
SpotHisselerTxt[No] = adetFiyatToplam;
File.WriteAllLines("C:\\iDeal\\SPT.txt", SpotHisselerTxt);
var limit2 = (float)LimitPara-((float)miktar*(float)SatisFiyatKademe0);
Sistem.Parametreler[1] = limit2.ToString();
}
if ( sd.Equals("A") && SonYon== "F" && calis>0 && ((carpan>0 && carpan<10) || (carpan>10 && C[C.Count-3] > ST[C.Count-3])) && AlisLotKademe0>0 ) // yön poz kapatsa ve al sat yapma değilse 0 değilse sat
{
Sistem.EmirSembol = Sembol;
Sistem.EmirIslem = "SATIS";
Sistem.EmirMiktari = (float)adet;
Sistem.EmirFiyati = Taban ;
Sistem.EmirSuresi = "GUN";
Sistem.EmirTipi = "Limit";
Sistem.EmirGonder();
var para2 = Math.Ceiling((float)para+(((float)AlisFiyatKademe0-(float)maliyet)*(float)adet)); // satım işlemi sonrası kar ve zarar duruma göre paranın düzenlenmesi
adetFiyatToplam = adetFiyatToplam.Remove(0,1);
adetFiyatToplam = Sembol+";"+ "0"+ ";" + "0"+ ";" + "F" + ";" + periyot +";"+atr + ";"+ multiatr + ";"+ para2 + ";"+ carpan;
SpotHisselerTxt[No] = adetFiyatToplam;
File.WriteAllLines("C:\\iDeal\\SPT.txt", SpotHisselerTxt);
}
}
}
}
sadece al-sat noktalarının hesaplamasını tilson a çevirmeye çalışıyorum.....
Tilson ın sistemi de bu;
var opt1= Sistem.Parametreler[0];
var opt2= Sistem.Parametreler[1];
var T3 = Sistem.TillsonT3(opt1, opt2);
var C = Sistem.GrafikFiyatSec("Kapanis");
var SonYon = "";
var Sinyal = "";
for (int i= 1; i < Sistem.BarSayisi; i++)
{
if (T3[i] > T3[i-1]) Sinyal = "A";
if (T3[i] < T3[i-1]) Sinyal = "S";
if (SonYon != Sinyal && Sinyal != "")
{
SonYon = Sinyal;
Sistem.Yon[i] = Sinyal;
}
}
Sistem.Cizgiler[0].Deger = T3;
valla biri yardımcı olursa çok memnun olurum... ben yapamadım bir türlü
Ayrıca başka tavsiyeniz de olursa kodlar ile ilgili onu da ciddiye alırım.. :)