Hy coders!
Can anyone of you help me with a code snippet?
I will implement a routine "write actual equity into a log file (.csv)" every hour. Data shall contain:
Date, Time, Forex Pair, Equity
Greetings from Hamburg/Germany,
Dietmar
write actual equity into a log file (.csv)
- forextrader-radioman
- Trader
- Posts: 156
- Joined: Sun Nov 27, 2011 11:11 am
- Location: Hamburg/Germany
write actual equity into a log file (.csv)
„Reality is merely an illusion, albeit a very persistent one.” (Albert Einstein) "Realität ist lediglich eine Illusion, allerdings eine sehr hartnäckige."
-
fxprotrader
- Trader
- Posts: 26
- Joined: Sat Jun 16, 2012 11:26 pm
Re: write actual equity into a log file (.csv)
Dietmar-forextrader-radioman wrote:Hy coders!
Can anyone of you help me with a code snippet?
I will implement a routine "write actual equity into a log file (.csv)" every hour. Data shall contain:
Date, Time, Forex Pair, Equity
Greetings from Hamburg/Germany,
Dietmar
The following is a code snippet that includes the log function.
Put it on an H1 chart and it will log once per hour
Code: Select all
datetime bartime=0;
if(bartime!=Time[0]){
bartime=Time[0];
string TF = GetTimeFrameStr();
datetime dSymTime = (iTime(Symbol(),Period(),i));
int dDayofWk = (TimeDayOfWeek(Time[i]));
string TradeInfo =action+","+ DoubleToStr(ArrowPips,0)+"/"+DoubleToStr(TradeSizeSL,0)+"/"+DoubleToStr(TradeSizeTP,0);
//call the log function
logwrite(Symbol()+" "+TF,TimeToStr(Time[i], TIME_DATE)+","+TimeToStr(Time[i], TIME_MINUTES)+","+dDayofWk+","+i+","+Symbol()+","+TF+","+IndiResults+","+TradeInfo+","+text+"|");
}
//+------------------------------------------------------------------+
//| log function |
//+------------------------------------------------------------------+
void logwrite (string filename, string mydata){
int myhandle;
filename=filename+"_"+Symbol()+"_mysettings.txt";
myhandle = FileOpen(filename, FILE_CSV|FILE_WRITE|FILE_READ, ";");
if(myhandle>0){
FileSeek(myhandle,0,SEEK_END);
FileWrite(myhandle,mydata);
FileClose(myhandle);
}
}
- forextrader-radioman
- Trader
- Posts: 156
- Joined: Sun Nov 27, 2011 11:11 am
- Location: Hamburg/Germany
Re: write actual equity into a log file (.csv)
fxprotrader,fxprotrader wrote: Dietmar-
The following is a code snippet that includes the log function.
Put it on an H1 chart and it will log once per hour
[...]
many thanks for that! ... very nice
Dietmar
„Reality is merely an illusion, albeit a very persistent one.” (Albert Einstein) "Realität ist lediglich eine Illusion, allerdings eine sehr hartnäckige."
- niepce
- Trader
- Posts: 152
- Joined: Wed Jul 04, 2012 11:00 pm
- Location: Grenoble, France