Author: Copyright � 2008, Nazariy S. (WWer)
Percenter

This tool is designed to help users quickly calculate and project financial growth or decay based on various interest types. Instead of manually performing complex math, the script provides an instant calculation showing the final ratio—essentially telling you how many times your initial amount will increase or decrease by the end of a specific period.

How it Works

The logic is centered around four distinct mathematical methods for calculating growth. Depending on which method you select, the script processes the interest rate, the number of periods, and (in some cases) the frequency of compounding differently:

  • Simple Interest: This calculates growth based only on the original principal. It is used for straightforward loans or basic investments where the interest earned does not earn additional interest in subsequent periods.
  • Compound Interest: This reflects "interest on interest." The script calculates how much your total balance grows when the interest earned is reinvested at the end of every period.
  • Nominal Interest: This logic is used when you have a specific annual rate that is compounded multiple times per year (for example, monthly or quarterly). It allows you to see the effective growth based on those frequent compounding intervals.
  • Growth Power: This uses a continuous compounding model. It provides a calculation for growth that happens constantly and instantaneously, rather than at fixed intervals, which is often used in specific advanced financial and biological modeling.

Key Inputs

To get an accurate result, the tool requires four pieces of information:

  1. The Rate: The interest rate expressed as a decimal.
  2. Total Periods: How long you are letting the investment or debt sit.
  3. Compounding Frequency: (Optional) Used specifically for nominal rates to define how often the interest is applied within a year.
  4. The Method: Your choice between the four calculation types listed above.

The Result

Once executed, the tool provides a single numerical output. Rather than showing you a currency amount, it shows you a multiplier. For example, if the result is 1.50, it means your money will be 1.5 times its original size at the end of the period. If the result is less than 1, it indicates a decrease in value.

Miscellaneous
It issuies visual alerts to the screen
9 Views
0 Downloads
0 Favorites
Percenter
//+------------------------------------------------------------------+
//|                                                    Percenter.mq4 |
//|                              Copyright © 2008, Nazariy S. (WWer) |
//|                         E-mail: nazariy@i.ua, Skype: nazariy1309 |
//+------------------------------------------------------------------+
//| Ñêðèïò ïðåäíîçíà÷åí äëÿ âû÷èñëåíèÿ ïðîñòûõ, ñëîæíûõ, íîìèíàëüíûõ |
//| è íåïðåðûâíî íà÷èñëÿåìûõ ïðîöåíòîâ.                              |
//| Ñêðèïò âûâîäèò îòíîøíèå ñóììû â êîíöå ïåðèîäà ê òåêóùåé ñóììå,   |
//| òîåñòü ïîêàçûâàåò âî ñêîëüêî ðàç îíà óâåëè÷èòñÿ/óìåíøèòñÿ.       |
//| Ñïîñîá íà÷èñëåíèÿ ïðîöåíòîâ çàäàåòñÿ ïàðàìåòðîì method:          |
//|   1 - Ïðîñòàÿ ïðîöåíòíàÿ ñòàâêà                                  |
//|   2 - Ñëîæíàÿ ïðîöåíòíàÿ ñòàâêà                                  |
//|   3 - Íîìèíàëüíàÿ ïðîöåíòíàÿ ñòàâêà                              |
//|   4 - Ñèëà ðîñòà                                                 |
//| Ïîäðîáíåå ïðî ïðîöåíòû âû ìîæåòå íàéòè çäåñü:                    |
//|   http://ru.wikipedia.org/wiki/Ïðîöåíòíàÿ_ñòàâêà                 |
//+------------------------------------------------------------------+
#property copyright   "Copyright © 2008, Nazariy S. (WWer)"
#property link        "E-mail: nazariy@i.ua, Skype: nazariy1309"
#property show_inputs

#define E 2.71828182845904523536

extern double i;        // ïðîöåíòíàÿ ñòàâêà, âûðàæåííàÿ â äîëÿõ
extern int    n,        // ÷èñëî ïåðèîäîâ íà÷èñëåíèÿ
              m,        // ÷èñëî ïåðèîäîâ íà÷èñëåíèÿ (äëÿ method=3)
              method=2; // ñïîñîá íà÷èñëåíèÿ ïðîöåíòîâ

//+------------------------------------------------------------------+
//| Ô-öèÿ Percent() äëÿ âû÷èñëåíèÿ ïðîöåíòîâ.                        |
//+------------------------------------------------------------------+
double Percent(double i, int n, int m=-1, int method=2)
  {
   double res=0.0;
   switch(method) {
     case 1:  res=n*i+1;
              break;
     case 2:  res=MathPow(1+i,n);
              break;
     case 3:  res=MathPow(1+i/m,m*n);
              break;
     case 4:  res=MathPow(E,i*n);
              break;
     default: return(0);
    }
   return(res);
  }

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   Alert(DoubleToStr(Percent(i,n,m,method),8));
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments