Custom Indicator Design E-mail


To create a Custom Indicator for MT4 with Molanis Technical Indicator Builder, follow a 4 step process:

  • start block1. START: Click on the START block to select the location of the Custom Indicator. There are two possible options:
    In the chart window or In a separate window


In the chart - separated windw indicator

  • technical analysis trading block 2. Add TI blocks: Drag TI (Technical Indicator) blocks from the Indicator Block Library and drop them into an Indicator Diagram. Each TI block defines one indicator line. MetaTrader allows up to eight (8) indicators lines in one custom indicator. This means that you can create one custom indicator that draws eight (8) lines, each one based on its own mathematical calculation.
  • 3. Click on each TI block to define the indicator values (parameters) and calculation. Use Molanis’ Indicator Calculation Editor to create the mathematical calculations (indicator formula).
  • 4. Click on Generate MQL code to create the Custom Indicator.


Creating the Indicator Calculation

Unfortunately, technical indicators use mathematical calculations on prices and volume so you need to learn some math and syntaxes to create custom indicators. Nevertheless, Molanis Technical Indicator Builder has features that simplify this process like an especial editor to help you write complex mathematical calculations.


Bar Identification
A currency graph shows the change in prices over a period of time. Bars (or candles) are used in currency graphs because they are able to represent visually four currency prices: Open, Close, High and Low. Most of the time, custom indicators are the product of the combination of these prices and mathematical formulas. Some times the volume associated to the bar prices is also used.

Current Bar or Previous Bar?
To be able to make calculations using previous bars information (prices and volume), an index i is used. Adding numbers to the index i allows you to identify the bars to be used in the indicator calculation.

i: It is a reference for the current, not totally formed bar. i should be used as a reference to get the information of completed / previous bars.
i+n, where n is any positive number is used to identify the bar painted n bars ago (or located n bars before the current bar)
i+1 identifies the previous bar (located 1 bar before the current bar)
i+2 identifies the bar painted before i+1, or 2 bars ago from the current bar (located 2 bars before the current bar)

The graph shows how the index is used to identify bars.

Bar Identification


The index should be used with any of the following options: Open, Close, High, Low, and Volume. For example:

Open: Open[i]: Open price for current bar (not completed – it’s the current bar that changes because it’s still not formed)
Open[i+1]: Open price for previous bar or bar located one bar before the current bar
Close[i+2]: Close price for bar located two bars before the current bar
High[i+3]: High price for bar located three bars before the current bar
Low[i+4]: Low price for bar located four bars before the current bar
Volume[i+3]: Volume price for bar located three bars before the current bar


Bar identification example

On a TI block, use the available buttons to write your calculation. While you create your calculation, Molanis Smart Calculation Algorithm helps you identifying the most common syntaxes errors.


Indicator Calculation Editor

Calculation Examples

-Shows the High price of every bar


-Shows the Open price of every bar

-Shows the average of High and Low price of every bar

-Shows the average of Open for current bar and Close for previous bar

-Shows the average of the Close price of the last three bars (including current bar identified with i). Moving average indicator with period=3.
(Close[i]+ Close[i+1]+ Close[i+2])/3


-Momentum Indicator with period=5


-Volume Rate of Change with period=1


Advanced Formula Features


The advanced formula features allows you to get the Highest, Lowest, and Average value of any calculation.

Advanced Examples

-Moving average of open price with a period of 18: Create a calculation equal to Open[i], select Average as the Advanced Formula and select 18 as the Advanced Period.

-Get the highest high from the last four bars: Create a calculation equal to High[i], select Highest as the Advanced Formula and select 4 as the Advanced Period.

-Get the lowest low from the last five bars: Create a calculation equal to Low[i], select Lowest as the Advanced Formula and select 5 as the Advanced Period.

-Get the highest of the difference between high and low prices with a period of 10: Create a calculation equal to High[i]-Low[i], select Highest as the Advanced Formula and select 10 as the Advanced Period.


Custom indicator advanced formula

How to integrate my Custom Indicators with Molanis Strategy Builder?

You can use your custom indicators with Molanis Strategy Builder. Just use a TA block, select Custom Indicators – iCustom and click on Import Indicator.





Quick Links