Author: Copyright � 2005, Trading Studio.
X_profile

This tool is designed to provide a visual representation of price dynamics on your trading chart by calculating historical averages and volatility trends. Instead of looking at simple price action, it helps traders visualize the "center of gravity" of the market alongside specific boundaries of price movement.

How the Logic Works

The script functions by analyzing price data starting from a specific date defined in the settings. It processes the history to build a comprehensive view of the market's behavior based on two main components:

1. The Dynamic Average (The Center) The core of this indicator is an accumulative average. As it moves across the chart, it calculates a running average of the closing prices. Think of this as the "heartbeat" of the asset; it smoothes out the minor fluctuations to show you the general direction and equilibrium where the price prefers to sit over time.

2. Volatility Boundaries (The Channels) Beyond just showing the average, the tool calculates the "Standard Deviation"—a mathematical measure of how much the price is swinging away from that average. Using this measurement, it projects four distinct lines around the center:

  • Inner Boundaries: These represent a standard movement range. They highlight where the price usually stays during normal market activity.
  • Outer Boundaries: These are calculated at double the standard deviation. They act as "extreme" zones, identifying areas where price action is significantly stretched and may be reaching an overextended state.

Summary of Visual Output

When you apply this to your chart, you aren't just seeing a single line; you are seeing a multi-layered envelope:

  • The Core: A central line representing the historical average.
  • The Inner Envelope: Two lines that capture the standard "noise" or daily movement of the market.
  • The Outer Envelope: Two wider lines that define the outer limits of significant price volatility.

By observing how the price interacts with these layers, users can better identify whether the market is consolidating within its normal range or if it is breaking out into territory that historically represents an unusual move.

Indicators Used
Standard Deviation indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
X_profile
//+------------------------------------------------------------------+
//|                                                    X_profile.mq4 |
//|                                Copyright © 2005, Trading Studio. |
//|                                          http://www.bluechips.it |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Trading Studio."
#property link      "http://www.bluechips.it"

#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 Yellow
#property indicator_color3 Green
#property indicator_color4 Yellow
#property indicator_color5 Green


double buffer1[];
double buffer2[];
double buffer3[];
double buffer4[];
double buffer5[];
double parziale;

extern datetime  DataInizio=D'2005.08.01 04:30';

//+------------------------------------------------------------------+
//| inizializzazione                         |
//+------------------------------------------------------------------+
int init()
  {

Print("sei nell_indicatore");

//---- settaggio indicatore
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,buffer1);
SetIndexBuffer(1,buffer2);
SetIndexBuffer(2,buffer3);
SetIndexBuffer(3,buffer4);
SetIndexBuffer(4,buffer5);
IndicatorShortName("31Prova3");
if(!SetIndexBuffer(0,buffer1) && !SetIndexBuffer(1,buffer2) && !SetIndexBuffer(2,buffer3) && !SetIndexBuffer(3,buffer4) && !SetIndexBuffer(4,buffer5))
   Print("buffer non settato");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| deinizializzazione
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| iterazione
//+------------------------------------------------------------------+
int start()
  {
  
   double array_price[][6];
   int cont;
   double deviazione;
   
   ArrayInitialize(array_price,0);
   ArrayCopyRates(array_price,(Symbol()));
   

for (int j = Bars-1; j >= 0; j--) {

if (Time[j]>=DataInizio) {
   for (int i = j; i >= 0; i--) 
   {
      cont++;
         parziale=parziale+array_price[i][4];
         buffer1[i]=parziale/cont;
         deviazione=iStdDev(NULL,0,cont,MODE_SMA,0,PRICE_CLOSE,0);
         buffer2[i]=buffer1[i]+deviazione;
         buffer3[i]=buffer1[i]+(2*deviazione);
         buffer4[i]=buffer1[i]-deviazione;
         buffer5[i]=buffer1[i]-(2*deviazione);      
   }
   break;
} 
}
   return(0);
  }
//+------------------------------------------------------------------+

Comments