Chcę aby EA zapisywało też wartość RSI z każdej świecy.
Dopisałem do EA coś takiego:
Kod: Zaznacz cały
if (ws) wyj = wyj + delimiter+iCustom(NULL,0,"Stochastic",KPeriod4,DPeriod4,Slowing4,pos,0);
Dlaczego w pliku zapisuje sie to tylko tak: (a później same zera, ostatnia kolumna)
2010.05.28,00:00,1.23450000,1.24530000,1.22810000,1.23100000,20880.00000000,22.02019161
2010.05.27,00:00,1.21730000,1.23940000,1.21630000,1.23440000,27318.00000000,20.76777157
2010.05.26,00:00,1.23430000,1.23580000,1.21530000,1.21710000,26588.00000000,1.26720000
2010.05.25,00:00,1.23490000,1.23870000,1.21770000,1.23430000,32336.00000000,1.21430000
2010.05.24,00:00,1.25330000,1.25450000,1.23320000,1.23470000,49221.00000000,0.00000000
2010.05.23,00:00,1.25440000,1.25620000,1.25310000,1.25340000,3471.00000000,0.00000000
2010.05.21,00:00,1.24820000,1.26720000,1.24700000,1.25690000,53023.00000000,0.00000000
2010.05.20,00:00,1.23870000,1.25970000,1.22960000,1.24830000,47616.00000000,0.00000000
2010.05.19,00:00,1.21820000,1.24300000,1.21430000,1.23860000,42540.00000000,0.00000000
2010.05.18,00:00,1.23890000,1.24440000,1.21570000,1.21810000,32821.00000000,0.00000000
2010.05.17,00:00,1.23700000,1.24140000,1.22330000,1.23900000,25133.00000000,0.00000000
2010.05.16,00:00,1.23550000,1.23720000,1.23440000,1.23710000,837.00000000,0.00000000
2010.05.14,00:00,1.25370000,1.25750000,1.23580000,1.23790000,21871.00000000,0.00000000
2010.05.13,00:00,1.26310000,1.26840000,1.25150000,1.25370000,19387.00000000,0.00000000
2010.05.12,00:00,1.26300000,1.27390000,1.26050000,1.26310000,22100.00000000,0.00000000
2010.05.11,00:00,1.27780000,1.28020000,1.26150000,1.26310000,29184.00000000,0.00000000
2010.05.10,00:00,1.28770000,1.30940000,1.27580000,1.27790000,43308.00000000,0.00000000
tu podaje cały kod EA
Kod: Zaznacz cały
//+------------------------------------------------------------------+
//| EA_export.mq4 |
//| Jacek W. |
//| Subversor |
//+------------------------------------------------------------------+
#property copyright "Ver 3.5 "
#property link "Subversor jacekwn@gmail.com"
//---- input parameters
extern int last_X=500;
extern string delimiter = ",";
extern bool data_czas_osobno = true;
extern bool op = true;
extern bool hi = true;
extern bool lo = true;
extern bool cl = true;
extern bool vo = true;
extern bool ws = true;
extern string name = "dane.csv";
// Stochastic4 filtr
extern string StochasticInfo4Filtr = "Stochastic";
extern int KPeriod4=12;
extern int DPeriod4=9;
extern int Slowing4=26;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if (StringLen(delimiter)!=1){
Print("Delimiter musi miec 1 znak");
return;
}
string linia;
int handler;
if(!NewBar()) return;
//handler =FileOpen(name,FILE_CSV|FILE_WRITE,delimiter);
handler =FileOpen(name,FILE_CSV|FILE_WRITE,delimiter);
if (handler<1){
Print("blad otwarcia pliku");
return;
}
for (int i=0;i<last_X;i++){
linia = get_linia(i);
FileWrite(handler,linia);
}
FileClose(handler);
//----
return(0);
}
//+------------------------------------------------------------------+
string get_linia(int pos){
string wyj;
if (data_czas_osobno){
wyj = TimeToStr(Time[pos],TIME_DATE);
wyj = wyj +delimiter;
wyj = wyj +TimeToStr(Time[pos],TIME_MINUTES);
}else{
wyj = TimeToStr(Time[pos],TIME_DATE|TIME_MINUTES);
}
if (op) wyj = wyj + delimiter+Open[pos];
if (hi) wyj = wyj + delimiter+High[pos];
if (lo) wyj = wyj + delimiter+Low[pos];
if (cl) wyj = wyj + delimiter+Close[pos];
if (vo) wyj = wyj + delimiter+Volume[pos];
if (ws) wyj = wyj + delimiter+iCustom(NULL,0,"Stochastic",KPeriod4,DPeriod4,Slowing4,pos,0); //<--tu
return(wyj);
}
bool NewBar()
{
static datetime lastbar = 0;
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return (true);
}
else
{
return(false);
}
}