TP_SAR_Colored_Arrows

Download script
Author: Ron Mauldin
TP_SAR_Colored_Arrows

This tool is designed to simplify the way traders identify potential trend shifts and momentum in the financial markets. It works by calculating a specific mathematical "trailing" value that moves in relation to price action, visually representing the dynamic boundary between upward and downward movements.

How the Logic Works

The core functionality of this script revolves around a tracking system that follows the price of an asset. Instead of just looking at where the price is right now, the tool calculates a specific level based on two main factors: the volatility of the market (how much the price swings) and its recent history.

1. The Calculation Engine The script uses a formula to generate a value that "shadows" the price. As the market moves, this value adjusts itself. If the price is moving strongly in one direction, the value stays at a calculated distance behind it. This creates a dynamic ceiling or floor that reacts to the speed and intensity of the price movement.

2. Identifying Trends (The Logic Gate) The script constantly compares the current market price against this calculated tracking value. It uses a simple "if/then" logic to decide which direction the market is leaning:

  • Downside Pressure: If the tracking value sits above the highest price reached in a recent period, the script recognizes a downward trend or a state of resistance.
  • Upside Momentum: If the tracking value falls below the lowest price reached in that same period, the script identifies an upward trend or a state of support.

3. Visual Feedback To make this data easy for a human to read at a glance, the script translates these mathematical conditions into visual markers on your chart:

  • Down Channels: When the logic detects a downward bias, it places specific colored arrows (Red) to highlight that the "ceiling" has been established.
  • Up Channels: When the logic detects an upward bias, it places different colored arrows (Chartreuse/Green) to show that the "floor" has been established.

Summary for the User

Essentially, this script acts as a visual guide for trend following. Rather than forcing you to manually track complex price fluctuations, it automatically calculates the "turning points" of the market. When you see the arrows switch colors, it is the tool's way of signaling that the mathematical boundary between a buying and selling trend has flipped, allowing for quicker identification of market sentiment.

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
10 Views
0 Downloads
0 Favorites
TP_SAR_Colored_Arrows
//+------------------------------------------------------------------+
//|                                        TP_SAR_Colored_Arrows.mq4 |
//|                                                      Ron Mauldin |
//|                                                  http://fx41.com |
//+------------------------------------------------------------------+
#property copyright "Ron Mauldin"
#property link      "http://fx41.com"

#property indicator_color1 Red
#property indicator_color2 Chartreuse
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_width1 2
#property indicator_width2 2

double sarUp[],sarDn[];//buffers
double SAR_Step = 0.04;
double SAR_Maximum = 0.5;
int SAR_Precision = 7;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init(){
//---- indicators
 SetIndexStyle(0,DRAW_ARROW);
 SetIndexStyle(1,DRAW_ARROW);
 SetIndexBuffer(0,sarDn);
 SetIndexBuffer(1,sarUp);
 SetIndexArrow(0,226);
 SetIndexArrow(1,225);
   
 IndicatorShortName("SAR Colored Arrows");
 SetIndexLabel(0,"SAR Down Channel");
 SetIndexLabel(1,"SAR Up Channel");
   
 SetIndexDrawBegin(0,2);
 SetIndexDrawBegin(1,2);
//----
 return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit(){return(0);}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start(){
 int counted_bars = IndicatorCounted();
 if(counted_bars<0) counted_bars=0;
 if(counted_bars>0) counted_bars--;
 int limit = (Bars - 1 - counted_bars);
 for(int bar = limit; bar >= 0; bar--){  
  double sar = NormalizeDouble(iSAR(Symbol(),0,SAR_Step,SAR_Maximum,bar),SAR_Precision);
  if(sar >= iHigh(Symbol(),0,bar)){
   sarUp[bar] = 0;
   sarDn[bar] = sar;
  }else{
   sarUp[bar] = sar;  
   sarDn[bar] = 0;
  }
 }
 //----
 return(0);
}
//+------------------------------------------------------------------+

Comments