Imagine you want to use an indicator which is not in the indicator list of ESB, you’ll only need to copy your indicator ( and its Source Code) in Meta Trader “Indicators” folder (Go to “File Menu > Open Data Folder” and then MQL4 > Indicators) and create a custom indicator with its name in ESB. This way, you have access to the output of this indicator. Suppose you need to add ABC indicator that has 3 parameters (period=14, k=5, m=3). Just copy “ABC.mq4” and “ABC.ex4” in “Indicators” folder and then create an indicator, for example, Name=adr1 and write in parameters field like this format:
If ABC draws 2 lines (for example mainline and signal line) on the chart. The line indexes start from zero. for access to the first-line write:
And for obtain second line value:
To ensure parameters, check the value of the indicator in the indicators window and compare it with the real value of indicator on the chart. Note that the ordering of the parameters is in accordance with their order in the indicator file.
|Custom Indicator||name, line index,param1,param2,…|
Custom indicator input-parameters, separated by commas. The passed parameters and their order must correspond with the declaration order of inputs of the custom indicator. If the values of input parameters are not specified, the default values will be used.
Let’s have an example. Imagine we have a custom moving average indicator. Filename is “CMA.ex4” or “CMA.ex5”. We copy this file and its source code in the Indicators folder in MetaTrader. Let’s assume our custom indicator is like the image below:
As can be seen, this indicator has 3 inputs. Be noted that for the third option, the value is not “Smoothed”. It is like this: “Simple” is 0. “Exponential” is 1. “Smoothed” is 2 and “Linear” is 3. This way of indexing works for almost indicators. Sometimes indicator’s developer uses different value for each option rather than using consecutive 0,1,2. For example maybe first option is 256, second is 512 and third is 1024 and so on. In this case store indicator’s settings on set file and then open set file in notepad and find that specific settings and see the value. Use same value in ESB as well for that option.
If we want to use this indicator with above settings, the parameters for the custom indicator will be like this:
First 0 is the buffer number. We assumed we need the first buffer of this indicator. Settings of indicators are 13,0,2. In this case, we assume the last option on “Smoothed”.
Be noted that ESB doesn’t support string or text as input. Remove them from the inputs (in indicator source code) or pass 0 as the value. Also for Booleans, set 1 for true and use 0 for false.
Custom Indicator Signal Arrow:
Some indicators use arrows to show signals. When you add such a indicator to chart, it draws arrows for some of the candles that tell trader there is a signal on that specific candle. For using this kinds of indicators, you can use Custom Indicator and then for detecting candles which have arrow you have to write an expression like this:
Ind1>0 AND Ind1 <> EMPTY
I assumed name of indicator is Ind1. ESB has another type of Custom Indicator that can do this automatically and no need to write an expression. “Custom Indicator Signal Arrow” can check the indicator and if there is a signal, it returns 1 otherwise 0. All option and settings are exactly same as Custom Indicator.
|Custom Indicator Signal Arrow||name, buffer index,param1,param2,…|
Some Indicators have one arrow for buy and one arrow for sell. You need to know the buffer number of each one to set in ESB. Most of the times, Buffer 0 and 1 are for buy and sell but you can find buffer number from source code or by trying all possible numbers.
Imagine you set two indicators like this:
Type: Custom Indicator Signal Arrow
Parameters: ABC, 0
Type: Custom Indicator Signal Arrow
Parameters: ABC, 1
As I assumed again buy signal is in buffer 0 and sell signal is in buffer 1 of the custom indicator.
For open positions using this indicator write Buy/Sell Expressions in Step 2 like this:
Buy Expression: buysig
Sell Expression: sellsig
Now, Imagine you have an RSI as well and you want to say if RSI<30 and there is a buy arrow then open buy. Buy Expression will be like this:
buysig AND RSI<30
The last point to mention here is about shift. Some indicators are repaint that means they continuously change position of the arrow. In this case we shouldn’t use shift 0 because shift 0 means current candle and it’s not stable yet. It is better to use Shift 1 that is for one candle before current candle. By this way, we are sure candle 1 is stable and what we get from indicator won’t be changed. Still, you can use Shift 0 but very likely you will get some signals that there is no any arrow there!
Custom Indicator without Source Code:
Sometimes you have a custom indicator but you don’t have its source code. We suppose this custom indicator draws some lines or objects on the chart. For example, maybe it draws a trend line or maybe it draws arrows on the chart or puts some labels. If you can read the value of these objects, then you can get the perfect signal from them. To read the value of those objects you can use Custom Indicator by Object. This indicator needs 5 parameters which are:
Color, prefix, include, newer_than, sub_window, id, code
Whatever you know about the indicator you should feed to this indicator. For example, if the indicator draws some blue arrows on the chart and there is a prefix at the beginning of the name of these blue arrows. For example, the name of the arrows is like ABC1323, ABC346735, ABC32568, … and these arrows names include a specific word like CDF, you can detect them like this: Blue, ABC, CDF
If you want just find object which are newer than N seconds ago, for example only objects which are created by indicator from 60 seconds ago: Blue, ABC, CDF, 60
If this arrows or objects are drawn in sub window, you can set id of sub window by “sub_window” parameter. Main chart is 0 and first “sub_window” is 1 and next 2 and so on.
The next parameter is price id or line id which helps ESB to try to find other values of multi object indicators.
The last parameter is code which is arrow code if object is arrow. If different type of arrows are drawn and you want just one of them, this could help.
Note: if you don’t have some of these data, just leave them empty. For example, you know the color, and you want only objects created last minute: Blue,,,60
Note: For this indicator shift is important. If you set shift on -1, it find first object doesn’t matter on which candle. But if shift is equal or greater than zero, it only checks for that candle and if there is no object on that candle, it returns zero.
Note: color should be exact color. The list of color names is available in the link below:
|Custom Indicator By Object||Color, prefix, include, newer_than, sub_window, id, code|