Author: Copyright � 2005, Pavel Kulko
Wiseman_1

This tool is designed to help traders identify specific types of price momentum shifts by detecting "divergent bars" on a trading chart. Instead of looking at standard trends, it focuses on the relationship between the current price action and the overall range of each individual candle.

Core Logic Overview

The script analyzes every candle on your chart to determine if the price is moving in a direction that contradicts its physical structure. It does this by identifying three key components of each bar:

  1. The Low: The lowest point reached by the price.
  2. The High: The highest point reached by the price.
  3. The Median: The exact midpoint between the high and the low (the "center" of the candle).

How It Identifies Signals

The logic scans the market history to find two specific types of anomalies:

  • Upward Divergence: The script looks for instances where the current price's low point is lower than the previous candle's low point, yet the actual closing price remains above the midpoint of the candle. This suggests a "hidden" strength where the price dipped significantly but recovered to stay in the upper half of its range.
  • Downward Divergence: Conversely, the script looks for instances where the current price's high point is higher than the previous candle's high point, but the closing price fails to reach the midpoint, staying in the lower half of its range. This suggests a "hidden" weakness where the price spiked upward but failed to sustain momentum.

Visual Representation

When the script detects these specific conditions, it highlights them on your chart using two distinct colored histograms:

  • Aqua Signals: These represent the identified upward divergent movements.
  • Red Signals: These represent the identified downward divergent movements.

By highlighting these specific price behaviors, the tool allows traders to see where the "effort" of the market (the high and low range) is not matching the "result" (the closing price), potentially helping to spot shifts in sentiment before they become obvious trends.

Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
Wiseman_1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                    Wiseman 1.mq4 |
//|                           Bill Williams Wiseman 1 Divergent bars |
//|                                             Author: David Thomas |
//|                                      MQ4 Conversion: Pavel Kulko |
//|                                                  polk@alba.dp.ua |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Pavel Kulko"
#property link      "polk@alba.dp.ua"

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

double UpBuf[],DnBuf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
   SetIndexStyle(0,DRAW_HISTOGRAM,0,2);
   SetIndexBuffer(0,UpBuf); 
   SetIndexStyle(1,DRAW_HISTOGRAM,0,2);
   SetIndexBuffer(1,DnBuf);
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int result;
   double median;
   int    counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   for(int i=limit; i>=0; i--) {
     result = 0;
     median = (High[i]+Low[i])/2;
     if((Low[i] < Low[i+1]) && (Close[i] > median)) result = -1;
     if((High[i] > High[i+1]) && (Close[i] < median)) result = 1;
     if(result > 0) {
       UpBuf[i] = Low[i];
       DnBuf[i] = High[i];
     }
     if(result < 0) {
       UpBuf[i] = High[i];
       DnBuf[i] = Low[i];
     }
   }
   return(0);
}
//+------------------------------------------------------------------+

Comments