18.01.13
|
Mitglied
|
|
Registriert seit: Mar 2012
Ort: Wien
Beiträge: 191
|
|
Peroid Converter
Anbei ein Codeschnipsel zum Convertieren von Perioden
vom String (H4) zu minuten und umgekehrt
vl kanns jemand brauchen
Code:
//+------------------------------------------------------------------+
//| String2Period |
//+------------------------------------------------------------------+
int String2Period (string Input)
{
if (Input == "M1") int iPeriod = 1;
if (Input == "M5") iPeriod = 5;
if (Input == "M15") iPeriod = 15;
if (Input == "M30") iPeriod = 30;
if (Input == "H1") iPeriod = 60;
if (Input == "H4") iPeriod = 240;
if (Input == "D1") iPeriod = 1440;
if (Input == "W1") iPeriod = 10080;
return(iPeriod);
}
//+------------------------------------------------------------------+
//| Period2String |
//+------------------------------------------------------------------+
string Period2String (int Input)
{
if (Input == 1) string strPeriod = "M1";
if (Input == 5) strPeriod = "M5";
if (Input == 15) strPeriod = "M15";
if (Input == 30) strPeriod = "M30";
if (Input == 60) strPeriod = "H1";
if (Input == 240) strPeriod = "H4";
if (Input == 1440) strPeriod = "D1";
if (Input == 10080) strPeriod = "W1";
return(strPeriod);
}
|