Templates to create EAs and Indicators - page 4

 

Do not know if it exists. Here is a one time solution: Open your template with NotePad and then scroll through and note the indicators on a piece of paper.

 

no

this is human parser, but I'm a bit lazy....

 

A better way than the one suggested is to copy and paste your expert/indicators list into notepad and then open a new chart and post the templates one at a time and check mark the ones you are using in templates. Return to your expert/indicators folder and delete those that are custom that are not being used.

Been doing this for 18 years and this is how I used to do it. Takes less than 10 minutes to complete. It also saves a lot of space.

These days, I use one separate MT4 platform for each system I test. My trading system that I currently trade requires over 80+ templates and roughly 25 custom indicators to run (yes, one system).

 

parser

I finaly used pspad to extract lines with indicators (name=) from all the templates, then edit with vim to remove non used pattern (:g/pattern_toremove/d) then reedit with pspad to insert robocopy command (could be done in vim)

I delete all the indicators from my mt4 directory, then copy used only indicators with the bat, from the backup.

And everything Ok.

 

Templates to create EAs and Indicators - MT4

The forum

  1. Some good templates - the thread 
  2. function of "mql4 code" - the thread  

The articles 

  1. MetaEditor:Templates as a Spot to Stand On   
  2. Idleness is the Stimulus to Progress. Semiautomatic Marking a Template   
  3. Universal Expert Advisor Template

CodeBase

  1. Expert Advisor Template with Trailing Stop v2 - expert for MetaTrader 4 
  2. Basic ATR based take and stop expert adviser - expert for MetaTrader 4
  3. Basic expert adviser with trailing stop - expert for MetaTrader 4
  4. Basic Moving Average template - expert for MetaTrader 4
  5. Basic Moving Average template - expert for MetaTrader 4
  6. Grid Template EA - expert for MetaTrader 4
  7. Basic Rsi Template EA - expert for MetaTrader 4
  8. Template Name - indicator for MetaTrader 4 
  9. News EA Template without DLL - expert for MetaTrader 4 
  10. News EA Template Without DLL From 2 Sources - expert for MetaTrader 4
  11. EA Template - expert for MetaTrader 4
  12. Robust EA Template - expert for MetaTrader 4

============

Basic Moving Average template
Basic Moving Average template
  • www.mql5.com
PricerEA PricerEA is a utility to help any trader to place pending orders (stop or limit) at a specific price. SpreadWatch This indicator watches and displays the biggest spread the pair generated. It is recommended to run at least 5 days, from Monday to Friday, to get a big picture of the broker's spread. My Trailing Simple Trailing...
 

Basic Moving Average template - expert for MetaTrader 4

Basic Moving Average template - expert for MetaTrader 4

Basic Moving Average template EA - Signals from Moving Average indicator and trades accordingly. It's a template to use for further study or develop as you like.This template has all basics including money management to be fully functional in trading operations.

Basic Moving Average template
Basic Moving Average template
  • www.mql5.com
PricerEA PricerEA is a utility to help any trader to place pending orders (stop or limit) at a specific price. SpreadWatch This indicator watches and displays the biggest spread the pair generated. It is recommended to run at least 5 days, from Monday to Friday, to get a big picture of the broker's spread. My Trailing Simple Trailing...
 

Basic ATR based take and stop expert adviser - expert for MetaTrader 4

Basic ATR based take and stop expert adviser - expert for MetaTrader 4

With this template i'm demonstrating the use of Average True Range based take profit and stop loss levels. Take profit and stop loss levels are calculated using ATR factor multipliers.

----------------

The other templates:

Basic ATR based take and stop expert adviser
Basic ATR based take and stop expert adviser
  • www.mql5.com
Trend flex x 2 Multi Currency Template This is Multi Currency Expert Advisor Template that can trade according to symbol list (default 6 symbols). For Example, Ichimoku Chinkou Span is used for entry logic. // Main input parameters input double Lots = 0.01; // Basic lot size input int StopLoss= 50; //Stoploss (in Pips) input int...
 
Sergey Golubev:

Templates to create EAs and Indicators - MT4

The forum

  1. Some good templates - the thread 
  2. function of "mql4 code" - the thread  

The articles 

  1. MetaEditor:Templates as a Spot to Stand On   
  2. Idleness is the Stimulus to Progress. Semiautomatic Marking a Template   
  3. Universal Expert Advisor Template

CodeBase

  1. Expert Advisor Template with Trailing Stop v2 - expert for MetaTrader 4 
  2. Basic ATR based take and stop expert adviser - expert for MetaTrader 4
  3. Basic expert adviser with trailing stop - expert for MetaTrader 4
  4. Basic Moving Average template - expert for MetaTrader 4
  5. Basic Moving Average template - expert for MetaTrader 4
  6. Grid Template EA - expert for MetaTrader 4
  7. Basic Rsi Template EA - expert for MetaTrader 4
  8. Template Name - indicator for MetaTrader 4 
  9. News EA Template without DLL - expert for MetaTrader 4 
  10. News EA Template Without DLL From 2 Sources - expert for MetaTrader 4
  11. EA Template - expert for MetaTrader 4
  12. Robust EA Template - expert for MetaTrader 4

============

Templates to create EAs and Indicators - MT5

The forum

N/A

The Articles

  1. Using Pseudo-Templates as Alternative to C++ Templates
  2. Advanced EA constructor for MetaTrader - botbrains.app - article (MT5)
  3. An attempt at developing an EA constructor - the article (MT5)
  4. Trading Signal Generator Based on a Custom Indicator 
  5. Transferring Indicators from MQL4 to MQL5 
  6. How to Develop an Expert Advisor using UML Tools 
  7. Practical Implementation of Digital Filters in MQL5 for Beginners 
  8. Programming EA's Modes Using Object-Oriented Approach 

CodeBase

  1. An Expert Advisor template - expert for MetaTrader 5
  2. Trading engine 4 - expert for MetaTrader 5
  3. Indicators Code - expert for MetaTrader 5
  4. Apply Template - script for MetaTrader 5 
  5. Script and Template for Market Analysis - script for MetaTrader 5
An attempt at developing an EA constructor
An attempt at developing an EA constructor
  • www.mql5.com
In this article, I offer my set of trading functions in the form of a ready-made EA. This method allows getting multiple trading strategies by simply adding indicators and changing inputs.
 

Forum on trading, automated trading systems and testing trading strategies

How to start with MQL5

Vladimir Karputov, 2020.09.07 18:10

An example of working with iCustom - we get the indicator data in the EA [data folder]\MQL5\Indicators\Examples\MACD.mq5

Code: iCustom iMACD value on chart.mq5

The custom MACD indicator is located in the folder:

Remember the rule of working with indicators in MQL5: an indicator handle is created in OnInit. In the future, the indicator handle, using CopyBuffer, is used to receive data from the indicator.

//+------------------------------------------------------------------+
//|                                 iCustom iMACD value on chart.mq5 |
//|                              Copyright © 2020, Vladimir Karputov |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2020, Vladimir Karputov"
#property version   "1.000"
#property tester_indicator "Examples\\MACD"
//--- input parameters
input int                  Inp_MACD_fast_ema_period= 8;           // MACD: period for Fast average calculation
input int                  Inp_MACD_slow_ema_period= 17;          // MACD: period for Slow average calculation
input int                  Inp_MACD_signal_period  = 9;           // MACD: period for their difference averaging
input ENUM_APPLIED_PRICE   Inp_MACD_applied_price  = PRICE_CLOSE; // MACD: type of price
//---
int      handle_iCustom;                     // variable for storing the handle of the iCustom indicator
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create handle of the indicator iMACD ([data folder]\MQL5\Indicators\Examples\MACD.mq5)
   handle_iCustom=iCustom(Symbol(),Period(),"Examples\\MACD",Inp_MACD_fast_ema_period,Inp_MACD_slow_ema_period,
                          Inp_MACD_signal_period,Inp_MACD_applied_price);
//--- if the handle is not created
   if(handle_iCustom==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code
      PrintFormat("Failed to create handle of the iMACD indicator for the symbol %s/%s, error code %d",
                  Symbol(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early
      return(INIT_FAILED);
     }
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   if(handle_iCustom!=INVALID_HANDLE)
      IndicatorRelease(handle_iCustom);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   double main[],signal[];
   ArraySetAsSeries(main,true);
   ArraySetAsSeries(signal,true);
   int start_pos=0,count=3;
   if(!iGetArray(handle_iCustom,MAIN_LINE,start_pos,count,main) ||
      !iGetArray(handle_iCustom,SIGNAL_LINE,start_pos,count,signal))
     {
      return;
     }
//---
   string text_main="Main |",text_signal="Signal |";
   for(int i=count-1; i>=0; i--)
     {
      text_main=text_main+" #"+IntegerToString(i)+" "+DoubleToString(main[i],Digits()+1)+" | ";
      text_signal=text_signal+" #"+IntegerToString(i)+" "+DoubleToString(signal[i],Digits()+1)+" | ";
     }
   Comment(text_main,"\n",text_signal);
  }
//+------------------------------------------------------------------+
//| Get value of buffers                                             |
//+------------------------------------------------------------------+
bool iGetArray(const int handle,const int buffer,const int start_pos,
               const int count,double &arr_buffer[])
  {
   bool result=true;
   if(!ArrayIsDynamic(arr_buffer))
     {
      PrintFormat("ERROR! EA: %s, FUNCTION: %s, this a no dynamic array!",__FILE__,__FUNCTION__);
      return(false);
     }
   ArrayFree(arr_buffer);
//--- reset error code
   ResetLastError();
//--- fill a part of the iBands array with values from the indicator buffer
   int copied=CopyBuffer(handle,buffer,start_pos,count,arr_buffer);
   if(copied!=count)
     {
      //--- if the copying fails, tell the error code
      PrintFormat("ERROR! EA: %s, FUNCTION: %s, amount to copy: %d, copied: %d, error code %d",
                  __FILE__,__FUNCTION__,count,copied,GetLastError());
      //--- quit with zero result - it means that the indicator is considered as not calculated
      return(false);
     }
   return(result);
  }
//+------------------------------------------------------------------+
The code is attached to the post #106
How to start with MQL5
How to start with MQL5
  • 2020.09.06
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 

Indicators Code - expert for MetaTrader 5

Based on An attempt at developing an EA constructor article.

This non-trading EA is just a collection of ready-made codes for working with indicators. Contains input parameters of indicators (written in the "header" of the Expert Advisor), declaration of handles (written in the "header" of the Expert Advisor) and creation of handles (written in OnInit).