precentualzz_victor_001

Download script
Author: neamtu victor
precentualzz_victor_001

This script is designed to act as a visual guide on your trading chart, identifying significant shifts in price momentum by marking specific "turning points." Instead of following every minor fluctuation in the market, it uses a mathematical threshold to highlight meaningful movements, helping traders see the underlying structure of the price action.

How the Logic Works

1. Determining the Reference Price To ensure the tool provides a smooth and consistent analysis, the script doesn't just look at the current closing price. Instead, it calculates a "base price" for every candle by taking the average of four key data points: the opening price, the closing price, the highest point reached, and the lowest point reached during that specific period.

2. Establishing the Movement Threshold The tool operates based on a user-defined percentage (the "Percent" parameter). This acts as a sensitivity filter. By setting this percentage, you determine how much the price must move before the script considers it a significant trend change.

3. Identifying Trend Shifts The script continuously compares the current average price against the previous established benchmark. It looks for two specific conditions:

  • Upward Movement: If the current price rises significantly above the previous benchmark (by your defined percentage), the script identifies a "Buy" signal. It places a green arrow below the candle to indicate an upward shift in momentum.
  • Downward Movement: If the current price drops significantly below the previous benchmark, the script identifies a "Sell" signal. It places a red arrow above the candle to indicate a downward shift in momentum.

4. Dynamic Benchmarking Every time a new trend signal is triggered (either up or down), the script automatically updates its internal benchmark to that new price level. This creates a "staircase" effect where the tool continuously recalibrates itself based on the most recent significant move, allowing it to track long-term trends while ignoring minor "noise" or small price vibrations.

Summary for the User

In simple terms, this tool filters out the market noise. It waits until the price moves enough to meet your specific percentage requirement before placing an arrow on your chart. These arrows serve as visual markers for major trend changes, helping you identify where the market is shifting direction based on consistent, calculated movements.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains open prices of each barSeries array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
precentualzz_victor_001
//+------------------------------------------------------------------+
//|                                               ZigZag Pointer.mq4 |
//|                                    zigzag modified by Dr. Gaines |
//|                                      neamtu_victor@yahoo.com     |
//|                                         neamtu victor            |
//+------------------------------------------------------------------+
#property copyright "neamtu victor"
#property link      "neamtu_victor@yahoo.com"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_width1 1
#property indicator_color2 Red
#property indicator_width2 1
//---- indicator parameters
extern double Percent=0.04;
//---- indicator buffers
double buyArrowsBuffer[];
double sellArrowsBuffer[];


   
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+


int init()
  {
   IndicatorBuffers(2);
//---- drawing settings
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0, 233);//233
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1, 234);//234
   
//---- indicator buffers mapping
   SetIndexBuffer(0,buyArrowsBuffer);
   SetIndexBuffer(1,sellArrowsBuffer);
   SetIndexEmptyValue(0,0.0);
   
   IndicatorShortName("Percentual ZigZag("+Percent+")");
   
   Percent /= 100;
  
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double barPrice(int shift){
   double auxPrice=0;
   
   auxPrice=(iOpen(Symbol(),Period(),shift)+iClose(Symbol(),Period(),shift)+iLow(Symbol(),Period(),shift)+iHigh(Symbol(),Period(),shift))/4;
   
   return(auxPrice);
}

   

int start(){

   int shift;
   static double value;
/*
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) 
      return(-1);

   int limit=Bars-counted_bars-1;
*/

   for(shift=Bars-1; shift>=0; shift--){
      
      if (shift == Bars-1){
         value=barPrice(Bars-1);
     }
      else{
         //Print(" barPrice: ", barPrice(shift), " value+p.. ", value );
         if (barPrice(shift) > value + Percent*value){
            buyArrowsBuffer[shift]=iLow(Symbol(),Period(),shift)-10*Point;
            sellArrowsBuffer[shift]=0;
            value=value + Percent*value;
            //Print("Bars ",Bars, " Shift ",shift," barPrice: ", value);
         }
         

         if (barPrice(shift) < value - Percent*value){
            sellArrowsBuffer[shift]=iHigh(Symbol(),Period(),shift)+10*Point;
            buyArrowsBuffer[shift]=0;
            value=value - Percent*value;
            //Print("Bars ",Bars, " Shift ",shift," barPrice: ", value);
         }
  //       
     }
      
      
   }

   
}
  
  //end//

Comments