Da haste aber Glück.
Code:
//+------------------------------------------------------------------+
//| Stundenkerze.mq4 |
//| Copyright © 2012, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property show_inputs
extern string Currency1 = "EURUSD";
extern string Currency2 = "EURJPY";
extern string Currency3 = "GBPUSD";
extern string Currency4 = "USDCHF";
extern string Currency5 = "GBPJPY";
extern string Currency6 = "USDJPY";
extern string Currency7 = "AUDUSD";
extern string Currency8 = "USDCAD";
extern string Currency9 = "EURCHF";
extern string Currency10 = "GBPCHF";
extern int DayHour = 5;
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
if (DayHour >= TimeHour(TimeCurrent()))
{
Print ("Error, DayHour has incorrect value!");
return(0);
}
int shift=iBarShift(Currency1, 60, TimeCurrent() - ((TimeHour(TimeCurrent()) - DayHour) * 3600));
string File = "Stundenkerze_"+TimeToStr(TimeCurrent(),TIME_DATE)+".txt";
int handle=FileOpen(File,FILE_CSV|FILE_READ,';');
if(handle<1)
{
handle = FileOpen(File,FILE_CSV|FILE_WRITE,';');
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency1, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency1, 60, shift), "Low",iLow(Currency1, 60, shift), "Open",iOpen(Currency1, 60, shift), "Close", iClose(Currency1, 60, shift));
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency2, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency2, 60, shift), "Low",iLow(Currency2, 60, shift), "Open",iOpen(Currency2, 60, shift), "Close", iClose(Currency2, 60, shift));
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency3, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency3, 60, shift), "Low",iLow(Currency3, 60, shift), "Open",iOpen(Currency3, 60, shift), "Close", iClose(Currency3, 60, shift));
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency4, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency4, 60, shift), "Low",iLow(Currency4, 60, shift), "Open",iOpen(Currency4, 60, shift), "Close", iClose(Currency4, 60, shift));
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency5, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency5, 60, shift), "Low",iLow(Currency5, 60, shift), "Open",iOpen(Currency5, 60, shift), "Close", iClose(Currency5, 60, shift));
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency6, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency6, 60, shift), "Low",iLow(Currency6, 60, shift), "Open",iOpen(Currency6, 60, shift), "Close", iClose(Currency6, 60, shift));
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency7, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency7, 60, shift), "Low",iLow(Currency7, 60, shift), "Open",iOpen(Currency7, 60, shift), "Close", iClose(Currency7, 60, shift));
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency8, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency8, 60, shift), "Low",iLow(Currency8, 60, shift), "Open",iOpen(Currency8, 60, shift), "Close", iClose(Currency8, 60, shift));
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency9, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency9, 60, shift), "Low",iLow(Currency9, 60, shift), "Open",iOpen(Currency9, 60, shift), "Close", iClose(Currency9, 60, shift));
FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE), Currency10, "Uhrzeit "+DayHour+" Uhr", "High", iHigh(Currency10, 60, shift), "Low",iLow(Currency10, 60, shift), "Open",iOpen(Currency10, 60, shift), "Close", iClose(Currency10, 60, shift));
FileClose(handle);
Print ("File created successfully!");
Comment ("File created successfully!");
}
else
{
Print ("File already exist, abort!");
Comment ("File already exist, abort!");
}
Sleep(2000);
Comment ("");
return(0);
}
//+------------------------------------------------------------------+
Script nach .../experts/scripts kopieren.
Im MT4 Script auf irgend einen Chart ziehen.
Übrigens, 24:00 Uhr gibt es nicht. Hier 0:00 Uhr verwenden (Stunde 0).