ind - Profitunity Bars_v1
Download scriptThis tool is designed to provide a visual representation of market momentum by identifying specific price action trends over a set period of history. Rather than showing complex numbers, it simplifies market data into clear, color-coded signals on your chart to help you distinguish between upward and downward movements.
How the Logic Works
The script scans the historical price data (specifically looking back at the last 300 bars by default) to determine the direction of the market trend. It achieves this by comparing two specific technical components:
- Trend Identification: The tool looks for simultaneous growth or decline in two different price metrics. When both of these metrics increase from one bar to the next, the script identifies a bullish (upward) momentum. Conversely, when both metrics decrease, it identifies a bearish (downward) momentum.
- Visual Representation: Once the direction is established, the tool draws histograms directly on your chart:
- Bullish Movement: If the logic detects an upward trend, it highlights the area between the high and low prices of that bar in Lime Green.
- Bearish Movement: If the logic detects a downward trend, it highlights the area between the high and low prices of that bar in Red.
Summary for Traders
Essentially, this indicator filters out market "noise" by looking for confirmed shifts in momentum. By highlighting these segments visually, it allows you to see at a glance where the market has been trending consistently versus where it has been volatile or indecisive. It serves as a visual map of price flow, making it easier to identify the prevailing direction of the market over time.
//+------------------------------------------------------------------+
//| ind - Profitunity Bars.mq4 |
//| Copyright © 2006, Andrew Suvorov |
//| trade@sibp.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Andrew Suvorov"
#property link "trade@sibp.ru"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 2
//----
double buf1[];
double buf2[];
//----
extern int nAccountedBars=300;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,buf1);
SetIndexDrawBegin(0,0);
//
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,buf2);
SetIndexDrawBegin(1,0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
for(int CurrentBar=0;CurrentBar<=nAccountedBars;CurrentBar++)
{
if(iAO(Symbol(),0,CurrentBar) > iAO(Symbol(),0,CurrentBar+1) &&
iAC(Symbol(),0,CurrentBar) > iAC(Symbol(),0,CurrentBar+1))
{
buf1[CurrentBar]=High[CurrentBar];
buf2[CurrentBar]=Low[CurrentBar];
}
if(iAO(Symbol(),0,CurrentBar) < iAO(Symbol(),0,CurrentBar+1) &&
iAC(Symbol(),0,CurrentBar) < iAC(Symbol(),0,CurrentBar+1))
{
buf1[CurrentBar]=Low[CurrentBar];
buf2[CurrentBar]=High[CurrentBar];
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments