BaterloutzSimmetric

Download script
BaterloutzSimmetric

This tool is designed to provide a sophisticated visual aid for analyzing price trends on a trading chart. Rather than using standard moving averages that might lag behind current market movements, this script utilizes a complex mathematical approach to smooth out price action while maintaining high responsiveness.

Core Methodology

The logic operates by processing four key data points for every candle: the opening price, closing price, highest price, and lowest price. By averaging these together, the script establishes a "base" price for every moment in time.

The Smoothing Process

To create the final visual line you see on your chart, the script performs a multi-layered calculation based on two primary components:

  • The Gamma Factor: The script uses a specific mathematical constant (Gamma) derived from the user-defined period. This acts as a foundation for how much weight is given to historical data versus new data.
  • Iterative Refining: The tool doesn't just calculate the trend once. It runs a repetitive loop (controlled by a "K" factor). In each loop, it takes the previous result and applies a series of trigonometric adjustments (using Sine waves) to refine the curve.

How it Works for the User

Think of this process like refining oil:

  1. It starts with the raw price data.
  2. It applies an initial mathematical filter to identify the general direction.
  3. It then repeats a "smoothing" cycle multiple times, progressively removing market noise and "jitter" while trying to keep the line as close to the actual price as possible.

The end result is a thick red line on your chart that represents a stabilized trend. Because of the trigonometric math involved, it aims to be more fluid and accurate than standard moving averages, helping traders identify the momentum of the market with less visual distraction from minor price fluctuations.

Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
BaterloutzSimmetric
//+------------------------------------------------------------------+
//|                          Moving Average Batteruot Simmetric .mq4 |
//|                                                  Code by Neutron |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_color1 Red
#property indicator_width1 3

#define Pi 3.14159
extern int FLFPeriod=10;
int Start,i,m,K=4;
double Gamma,alfa,b,c,g,MA[2000],Y[2000]; 

int start()
{
Start=2000;
Gamma= MathPow(0.484,1/(2*K))/MathTan(Pi/(FLFPeriod+1));	 
	 for (i=0;i<=Start+2;i++) {Y[i]=(Open[i]+Close[i]+High[i]+Low[i])/4.;MA[i]=Y[i];}

for (m=1;m<=K;m++) 	 {
	 alfa=2*MathSin(Pi/4*(2*m-1)/K);
	 g=1/(Gamma*Gamma+Gamma*alfa+1);
	 b=2*g*(Gamma*Gamma-1);
	 c=g*(Gamma*Gamma-Gamma*alfa+1); 
	 for (i=Start-3;i>=0;i--)MA[i]=g*(Y[i]+2*Y[i+1]+Y[i+2])+b*MA[i+1]-c*MA[i+2];	 
    for (i=2;i<=Start-3;i++)Y[i]=g*(MA[i]+2*MA[i-1]+MA[i-2])+b*Y[i-1]-c*Y[i-2];
                       }
}

int init()
{
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,Y);
   return(0);
}


Comments