SpreadPaintBar

Download script
Author: Copyright � 2008, Trading Automatics Ltd
SpreadPaintBar

This tool is designed to provide traders with a visual representation of price action intensity on a trading chart. Rather than showing standard price movements, it highlights specific bars where the price has moved significantly from one end to the other, effectively "painting" the chart to identify strong trends or reversals based on a user-defined percentage.

How the Logic Works

The script operates by analyzing every individual candle (bar) on your chart and measuring its total size, which is the distance between its highest and lowest points. It then applies a specific filter based on the Percent value you set in the settings.

1. The Calculation of "Active Movement" The tool takes the total range of a candle and calculates a "buffer zone" based on your chosen percentage. This allows the script to distinguish between small, insignificant fluctuations and large, decisive price movements.

2. Identifying Bullish Momentum (Blue Signals) The script looks for candles where the price opened near the bottom and closed near the top. Specifically, if the price closes at a level that is within your defined percentage of the high end, it marks that bar as a strong upward move. This tells you that the buyers had enough strength to push the price across almost the entire range of that time period.

3. Identifying Bearish Momentum (Red Signals) Conversely, the script looks for candles where the price opened near the top and closed near the bottom. If the closing price finishes within your defined percentage of the low end, it marks that bar as a strong downward move. This indicates that sellers dominated the price action during that period.

4. Visual Representation Instead of cluttering your screen with extra lines or numbers, the tool uses two different colors (Blue and Red) to highlight these significant moves directly on the chart. By visualizing these "painted" bars, you can quickly identify:

  • Areas where momentum is shifting rapidly in one direction.
  • Instances where price action is becoming "stretched."
  • Clearer trends by filtering out the "noise" of minor price fluctuations.

In simple terms, this script acts as a visual filter that highlights only the most decisive moves on your chart, helping you see exactly where the real market energy is moving.

Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
SpreadPaintBar
//+------------------------------------------------------------------+
//|                                               SpreadPaintBar.mq4 |
//|                         Copyright © 2008, Trading Automatics Ltd |
//|                                 http://www.tradingautomatics.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Trading Automatics Ltd"
#property link      "http://www.tradingautomatics.com"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

//---- input parameters
extern int       Percent = 25;

//---- buffers
double up[];
double dn[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   SetIndexStyle(0, DRAW_HISTOGRAM);
   SetIndexBuffer(0, up);
   SetIndexEmptyValue(0, 0);
   SetIndexStyle(1, DRAW_HISTOGRAM);
   SetIndexBuffer(1, dn);
   SetIndexEmptyValue(1, 0);
//----
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
//----
   
//----
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int    counted_bars = IndicatorCounted();
   double spread;
   double band;
   int limit = Bars - counted_bars;
   if(counted_bars == 0)
   {
      limit = Bars - 1;
   }
//----
   for(int i = 0; i < limit; i++)
   {
      spread = High[i] - Low[i];
      band = spread * Percent * 0.01;
      
      up[i] = 0;
      dn[i] = 0;
      
      if(Open[i] < Low[i] + band && Close[i] > High[i] - band)
      {
         dn[i] = Low[i];
         up[i] = High[i];
      }
      else if(Close[i] < Low[i] + band && Open[i] > High[i] - band)
      {
         up[i] = Low[i];
         dn[i] = High[i];
      }
   }
//----
   return(0);
}
//+------------------------------------------------------------------+

Comments