Custom Moving Average Levels – indicator for MetaTrader 5

  • Platform: Metatrader5
  • Currency pairs: Any pairs, indices and metals
  • Trading Time: Around the clock
  • Recommended broker: icmarkets, XM
  • Get E-Book Worth $100 for Free!!!

    A Moving Average indicator, for which the values of two levels can be specified from the MQL5 code:

    Custom Moving Average Levels

    An example of this indicator (located in “terminal data directory”\MQL5\Indicators\MyInd\):

    ...
    int            handle_iMA_Custom;            // variable for storing the handle of the iMA indicator 
    //+------------------------------------------------------------------+
    //| Expert initialization function                                   |
    //+------------------------------------------------------------------+
    int OnInit()
      {
    ...
    //--- create handle of the Custom indicator "Custom Moving Average Levels"
       handle_iMA_Custom=iCustom(Symbol(),Period(),"MyInd\\Custom Moving Average Levels",
                                 ma_period,
                                 ma_shift,
                                 ma_method,
                                 100,
                                 -100);
    //--- if the handle is not created 
       if(handle_iMA_Custom==INVALID_HANDLE)
         {
          //--- tell about the failure and output the error code 
          PrintFormat("Failed to create handle of the iMA indicator for the symbol %s/%s, error code %d",
                      Symbol(),
                      EnumToString(Period()),
                      GetLastError());
          //--- the indicator is stopped early 
          return(INIT_FAILED);
         }
       ChartIndicatorAdd(0,0,handle_iMA_Custom);
    //---
       return(INIT_SUCCEEDED);
      }
    
    • How to install MT5 indicator?
    • 1. On the desktop, double-click to open the MT45 trading platform software you installed.
    • 2. Click on “File” in the upper left corner – “Open Data Folder”, double-click the MQL5 folder, and double-click the Indicators folder
    • 3. Copy the metrics you need to install to the Indicators folder
    • 4. Open MT5, find “Navigator” in the display menu, then click “Technical Indicators” of “Navigator” and right click to refresh, you will see the indicator just copied.
    • 5. In the “Technical Indicators” of “Navigator”, find the indicator file just installed, double click or click manually to the chart window
    • 0/5 (0 Reviews)