Einzelnen Beitrag anzeigen
  #1 (permalink)  
Alt 18.01.13
Deepack Deepack ist offline
Mitglied
 
Registriert seit: Mar 2012
Ort: Wien
Beiträge: 191
Deepack befindet sich auf einem aufstrebenden Ast
Deepack eine Nachricht über Skype™ schicken
Standard 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);
}