ANG_based_on_open_price1

Download script
ANG_based_on_open_price1

This script is a technical analysis tool designed to smooth out price fluctuations and identify underlying trends by calculating historical price averages. Instead of reacting to every minor "tick" or noise in the market, it uses a multi-layered mathematical approach to visualize the movement of the market over a specific timeframe.

Core Logic and Mechanism

The logic operates through three primary stages:

1. Timeframe Standardization The script first establishes a baseline by calculating how many price bars are needed to represent a specific block of time (based on user-defined settings). This ensures that the data remains consistent regardless of whether you are viewing a one-minute chart or a larger timeframe.

2. Progressive Averaging and Smoothing The tool works by creating moving averages, but it does so in a layered fashion:

  • It begins by establishing a baseline from the current market opening prices.
  • It then calculates a secondary layer of data where each new point is an average of previous points from the first layer.
  • This "averaging of averages" helps filter out random market volatility, making it easier to see the broader direction of the price movement.

3. Curve Fitting (Quadratic Interpolation) One of the most sophisticated parts of this logic is how it handles gaps and connections between data points. When the script reaches a certain threshold of historical data, it uses a mathematical formula to "fill in" the curves. This ensures that the transition between different price points is fluid and curved rather than jagged. It creates a continuous path that mimics the natural flow of market trends.

4. Trend Differentiation Finally, the script calculates the difference between these smoothed values. By subtracting the previous calculated point from the current one, it produces a histogram. This final result highlights the "momentum" or the rate of change:

  • When the values are moving significantly in one direction, the histogram shows a clear trend.
  • The tool effectively translates raw, chaotic price action into a structured visual representation of market velocity.

Summary for the User

Essentially, this script acts as a high-level filter. It ignores the "noise" of the immediate moment to show you the "path" the price is taking. By using layered averaging and curve-smoothing math, it provides a much cleaner view of market trends than standard price charts alone.

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

#property  copyright "ANG3110@latchess.com"
//----------------at_DItpm3-------------------------
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 SkyBlue
#property indicator_color2 Silver
//----------------------------------
extern double hr=4;
extern int s=20;
extern int Days=11;

//----------------------------------
double ci[],bi[],at[],a0[];
int pt,cb;
//================================================
int init(){
   IndicatorBuffers(4);
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,at);
   SetIndexBuffer(1,a0);
   IndicatorShortName("ANG");
   SetIndexBuffer(2,ci);
   SetIndexBuffer(3,bi);
pt=hr*60/Period();
cb=MathFloor(Days*1440/Period()/pt)*pt;   
   return(0);}
//================================================
int start() {
int cbi,aa,bb,cc;
//----------------------------
cbi=Bars-IndicatorCounted()-2;
if (cbi>=0) {
//------------------------
//for (i=cb; i>=0; i--)
for (int m=cb; m>=s; m--) {
for (int i=0; i<=cb; i=i+pt) {
if (m==0) {
ci[i+pt]=(Open[i]+Open[i+pt]+Open[i+2*pt])/3; 
ci[0]=Open[0]; ci[cb+2*pt]=Open[cb+2*pt]; }
if (m>0 && m<s) {
bi[i+pt]=(ci[i]+ci[i+pt]+ci[i+2*pt])/3; 
bi[0]=(ci[0]+ci[pt])/2;  
bi[cb+2*pt]=ci[cb+2*pt];
if (i==cb) ArrayCopy(ci,bi,0,0,cb+2*pt);}
if (m==s) { aa=i; bb=i+pt; cc=i+2*pt;
for (int n=i; n<=cc; n++)  {
ci[n]=ci[aa]*((n-bb)*(n-cc))/((aa-bb)*(aa-cc))
+ci[bb]*((n-aa)*(n-cc))/((bb-aa)*(bb-cc))
+ci[cc]*((n-aa)*(n-bb))/((cc-aa)*(cc-bb));}
}}}
for (i=cb; i>=0; i--) {
at[i]=ci[i]-ci[i+pt]; 
a0[i]=0.00000001;}
}
//-----------------------
return(0);
  }
//+------------------------------------------------------------------+

Comments