Author: Kalenzo
SAR Colour

This tool is a visual trading assistant designed to simplify the way traders view market trends by providing clear, color-coded signals based on price movement. It takes a standard technical analysis calculation known as the Parabolic SAR and transforms it into an easy-to-read visual format directly on your trading chart.

How the Logic Works

The core logic of this script focuses on identifying "breakout" points where the price moves significantly enough to switch momentum. Instead of just showing a continuous line of dots, this tool analyzes the relationship between the calculated trend value and the actual highest price reached during a specific period.

Here is the step-by-step breakdown of how it processes market data:

  • Trend Calculation: The script constantly monitors the market to calculate a "turning point" value. This value acts as a dynamic buffer that follows the price, adjusting its distance based on recent volatility and movement.
  • Price Comparison: At every new price update (every candle), the script compares this calculated turning point against the highest price reached in that period.
  • Dynamic Switching:
    • Resistance Signal: If the calculated value is equal to or higher than the current high price, the tool identifies this as a potential area of resistance. It visually marks this on your chart in Red.
    • Support Signal: If the calculated value falls below the high price, it indicates that the upward momentum is strong enough to "break through" the previous level. The tool then switches the visual signal to Green.
  • Visual Clarity: By using two distinct colors (Red and Green) and specific arrow symbols, the script removes the guesswork of interpreting raw numbers. It allows you to see at a glance whether the current market sentiment is leaning toward a bearish (downward) or bullish (upward) trend based on where the price sits in relation to its historical turning points.

Summary for the User

Essentially, this tool acts as a "traffic light" for market momentum. When the script detects that the price is struggling to push past a certain level, it highlights the area in Red; when the price successfully pushes through, the signal flips to Green. This helps traders quickly identify potential entry and exit zones by visualizing shifts in market direction in real-time.

Price Data Components
Series array that contains the highest prices of each bar
Indicators Used
Parabolic Stop and Reverse system
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
SAR Colour
//+------------------------------------------------------------------+
//|                                                   SAR Colour.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property copyright "Kalenzo"
#property link      "http://www.foreksik.prv.pl"

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

double sarUp[],sarDn[];//buffers
extern double Step = 0.013;
extern double Maximum = 0.2;
extern int Precision = 5;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,EMPTY,2);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,2);
   SetIndexBuffer(0,sarUp);
   SetIndexBuffer(1,sarDn);
   SetIndexArrow(0,158);
   SetIndexArrow(1,158);
   
   IndicatorShortName("SAR COLORED");
   SetIndexLabel(0,"SAR Up Channel");
   SetIndexLabel(1,"SAR Down Channel");
   
   SetIndexDrawBegin(0,2);
   SetIndexDrawBegin(1,2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- 
   for(int i = 0; i<limit ;i++)
   {
      double sar = NormalizeDouble(iSAR(Symbol(),0,Step,Maximum,i),Precision);
      if(sar >= iHigh(Symbol(),0,i)) 
      {
         sarUp[i] = sar;  
         sarDn[i] = 0;
      }
      else
      {
         sarUp[i] = 0;
         sarDn[i] = sar;
      }
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments