Doda-Trend
Download scriptThis tool is designed to provide traders with a real-time visual summary of current market conditions by analyzing price behavior. Instead of just showing raw numbers, it interprets the relationship between two specific market dynamics to determine if the market is currently "Trending" or "Range-Bound."
How the Logic Works
The script functions by comparing two distinct mathematical measurements of the market:
- Volatility Measurement (ATR): The tool looks at the Average True Range, which calculates how much the price has been moving on average over a specific period. High values here suggest large price swings, while low values suggest smaller movements.
- Price Stability Measurement (Standard Deviation): The tool simultaneously calculates the Standard Deviation using an Exponential Moving Average. This measures how much the price is deviating from its recent average path.
The Decision Process
The core "intelligence" of the script lies in how it weighs these two measurements against each other:
- Trending Market: If the Standard Deviation (price stability) is higher than the Volatility Measurement, the script identifies the market as being in a Trending state. This suggests that price movements are consistent and following a clear direction with sustained momentum.
- Range-Bound Market: If the Volatility Measurement is higher than the Standard Deviation, the script classifies the market as Range-Bound. This indicates that while there may be some price movement, it lacks a consistent direction, suggesting the price is likely fluctuating within a horizontal corridor or "sideways" zone.
Visual Presentation
To ensure ease of use for the trader, the script removes the need to interpret complex charts. It automatically updates a clear text label directly on your trading screen. At a glance, you can see a dedicated status message that tells you the current market personality—either "Trending" or "Range-Bound"—allowing for faster decision-making based on the prevailing environment.
//+------------------------------------------------------------------+
//| Doda-Trend.mq4 |
//| Copyright © 2010, InvestmentKit.com |
//| http://www.InvestmentKit.com |
//| http://www.DodaCharts.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, InvestmentKit.com"
#property link "http://www.InvestmentKit.com"
#property indicator_chart_window
double myatr, mystd;
string atrresult;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
ObjectCreate("myatr",OBJ_LABEL,0,0,0);
ObjectCreate("myatrheading",OBJ_LABEL,0,0,0);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectDelete("myatr");
ObjectDelete("myatrheading");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
myatr = iATR(NULL,0,14,0);
mystd = iStdDev(NULL,0,14,0,MODE_EMA,PRICE_CLOSE,0);
if (myatr > mystd) atrresult = "Range-Bound";
if (myatr < mystd) atrresult = "Trending";
///////////////////////////////////////////////////////
ObjectSetText("myatrheading","Trend Indicator v1.0 by InvestmentKit.com", 10, "Arial", Red);
ObjectSet("myatrheading",OBJPROP_XDISTANCE,2);
ObjectSet("myatrheading",OBJPROP_YDISTANCE,40);
ObjectSet("myatrheading", OBJPROP_CORNER, 2);
ObjectSetText("myatr",StringConcatenate("Current Trend: ", atrresult), 10, "Arial", Red);
ObjectSet("myatr",OBJPROP_XDISTANCE,2);
ObjectSet("myatr",OBJPROP_YDISTANCE,20);
ObjectSet("myatr", OBJPROP_CORNER, 2);
//----
return(0);
}
//+------------------------------------------------------------------+
Comments