X_profile_v1

Download script
Author: Copyright � 2005, Trading Studio.
X_profile_v1

This script is designed to provide a visual representation of price trends and volatility on a trading chart. It functions by analyzing historical price data to create a set of dynamic "channels" that help traders identify the average movement of an asset over time.

Core Logic Overview

The tool works by calculating a running average of the closing prices starting from a specific date in the past. As new price data enters the system, it continuously updates these calculations to reflect the most recent market activity.

How the Data is Processed

  1. Trend Identification: The script first establishes a "baseline" by calculating the mean price. This serves as the center point for the indicator, representing the general equilibrium of the market at any given moment.
  2. Volatility Measurement: To understand how much the price is swinging away from that baseline, the tool calculates a standard deviation. This is a mathematical way to measure "noise" or volatility; a higher value indicates more aggressive price swings, while a lower value suggests a calmer market.
  3. Channel Construction: Using both the baseline and the volatility measurement, the script generates five distinct visual lines on your chart:
    • The Center Line represents the moving average.
    • The Inner Boundaries are placed one standard deviation above and below that center line.
    • The Outer Boundaries are placed two standard deviations above and below the center line.

What This Means for the User

Instead of just seeing a single price point, this indicator provides a "map" of the market's behavior. The space between the lines creates a visual corridor. When the price stays within these boundaries, it is considered to be moving within its normal expected range. When the price pushes toward or breaks out of the outer boundaries (the furthest green and red lines), it suggests that the market is experiencing a significant move that deviates from its recent historical norm.

Indicators Used
Standard Deviation indicator
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
X_profile_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                    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