Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Skripte (http://www.expert-advisor.com/forum/forumdisplay.php?f=26)
-   -   Peroid Converter (http://www.expert-advisor.com/forum/showthread.php?t=2643)

Deepack 18.01.13 21:01

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);
}



Alle Zeitangaben in WEZ +1. Es ist jetzt 23:07 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum