NoProgra EA Builder - Expert Advisor Examples

NoProgra EA Builder comes with three expert advisors examples to get you started. You can find them under the directory where NoProgra was installed. To use these expert advisors in MetaTrader, you need to open the trs file with NoProgra EA Builder (trs is the file type or file extension for NoProgra EA Builder EAs, it means TRading Strategy). Once you see the strategy in NoProgra EA Builder, you need to generate the EA. You will get the EA for MetaTrader (.mq4 and .ex4 files). TRS files cannot be used in MetaTrader.

Moving Average Expert Advisor (MovingAverage.trs)
This is the simpler and easier EA that you can build.

The logic in Natural Language is straight forward:

  • Go long (Buy) if the moving average with a period of 7 is higher 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.

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 (when a new bar starts).

MA-EA

 

Moving Average with ADX Expert Advisor (MovingAverageADX.trs)
This expert advisor takes the previous EA and adds an ADX filer. ADX is used to detect trends. When ADX is high, the market is trending – ADX does not tells you the direction of the market – you get it using the moving average indicator.
The logic in Natural Language is similar to the MA ea:

  • 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.
  • 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.

MA-ADX-EA

 

Moving Average with ADX modified Expert Advisor (MovingAverageADX2.trs)
The previous MA-ADX ea has an interesting behavior that is not always desired. 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.

Some time 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).   
 
The expert advisor described in Natural Language has two new components 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.
  • 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 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
  • 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

Note how in the MA, and MA-ADX examples we did not use Exit long position and Exit short position. Why? We do not need them. 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.

MA-ADX--EA-MOD