Multipaires indicator_V2

Download script
Author: Damien S
Multipaires indicator_V2

This tool is designed as a versatile multi-purpose technical analysis indicator for the MetaTrader 4 platform. Its primary purpose is to allow traders to visualize various market momentum, trend, and volatility indicators within a single, customizable window on their trading charts.

Core Functionality

The script acts as a flexible hub that can switch between many different financial indicators based on user preferences. Instead of requiring multiple separate windows for different tools, this script consolidates them into one manageable view. You can select your preferred currency pair and choose from a wide array of popular technical studies, including:

  • Momentum & Strength: RSI, CCI, MACD, Momentum, and Bulls/Bears Power.
  • Trend & Volatility: ADX, ATR, Standard Deviation, and Moving Averages.
  • Volume & Flow: OBV (On Balance Volume) and MFI (Money Flow Index).

Key Customization Features

The logic is built to adapt to the specific needs of different trading styles through several customizable layers:

1. Dynamic Indicator Selection Users can choose which specific indicator they want to view. Depending on the choice, the script automatically calculates and displays the relevant data. For complex indicators that require multiple data points (like the MACD or Stochastic Oscillator), the script intelligently handles these to show main lines, signal lines, or even calculated differences between them.

2. Price and Moving Average Source The tool allows you to define which price data point the indicator should "read" from (such as the Close, High, Low, or Open prices). Additionally, it provides options to switch between different types of Moving Average calculations—such as Simple (SMA), Exponential (EMA), Linear Weighted (LWMA), or Smoothed (SMMA)—depending on which study is selected.

3. Visual Styling To accommodate different visual preferences, the script offers three distinct ways to display the data on your chart:

  • Lines: A continuous smooth line (the standard view).
  • Histogram: Vertical bars that highlight volume or magnitude.
  • Points: Discrete dots or arrows placed at specific price points.

4. Intelligent Boundary Zones The script includes logic to identify "extreme" zones based on the chosen indicator. For example, if you are using the RSI, it can highlight levels like 70 and 30; if using the CCI, it may recognize 200 and -200. These boundaries help traders quickly identify overbought or oversold conditions at a glance.

Summary of Workflow

When active, the script continuously scans the market price for your chosen currency pair. It performs the mathematical calculations for your selected indicator in the background, applies your preferred visual style (Line, Histogram, or Point), and draws the resulting data on the chart. It automatically updates with every new price tick, providing a real-time look at market dynamics.

Indicators Used
Commodity channel indexRelative strength indexBulls Power indicator On Balance Volume indicatorMomentum indicatorStandard Deviation indicatorMoney flow indexIndicator of the average true rangeForce indexBill Williams Accelerator/Decelerator oscillatorBill Williams Awesome oscillatorMoving Average of OscillatorBears Power indicatorMACD HistogramStochastic oscillatorMovement directional index
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
Multipaires indicator_V2
//+------------------------------------------------------------------+
//|                                         Multipaire Indicator.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                   http://wallstreetfx.comze.com/ |
//+------------------------------------------------------------------+
#property copyright "Damien S"
#property link      "http://wallstreetfx.comze.com/"

#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 OrangeRed
#property indicator_color2 Black
#property indicator_color3 Green
#property indicator_color4 Black
#property indicator_color5 Black
#property indicator_color6 Red
#property indicator_color7 Red



extern string Paire = "EURUSD";
extern string Indicator= "CCI";


extern string setup_a=" Indicateur à une seule période" ;
extern int Période =14;

extern string setup_b= "Pour le MACD et OSMA";
extern int fast = 12;
extern int slow= 26;
extern int signal =9;

extern string setup_c="Pour le Stochastique";
extern int KPeriod=5;
extern int DPeriod=3;
extern int Slowing=3;

extern string setup_d="Définition du style";
extern string Style = "LIGNE";
extern int Style_point= 159;

extern string setup_e="Définition du style de prix et MA";
extern string price ="CLOSE";
extern string ma_style ="SMA";


double Id[];
double Id_2[];
double Id_3[];
double ext_1[];
double ext_2[];
double ext_3[];
double ext_4[];

int init()
{
   IndicatorShortName("Multi indic("+Paire+","+Indicator+","+Période+")");
   SetIndexStyle(0,DRAW_LINE,0,2);
   SetIndexBuffer(0,Id);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,Id_2);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(2,Id_3);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ext_1);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,ext_2);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,ext_3);
   SetIndexStyle(6,DRAW_LINE);
   SetIndexBuffer(6,ext_4);
   return(0);
}

void start()
{
   

   int counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   double prix,mode;
   string ls_0 = "Multi ";
   int li_8 = WindowFind(ls_0);
   for(int i=0; i<limit; i++)
   {
   
                                                                 // Définition du prix
     if (price == "CLOSE")                  prix= PRICE_CLOSE;
     if (price == "TYPICAL")                prix= PRICE_TYPICAL;
     if (price == "HIGH")                   prix= PRICE_HIGH;
     if (price == "LOW")                    prix= PRICE_LOW;
     if (price == "OPEN")                   prix= PRICE_OPEN;
     if (price == "MEDIAN")                 prix= PRICE_MEDIAN;
     if (price == "WEIGHTED")               prix= PRICE_WEIGHTED;
                                                                 // Définition du style moving average
 
     if (ma_style == "SMA")                 mode= MODE_SMA;
     if (ma_style == "EMA")                 mode= MODE_EMA;
     if (ma_style == "LWMA")                mode= MODE_LWMA;
     if (ma_style == "SMOOT")               mode= MODE_SMMA;

                                                                 // Choix des indicateurs de 1 buffer

      if (Indicator == "CCI")    Id[i]     = iCCI(Paire,0,Période,prix,i) ; 
      if (Indicator == "RSI")    Id[i]     = iRSI(Paire,0,Période,prix,i);
      if (Indicator == "BULL")   Id[i]     = iBullsPower(Paire, 0, Période,prix,i);
      if (Indicator == "BEAR")   Id[i]     = iBullsPower(Paire, 0, Période,prix,i);
      if (Indicator == "OBV")    Id[i]     = iOBV(Paire, 0, prix, i);
      if (Indicator == "MOM")    Id[i]     = iMomentum(Paire,0,Période,prix,i);
      if (Indicator == "STDEV")  Id[i]     = iStdDev(Paire,0,Période,0,mode,prix,i);
      if (Indicator == "MFI")    Id[i]     = iMFI(Paire,0,Période,i);
      if (Indicator == "ATR")    Id[i]     = iATR(Paire,0,Période,i);
      if (Indicator == "FORCE")  Id[i]     = iForce(Paire, 0, Période,mode,prix,i);
      if (Indicator == "AC")     Id[i]     = iAC(Paire, 0, i);
      if (Indicator == "AO")     Id[i]     = iAO(Paire, 0, i);
      if (Indicator == "OSMA")   Id[i]     = iOsMA(Paire,0,fast,slow,signal,prix,i);
      if (Indicator == "BB")     Id[i]     = iBullsPower(Paire, 0, Période,prix,i);
      if (Indicator == "BB")     Id_2[i]   = iBearsPower(Paire, 0, Période,prix,i);



                                                                // Choix des indicateur à plusieurs buffers



      if (Indicator == "MACD") Id[i]       = iMACD(Paire,0,fast,slow,signal,prix,MODE_MAIN,i);
      if (Indicator == "MACD") Id_2[i]     = iMACD(Paire,0,fast,slow,signal,prix,MODE_SIGNAL,i);
      if (Indicator == "MACD") Id_3[i]     = iMACD(Paire,0,fast,slow,signal,prix,MODE_MAIN,i)- iMACD(Paire,0,fast,slow,signal,PRICE_CLOSE,MODE_SIGNAL,i);
      
      if (Indicator == "STO") Id[i]        = iStochastic(Paire,0,KPeriod,DPeriod,Slowing,mode,0,MODE_MAIN,i);
      if (Indicator == "STO") Id_2[i]      = iStochastic(Paire,0,KPeriod,DPeriod,Slowing,mode,0,MODE_SIGNAL,i);
      
      if (Indicator == "ADX") Id[i]        = iADX(Paire,0,Période,prix,MODE_PLUSDI,i);
      if (Indicator == "ADX") Id_2[i]      = iADX(Paire,0,Période,prix,MODE_MINUSDI,i);

      
                                                  // Définition du nom et des périodes à afficher pour les cas "MACD","Sto" et "OSMA3
      
      if (Indicator == "MACD")    IndicatorShortName("Multi indic("+Paire+","+Indicator+","+fast+","+slow+","+signal+")");
      if (Indicator == "STO")     IndicatorShortName("Multi indic("+Paire+","+Indicator+","+KPeriod+","+DPeriod+","+Slowing+")");
      if (Indicator == "OSMA")    IndicatorShortName("Multi indic("+Paire+","+Indicator+","+fast+","+slow+","+signal+")");

      
      
      
                                                         // Définition du style buffer
                                                         
                                                         
     
     if (Style == "LIGNE") SetIndexStyle(0,DRAW_LINE);
                           SetIndexBuffer(0,Id)  ;      
     if (Style == "HISTO") SetIndexStyle(0,DRAW_HISTOGRAM);
                           SetIndexBuffer(0,Id);
     if (Style == "POINT") SetIndexStyle(0,DRAW_ARROW);
                           SetIndexArrow(0,Style_point);
                           SetIndexBuffer(0,Id);
                                                     
                                                     //Définition des zones extrêmes selon les indicateurs
                                                     
   if (Indicator == "CCI")  ext_1[i]     =  100;
   if (Indicator == "CCI")  ext_2[i]     =  -100;
   if (Indicator == "CCI")  ext_3[i]     =  200;
   if (Indicator == "CCI")  ext_4[i]     =  -200;
                            
   if (Indicator == "RSI")  ext_1[i]     =  70;
   if (Indicator == "RSI")  ext_2[i]     =  30;
   
   if (Indicator == "STO")  ext_1[i]     =  20;
   if (Indicator == "STO")  ext_2[i]     =  80;
                            
                                                     
                                                                              
                     
   }
}


Comments