Trade What You See

Author: fxfariz
Trade What You See

This tool is designed to simplify market analysis by highlighting specific price actions based on historical trends. Rather than overwhelming you with complex data, it focuses on identifying the relationship between recent high and low prices to provide a clear visual signal of market momentum.

How it Works

The logic operates by scanning a specific number of previous price bars (which you can customize) to identify the highest peak and the lowest valley within that timeframe. Once these boundaries are established, the tool calculates a dynamic "threshold" based on a percentage of the distance between that high and low point.

By calculating this specific distance, the script creates a benchmark for where the price is currently sitting relative to its recent range. It then compares two different points in time—essentially looking at where the market was just a moment ago versus where it is now.

Visual Interpretation

The tool translates these mathematical calculations into a visual histogram:

  • Trend Identification: The script compares the current calculated threshold against the previous one.
  • Signal Generation: If the current threshold is higher than the previous one, it indicates an upward movement or strength in the market, which is reflected by a specific color on your chart.
  • Contrarian Signal: Conversely, if the current threshold falls below the previous one, it suggests a downward shift or weakness, shown by a different color.

Key Features for the User

  • Customizable Sensitivity: You can adjust the "SSP" value to determine how many bars of history the tool should consider, allowing you to switch between viewing short-term fluctuations and longer-term trends.
  • Adjustable Strength: The "Kmax" setting allows you to fine-tune how aggressively the tool reacts to price movements by changing the percentage used for the calculation.
  • Clean Visuals: By condensing complex high/low math into a simple colored histogram, it helps traders "see" the trend at a glance without having to manually plot multiple indicators.
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
Trade What You See
//+------------------------------------------------------------------+
//|                                           Trade What You See.mq4 |
//|                                                          fxfariz |
//|                                                fxfariz@gmail.com |
//+------------------------------------------------------------------+
#property copyright "fxfariz"
#property link      "fxfariz@gmail.com"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue  //Red  //Aqua
#property indicator_color2 Red

extern int       SSP=7;
extern double    Kmax=50.6; //24 21.6 21.6 
extern int       CountBars=300;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtHBuffer1[];
double ExtHBuffer2[];




//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(4);
   SetIndexStyle(0,DRAW_HISTOGRAM,0,2);  //Red
   SetIndexBuffer(0,ExtHBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM,0,2);  //Lime
   SetIndexBuffer(1,ExtHBuffer2);
   
   SetIndexBuffer(2,ExtMapBuffer1);
   SetIndexBuffer(3,ExtMapBuffer2);

   IndicatorShortName("Trade What You see ("+SSP+")");
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
 
  if (CountBars>=Bars) CountBars=Bars;
  
   SetIndexDrawBegin(0,Bars-CountBars+SSP);
   SetIndexDrawBegin(1,Bars-CountBars+SSP);
   
  int i, counted_bars=IndicatorCounted();
  double SsMax, SsMin, smin, smax; 
  
  if(Bars<=SSP+1) return(0);

if(counted_bars<SSP+1)
   {
      for(i=1;i<=SSP;i++) ExtMapBuffer1[CountBars-i]=0.0;
      for(i=1;i<=SSP;i++) ExtMapBuffer2[CountBars-i]=0.0;
   }

for(i=CountBars-SSP;i>=0;i--) { 


  SsMax = High[Highest(NULL,0,MODE_HIGH,SSP,i-SSP+1)]; 
  SsMin = Low[Lowest(NULL,0,MODE_LOW,SSP,i-SSP+1)]; 
  
   smax = SsMax-(SsMax-SsMin)*Kmax/100;
       
   ExtMapBuffer1[i-SSP+6]=smax; 
   ExtMapBuffer2[i-SSP-1]=smax; 

}
   for(int b=CountBars-SSP;b>=0;b--)
   {
      if(ExtMapBuffer1[b]>ExtMapBuffer2[b])
      {
         ExtHBuffer1[b]=1;
         ExtHBuffer2[b]=0;
      }
      else
      {
         ExtHBuffer1[b]=0;
         ExtHBuffer2[b]=1;
      }
      
   }

return(0);
}

Comments