Author: Copyright � 2009, MoForce
PwR

This tool is designed as a visual momentum indicator for the MetaTrader trading platform. Its primary purpose is to help traders identify the strength and direction of market trends by measuring the underlying "power" generated by buying and selling pressures.

How the Logic Works

The script operates by performing a three-step calculation to transform raw market data into visual signals:

1. Measuring Market Power The core of the indicator relies on calculating two distinct forces: the "Bulls Power" (buying pressure) and the "Bears Power" (selling pressure). The tool looks back at a specific historical timeframe to determine how much momentum is being generated by each side of the market.

2. Aggregating Sentiment The script combines these two forces into a single cumulative value.

  • When the combined power is positive, it suggests that the upward momentum (buying) is dominating the current price action.
  • When the combined power is negative, it indicates that the downward momentum (selling) is taking control.

3. Smoothing and Visualization To make the data easier for a human trader to read, the script applies a moving average to the calculated power values. This "smooths out" the jagged spikes of price volatility, creating a clearer line that shows the general trend of market momentum.

Visual Representation

The results are displayed in a separate window on your trading chart using a combination of different visual elements:

  • Histograms: These provide a vertical representation of the raw power levels, allowing you to see the magnitude of the moves.
  • Lines: These represent the smoothed averages, helping you identify the overall direction of the trend more clearly than looking at individual price bars alone.

Summary for the Trader

Essentially, this indicator acts as a "momentum thermometer." By watching how the histograms and lines move above or below the zero line, you can gauge whether the market is currently being pushed primarily by buyers or sellers, and how much strength that movement possesses.

Indicators Used
Bears Power indicatorBulls Power indicator Moving average indicator
Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
PwR
#property copyright "Copyright © 2009, MoForce"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Black
#property indicator_color2 Blue
#property indicator_color3 Red
#property indicator_color4 Lime
#property indicator_color5 White

int g_period_76 = 3;
int gi_unused_80 = 26;
int g_period_84 = 144;
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];

int init() {
   SetIndexStyle(0, DRAW_NONE);
   SetIndexStyle(1, DRAW_HISTOGRAM);
   SetIndexStyle(2, DRAW_HISTOGRAM);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexStyle(4, DRAW_LINE);
   SetIndexDrawBegin(1, g_period_84);
   IndicatorDigits(Digits + 1);
   SetIndexBuffer(0, g_ibuf_104);
   SetIndexBuffer(1, g_ibuf_88);
   SetIndexBuffer(2, g_ibuf_92);
   SetIndexBuffer(3, g_ibuf_96);
   SetIndexBuffer(4, g_ibuf_100);
   IndicatorShortName("PwR");
   return (0);
}

int start() {
   int li_4 = IndicatorCounted();
   if (li_4 > 0) li_4--;
   int li_0 = Bars - li_4;
   for (int li_8 = 0; li_8 < li_0; li_8++) {
      if (iBullsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8) + iBearsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8) >= 0.0) {
         g_ibuf_88[li_8] = iBullsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8) + iBearsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8);
         g_ibuf_92[li_8] = 0;
         g_ibuf_104[li_8] = iBullsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8) + iBearsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8);
      } else {
         g_ibuf_88[li_8] = 0;
         g_ibuf_92[li_8] = iBullsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8) + iBearsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8);
         g_ibuf_104[li_8] = iBullsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8) + iBearsPower(NULL, 0, g_period_84, PRICE_CLOSE, li_8);
      }
   }
   for (li_8 = 0; li_8 < li_0; li_8++) {
      if (iMAOnArray(g_ibuf_104, Bars, g_period_76, 0, MODE_SMA, li_8) >= 0.0) g_ibuf_96[li_8] = iMAOnArray(g_ibuf_104, Bars, g_period_76, 0, MODE_SMA, li_8);
      else g_ibuf_100[li_8] = iMAOnArray(g_ibuf_104, Bars, g_period_76, 0, MODE_SMA, li_8);
   }
   return (0);
}

Comments