DecBinHex





//+------------------------------------------------------------------+
//|                                                    DecBinHex.mq4 |
//|                                                             Itso |
//|                                                      itso@dir.bg |
//+------------------------------------------------------------------+
#property copyright "Itso"
#property link      "itso@dir.bg"
#property library
//+------------------------------------------------------------------+
//| My functions                                                     |
//+------------------------------------------------------------------+
string DecToBin(int n)
  {
   string s = "";
   while(n != 0)
     {
       s = CharToStr(n % 2 + '0') + s;
       n = n / 2;
     }
   return(s);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int BinToDec(string s)
  {
   int p = 0, i;
   for(i = 0; i < StringLen(s); i++)
     {
      p = p*2 + StringGetChar(s,i) - '0';
     }
   return(p);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string DecToHex(int n)
  {
   string s = "", c;
   while(n != 0)
     {
      if(n%16 < 10)
          c = CharToStr(n % 16 + '0');
      else 
          c = CharToStr(n % 16 + 'A'-10);
      s = c + s;
      n = n / 16;
     }
   return(s);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int HexToDec(string s)
  {
   int p = 0, c, i;
   for(i = 0; i < StringLen(s); i++)
     {
       if((StringGetChar(s, i) >= '0') && (StringGetChar(s, i) <= '9'))
           c = StringGetChar(s, i) - '0';
       else 
           if((StringGetChar(s, i) >= 'A') && (StringGetChar(s, i) <= 'F'))
               c = StringGetChar(s, i) - 'A' + 10;
           else 
               if((StringGetChar(s, i) >= 'a') && (StringGetChar(s, i) <= 'f'))
                  c = StringGetChar(s, i) - 'a' + 10;
               else
                   return(-1);
       p = p*16 + c;
     }
   return(p);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: