SemperAugustusTFV

Author: Semper Augustus
SemperAugustusTFV

This tool is designed to provide traders with a smoothed visual representation of price action by calculating an advanced average of historical data. Rather than simply looking at the current price, it processes information from multiple timeframes to help identify more stable trends.

Core Logic and Functionality

The script operates using two distinct methods of calculation depending on the timeframe you are currently viewing:

1. High-Frequency Monitoring (1-Minute Charts) When viewed on a 1-minute chart, the tool simplifies its logic to provide immediate data. It identifies the midpoint of each individual candle (the average between the highest and lowest price reached during that minute) and plots it directly. This provides a real-time look at the "center" of price movement.

2. Multi-Timeframe Aggregation (Higher Timeframes) On any timeframe larger than one minute, the script performs a much more complex calculation to ensure data remains smooth and relevant. It looks backward into the 1-minute data that constitutes the current candle. Instead of just taking a simple average, it applies a weighted progression to these 1-minute midpoints. This means that as the tool moves through the history of a large candle, it progressively "weighs" the price data to create a fluid, continuous line or point of reference.

Key Technical Features

  • Exponential Weighting: The script uses a customizable "Exponential" factor. This allows the indicator to prioritize more recent price movements while still maintaining a connection to historical data, helping to filter out market "noise."
  • Dynamic Accumulation: As new prices come in during the current live candle, the tool continuously updates its calculation. It takes the previous cumulative value, applies the exponential weight, and blends it with the new price to ensure the indicator moves smoothly rather than jumping erratically.
  • Visual Representation: The results are displayed on your chart using specific markers (WingDings). These markers serve as visual anchors, helping you see where the calculated "fair value" of the price is located at any given moment.

Summary for the Trader

In essence, this script acts as a sophisticated "smoothing" filter. It takes the raw, jagged movement of the market and translates it into a more refined trend by analyzing 1-minute price components behind every candle. It is designed to help traders see the underlying flow of the market by balancing historical context with real-time price updates.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
Miscellaneous
Implements a curve of type %1
3 Views
0 Downloads
0 Favorites
SemperAugustusTFV
//+------------------------------------------------------------------+
//|                                            SemperAugustusTFV.mq4 |
//|                                                  Semper Augustus |
//|                                             http://forexninja.nl |
//+------------------------------------------------------------------+
#property copyright "Semper Augustus"
#property link      "http://forexninja.nl"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 White

extern int Exponential = 2;
extern int WingDing = 108;

//--- buffers
double tfv[];

bool start = true;
int askTiks;
int bidTiks;
double askCum;
double bidCum;
double dezeBar;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{

   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,WingDing);
   SetIndexBuffer(0,tfv);
   SetIndexEmptyValue(0,0.0);

   dezeBar = Bars;
   askTiks = 0;
   bidTiks = 0;
   askCum = 0;
   bidCum = 0;   

   return(0);
}

int deinit()
{


   return(0);
}


int start()
{
   int counted_bars=IndicatorCounted();
   
   if( start )
   {
      // ouwe koeien
      for( int i = 0; i <= Bars; i++ )
      {
         tfv[i] = OuweKoeien(i);
      }
      askCum = Bid;
      askTiks = 1;
      start = false;
      return(0);
   }
   
   if( dezeBar == Bars )
   {
      // huidige bar
      askCum = ( ( askCum * askTiks ) + ( Bid * Exponential ) ) / ( Exponential + askTiks );
      askTiks++;
      tfv[0] = askCum;
   }
   else
   {  
      askTiks = 1;
      dezeBar = Bars;
   }
   return(0);
}

double OuweKoeien(int index)
{
   if( Period() == PERIOD_M1 )
      return( ( iHigh(NULL, 0, index) + iLow(NULL, 0, index) ) / 2.0 );
   else
   {
      datetime begin = iTime(NULL, 0, index);
      datetime eind = iTime(NULL, 0, index-1);
      
      int beginindex = iBarShift(NULL, PERIOD_M1, begin, false);
      int eindindex = iBarShift(NULL, PERIOD_M1, eind, false);
      
      double waarde = 0;
      int teller = 1; 
      for(int i = eindindex+1; i<= beginindex; i++ )
      {
         waarde = ( (waarde * teller) + ( (( iHigh(NULL, PERIOD_M1, i) + iLow(NULL, PERIOD_M1, i) ) / 2) * Exponential ) ) / ( teller + Exponential );
      }
      return( waarde );
   }
}

Comments