How to Create Your Own EAs and Indicators I
Post on: 16 Март, 2015 No Comment
![How to Create Your Own EAs and Indicators I How to Create Your Own EAs and Indicators I](/wp-content/uploads/2015/3/how-to-create-your-own-eas-and-indicators-i_2.png)
In today’s piece, we follow up from our article on the new MT4 Build 600 trading terminal to give you some insight as to some tools you can use to convert that strategy of yours into an expert advisor or MT4 indicator which can be used for trading on the Forex4you trading platform. Some of these tools are free while the rest will require payment for the software license.
In the first part which we publish today, we introduce one of the great tools out there which makes it easy to program your own EAs and indicators. This is the NoProgra EA Builder.
The NoProgra’s EA Builder is a distinct type of EA builder in the market today in the sense that it has the ability to natural human language into MQL4 code. What this means is that if the trader speaks English or other language, all that is needed is to enter the naturally spoken language, and NoProgra’s strategy algorithms will convert the natural language into MQL4, this creating the expert advisor(s) for you. To the best of my knowledge, this is the only software that does this. So how does this work?
NoProgra Custom Indicator Builder is a standalone module of NoProgra EA Builder. It uses a similar graphical interface that allows users to create custom indicators for MT4 using natural language (the way we speak). The natural language is translated to MQL4 by NoProgra so you don’t need to code or program in MQL. With NoProgra Custom Indicator Builder you can create your own indicators for MT4 and use them in NoProgra EA Builder.
NOPROGRA EA BUILDER FEATURES
- Use natural language to create your own expert advisors for MetaTrader.
- Great graphical user interface. No MQL or coding knowledge is required.
- Visual tool that empowers traders and coders to create EAs in seconds.
- Create complex eas using technical indicators, currency prices, candle signals, and logic connectors (AND OR).
- You can create eas that look at trading signals in different time frames and for multiple currency pairs.
- You can import well written existing custom indicators and use them in your EA.
- Create EAs and indicators faster
- Produces correct MQL code
- Supports 4 and 5 digits brokers
- With NoProgra EA Builder you dont need to learn MQL or EA programming to create your expert advisors. However, if you want to learn MQL, this is the perfect tool to see how trading conditions code work.
- Its the only expert advisor builder based on natural language.
- ECN compatible. You get to choose if you want an MT4 EA or an EA for an ECN platform.
- Keep your trading secrets to yourself. No need to share it with coders anymore, especially if you hope to sell the EAs. This reduces the fear of the security of the EAs being compromised.
- MetaTrader4 variables to manage EAs and indicators created.
- Features to create MT4 variables to be used during backtesting and optimization of created software.
- It comes with NoProgra Indicator Builder so you can create indicators without any programming
![How to Create Your Own EAs and Indicators I How to Create Your Own EAs and Indicators I](/wp-content/uploads/2015/3/how-to-create-your-own-eas-and-indicators-i_1.png)
Examples of Indicators Built With NoProgra
Here we will show you three examples of expert advisors built with the NoProgra EA Builder After purchase, you will find these EAs under the NoProgra installation directory. To use these expert advisors in MetaTrader, you need to open the .trs file with the NoProgra EA Builder (.trs is the file extension for EAs built with the NoProgra EA Builder, and means TRading Strategy). These files have to be converted to the .mq4 or .ex4 files for them to work in the MT4 platform. Once you open the .trs file, you will see the strategy in NoProgra EA Builder. You then have to generate the EA using the NoProgra EA Builder.
1st Example: Moving Average Expert Advisor (MovingAverage.trs)
This is the simpler and easier EA that you can build. The logic is first written out in the natural human language (which in this case is English) on the left hand side of the interface. We want to set a trading signal based on the moving average indicator. This is essentially a moving average cross strategy with two moving averages (7-day and 21-day), where we want to create a trading algorithm in which the shorter moving average should cross the longer moving average, and the direction of the cross will then indicate the direction that the trading signal should be going.
- Long Signal: Go long (Buy) if the moving average with a period of 7 is higher than the moving average with a period of 21.
- Short Signal: Go Short (Sell) if the moving average with a period of 7 is lower than the moving average with a period of 21.
Both MA values are calculated using the close price of the previous bar (or 1 bar ago) since the EA will trade at the open of the next candlestick.
2nd Example: Moving Average with ADX Expert Advisor (MovingAverageADX.trs)
Here we have a second example, which seeks to create an EA that combines the previous EA in the 1st example, but with an added filter in the form of a signal from the Average Directional Index (ADX) indicator. The ADX is used to detect the trend of a currency pair. When ADX is high, it means that the market is trending. The ADX itself does not tell you the direction of the market, and this is what the moving average indicator is going to do. So using the 2 moving averages along with the ADX indicator picks the trend of the asset, as well as the direction of the trend. So the logic written out in natural language is as follows:
- Long Signal: Go long (Buy) if the moving average with a period of 7 is higher than the moving average with a period of 21 AND ADX with a period of 14 is higher than 30.
- Short Signal: Go Short (Sell) if the moving average with a period of 7 is lower than the moving average with a period of 21 AND ADX with a period of 14 is higher than 30.
The MA-ADX expert advisor will open positions when both trading conditions are true at the same time. Thus the MA condition AND the ADX condition need to be true to trigger a new order.
3rd Example: Moving Average with ADX modified Expert Advisor (MovingAverageADX2.trs)
We go further to add another filter to the EA created in the second example, because we discover that the previous MA-ADX EA has an undesired effect of not always picking up trade opportunities, thus leaving money on the table. Let’s say that the moving average with a period of 7 was higher than the moving average with a period of 21 AND at the same time ADX with a period of 14 was higher than 30; and as a result a new long position (BUY) was opened.
Sometime later the market changed direction and moved against the opened position. At one point the moving average with a period of 7 is lower than the moving average with a period of 21 but ADX with a period of 14 is lower than 30 and nothing happens. Why? Both conditions need to be true for the EA to close the long (BUY) position and open a new short (SELL) position. Since ADX is lower than 30 nothing happens.
To avoid this behavior we can add some trading conditions to close opened positions when the market changes directions (regardless of ADX values).
So to take care of this problem, we do something very simple. We add exit filters to the EA structure by adding two new components: an Exit long position and Exit short position:
- Go long (Buy) if the moving average with a period of 7 is higher than the moving average with a period of 21 AND ADX with a period of 14 is higher than 30.
- Exit long position (Close previous BUYs) if the moving average with a period of 7 is lower than the moving average with a period of 21
- Go Short (Sell) if the moving average with a period of 7 is lower than the moving average with a period of 21 AND ADX with a period of 14 is higher than 30.
- Exit short position (Close previous SELLs) if the moving average with a period of 7 is higher than the moving average with a period of 21
Please note that if you are not hedging, the EA closes all long positions before opening a new short position; in a similar way the EA closes all short positions before opening a new long position.
Creating Custom Indicators
To create your own custom indicator, just follow a simple process:
- Run the Custom Indicator Module(NoPrograCIB)
- Add an Indicator Signal: A signal is a line, icon, or histogram that represents an Indicator Formula.
- You need to define the formula for your custom indicator. Add a formula to the Indicator Signal: Indicators are based on formulas that use prices and/or volume. For example the formula for a moving average may look like: MA = (Close Price in bar 1 + Close Price in bar 2 + … + Close Price in bar n)/n
- Generate your custom indicator. Pay attention to the signal number. A MetaTrader4 indicator can have up to 8 signals, with signals numbers from 0 to 7. You need to know the signal number to be able to use the indicator in an Expert Advisor.
- Find the custom indicator in MetaTrader4. Look for it under custom indicators.
- Attach the indicator to a chart.
- When you generate the custom indicator code, you will see a message with the signals and the way to identify them.
- The custom indicator will be saved under MetaTrader Directory/experts/indicators
- Go to the EA Builder, select the custom indicator option
- Import the custom indicator
When creating custom indicators for MT4, you need to take into account the following factors:
- Custom Indicators must be placed in the directory MetaTrader Directory/experts/indicators
- A custom indicator cannot trade
- A custom indicator uses historical information of prices and volume
- Historical information only uses 4 prices per bar: open, close, high and low. It does not use all the prices between open and close
- To reference bars, MetaTrader4 user an index as follows:
- 0 is the current bar
- 1 is the previous bar
- 2 is the bar before the previous bar
- 3 is bar preceding 2, etc
- The index is used in the formula – it’s always between [ and ]
- [i+0] means use current bar info
- [i+1] means use previous bar
- [i+2] means use the bar before the previous bar
- [i+3]…
- Custom indicators for MetaTrader can have up to 8 signals
- Each signal has a number to identify it
- In MetaTrader signals can be plotted on the chart or below the chart.
- In a custom indicator, all signals have to be plotted in the same way. You cannot have one indicator that plots a signal on the chart and another signal below the chart. If you need to display the signals in different ways, you need to create two indicators.
- If your custom indicator formula uses / (Divide by as in a/b), you can have “division by zero issues”. To avoid them make sure to use this pattern a/(b+0.0000000000001) Add a really small number to avoid division by zero, make sure it does not affect your formula.
INSTALLATION AND USE
noprogra.com/download-ea-builder. Execute the installer and install the NoProgra under C:NoProgra folder.
Once you are through with the installation, you can then create your MT4 directory according to the guidelines under which the new MT4 Build 600 runs.
After generating the EA code with NoProgra, you can also back test your expert advisor to ensure it works as expected. Use MetaTrader variables to optimize it.
The software comes with a free 4 day trial and a 7 day money back guarantee. The software is available for $127 at noprogra.com.
In the next part of this article, we will bring 2 more examples of EA builders that can help you turn your ideas for an EA into a reality without the use of programming language.