wellxAMA_v1

Download script
Author: Copyright � 2004, by konKop,wellx
wellxAMA_v1

This technical script is designed to serve as a visual trading tool that helps identify trends and potential entry points by analyzing price movement behavior. Instead of simply following the price blindly, it uses a specialized mathematical approach to distinguish between actual market trends and mere "noise" (unimportant price fluctuations).

Core Methodology: Trend vs. Noise

The primary logic of this tool is centered on a concept called the Efficiency Ratio. The script looks at a specific window of time (the period) and compares the net move of the price against the total path the price took to get there.

  • Efficient Movement: If the price moves from point A to point B in a relatively straight line, the tool recognizes this as a strong trend.
  • Inefficient Movement: If the price moves from point A to point B but zig-zags wildly along the way, the tool identifies this as "noise" and suppresses its influence on the final calculation.

By filtering out this noise, the resulting smoothed line provides a much cleaner picture of the market's true direction than standard moving averages.

Visual Indicators and Alerts

The script processes this data to provide three distinct visual components on your trading chart:

  1. The Trend Line: This is the primary smoothed average. It follows the general flow of the market, adjusted dynamically based on how "efficient" the current price action is. It helps traders stay aligned with the broader momentum.
  2. Upward Signals: The script constantly monitors the change between the previous calculation and the current one. If the trend line moves upward by a specific significant margin (defined by the sensitivity settings), the tool marks this point to highlight potential bullish momentum.
  3. Downward Signals: Conversely, if the trend line drops by a significant margin, the tool marks these points to indicate bearish momentum.

Customization and Sensitivity

The logic allows for fine-tuning through several variables that control how the "smoothness" and "reactivity" of the indicator behave:

  • Speed Controls: You can adjust how fast or slow the calculations react to new price data.
  • Sensitivity Thresholds: You can define exactly how large a move must be before a signal (arrow) appears, ensuring that minor wiggles in the trend line don't create false signals.
  • Smoothing Factor: This allows you to dictate how much weight is given to the current price relative to the historical average.

In summary, this tool acts as a "smart filter." It ignores the market's distractions to show you the underlying direction of the trend and highlights clear, significant turns in that direction with visual markers.

Miscellaneous
Implements a curve of type %1
14 Views
0 Downloads
0 Favorites
wellxAMA_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                      Kaufman.mq4 |
//|                             Copyright © -2005, by konKop & wellx |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, by konKop,wellx"
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Sienna
#property indicator_color2 DeepSkyBlue
#property indicator_color3 Gold

//---- input parameters
extern int       periodAMA=9;
extern int       nfast=2;
extern int       nslow=30;
extern double    G=2.0;
extern double    dK=2.0; 

//---- buffers
double kAMAbuffer[];
double kAMAupsig[];
double kAMAdownsig[];

//+------------------------------------------------------------------+

int    cbars=0, prevbars=0, prevtime=0;
double slowSC,fastSC;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,159);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,159);
   SetIndexBuffer(0,kAMAbuffer);
   SetIndexBuffer(1,kAMAupsig);
   SetIndexBuffer(2,kAMAdownsig);
   
   
   IndicatorDigits(4);
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    i,pos=0;
   double noise=0.000000001,AMA,AMA0,signal,ER;
   double dSC,ERSC,SSC,ddK;
   
   if (prevbars==Bars) return(0);
    
//---- TODO: add your code here
   slowSC=(2.0 /(nslow+1));
   fastSC=(2.0 /(nfast+1));
   cbars=IndicatorCounted();
   if (Bars<=(periodAMA+2)) return(0);
//---- check for possible errors
   if (cbars<0) return(-1);
//---- last counted bar will be recounted
   if (cbars>0) cbars--;
   pos=Bars-periodAMA-2;
   AMA0=Close[pos+1];
   while (pos>=0)
     {
      if(pos==Bars-periodAMA-2) AMA0=Close[pos+1];
      signal=MathAbs(Close[pos]-Close[pos+periodAMA]);
      noise=0.000000001;
      for(i=0;i<periodAMA;i++)
       {
        noise=noise+MathAbs(Close[pos+i]-Close[pos+i+1]);
       };
      ER =signal/noise;
      dSC=(fastSC-slowSC);
      ERSC=ER*dSC;
      SSC=ERSC+slowSC;
      AMA=AMA0+(MathPow(SSC,G)*(Close[pos]-AMA0));
      kAMAbuffer[pos]=AMA;

      ddK=(AMA-AMA0);
      if ((MathAbs(ddK)) > (dK*Point) && (ddK > 0)) kAMAupsig[pos]  =AMA;
      if ((MathAbs(ddK)) > (dK*Point) && (ddK < 0)) kAMAdownsig[pos]=AMA;
     
      AMA0=AMA;
      pos--;
     };
//----
   prevbars=Bars;
   return(0);
  }

Comments