DECEMA
Download scriptOverview
The DECEMA indicator is a sophisticated technical analysis tool designed to smooth out market noise and identify underlying price trends. It functions by layering multiple mathematical transformations on top of primary market data to create a refined visual signal.
Core Logic and Data Processing
The script operates through a multi-stage calculation process. Rather than looking at the raw price alone, it follows a systematic "filtering" workflow:
- Data Integration: The logic begins by pulling information from an external foundational component (DECEMA-a). This provides the raw material for all subsequent calculations.
- Successive Smoothing: The script takes this initial data and subjects it to four consecutive rounds of Exponential Moving Average (EMA) calculations. Each round acts as a filter, further refining the data to remove minor fluctuations and focus on the broader momentum.
- Weighted Synthesis: Once these smoothed layers are created, the indicator applies a specific weighted formula. It combines several of the processed averages using varying multipliers (ranging from small positive weights to larger negative weights).
Visual Output
The final result is a single, consolidated line displayed on your chart. By balancing these multiple smoothed layers against one another—effectively subtracting certain trends while emphasizing others—the indicator aims to produce a clearer picture of market direction than a standard moving average could provide on its own.
Key Parameters
- MA_Period: This allows you to define the timeframe used for the calculations; a higher number generally results in a smoother, slower line, while a lower number makes it more responsive to recent price changes.
- MA_Price: This determines which price point (such as the closing price) is used as the primary basis for the entire calculation.
//Version: 1
//Time: December 03, 2006
//+------------------------------------------------------------------+
//| DECEMA |
//| DECEMA.mq4 |
//| Developed by Coders Guru |
//| http://www.xpworx.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| NOTE: DECEMA-a is required |
//+------------------------------------------------------------------+
#property link "http://www.xpworx.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
extern int MA_Period = 15;
extern int MA_Price = PRICE_CLOSE;
double DrawBuffer[];
double StoreBuffer[];
double StoreBuffer2[];
double Buffer7[];
double Buffer8[];
double Buffer9[];
double Buffer10[];
int init()
{
IndicatorBuffers(7);
SetIndexStyle(0,DRAW_LINE, STYLE_SOLID,2);
SetIndexBuffer(0,DrawBuffer);
SetIndexBuffer(1,StoreBuffer);
SetIndexBuffer(2,StoreBuffer2);
SetIndexBuffer(3,Buffer7);
SetIndexBuffer(4,Buffer8);
SetIndexBuffer(5,Buffer9);
SetIndexBuffer(6,Buffer10);
return(0);
}
int deinit()
{
return(0);
}
void start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
limit=Bars-counted_bars-1;
for(int shift=0; shift<limit; shift++)
StoreBuffer[shift] = iCustom(NULL,0,"DECEMA-a",MA_Period,MA_Price,1,shift);
for(shift=0; shift<limit; shift++)
Buffer7[shift] = iMAOnArray(StoreBuffer,0,MA_Period,0,MODE_EMA,shift);
for(shift=0; shift<limit; shift++)
Buffer8[shift] = iMAOnArray(Buffer7,0,MA_Period,0,MODE_EMA,shift);
for(shift=0; shift<limit; shift++)
Buffer9[shift] = iMAOnArray(Buffer8,0,MA_Period,0,MODE_EMA,shift);
for(shift=0; shift<limit; shift++)
Buffer10[shift] = iMAOnArray(Buffer9,0,MA_Period,0,MODE_EMA,shift);
for(shift=0; shift<limit; shift++)
StoreBuffer2[shift] = iCustom(NULL,0,"DECEMA-a",MA_Period,MA_Price,0,shift);
//DECEMA:= (10*EMA1)-(45*EMA2)+(120*EMA3)-(210*EMA4)+(252*EMA5)-(210*EMA6)+(120*EMA7)-(45*EMA8)+(10*EMA9)-EMA10;
for(shift=0; shift<limit; shift++)
DrawBuffer[shift] = StoreBuffer2[shift] + (120*Buffer7[shift])-(45*Buffer8[shift])+(10*Buffer9[shift])- Buffer10[shift];
return(0);
}
Comments