Author: Copyright 2013, rockyhoangdn@gmail.com
CheckPower

This tool is designed as a visual technical indicator for the MetaTrader platform, specifically created to identify significant shifts in market momentum by measuring the "power" of buying and selling forces. It helps traders pinpoint potential entry points by analyzing whether one side of the market is consistently overpowering the other over a specific period.

How the Logic Works

The script operates by calculating and comparing two primary forces: Bulls (buying pressure) and Bears (selling pressure). Instead of looking at just the current price, it evaluates the strength of these movements to determine if a trend is dominant enough to be considered a valid signal.

1. Momentum Analysis

The core logic involves a "Power Check." The script looks at the relative strength of buyers versus sellers. It doesn't just look at one single candle; it calculates a cumulative power score. If the buying power significantly outweighs the selling power (or vice versa) over a rolling series of data points, the script identifies this as a "powerful" move.

2. Identifying Buy and Sell Signals

The script scans the market history to find specific conditions:

  • Buy Signals: When the logic detects that buying pressure is overwhelming the selling force, it flags a potential "Bull" movement. It then looks for a specific price confirmation (an upward price movement) before marking a "Long Entry" point on your chart.
  • Sell Signals: Conversely, when selling pressure dominates the buying force, it flags a "Bear" movement. It checks for downward price confirmation to highlight a "Short Entry" point.

3. Visual Representation

To make this information easy to read at a glance, the script translates these complex calculations into visual markers on your trading chart:

  • Bull/Bear Markers: These indicate where the script has detected high-strength pressure in either direction.
  • Entry Arrows: When the power conditions are met and confirmed by a directional price change, the script places specific arrows (Long/Short entries). These serve as visual cues for where the momentum shift might be most significant for a potential trade.

Summary for the Trader

In simple terms, this script acts as a filter. It ignores "noise" and weak movements, only highlighting areas where there is a clear imbalance of power between buyers and sellers. By using these signals, you can better identify when a trend has enough strength to potentially sustain a move in your favor.

Indicators Used
Bulls Power indicator Bears Power indicator
Miscellaneous
Implements a curve of type %1
17 Views
0 Downloads
0 Favorites
CheckPower
//+------------------------------------------------------------------+
//|                                                   CheckPower.mq4 |
//|                           Copyright 2013, rockyhoangdn@gmail.com |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, rockyhoangdn@gmail.com"
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Aqua
#property indicator_color2 FireBrick
#property indicator_color3 Aqua
#property indicator_color4 Yellow
#property indicator_width1 0
#property indicator_width2 0
#property indicator_width3 0
#property indicator_width4 0
double Bulls[];
double Bears[];
double LongEntry[];
double ShortEntry[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_NONE);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexBuffer(0,Bulls);
   SetIndexBuffer(1,Bears);
   SetIndexBuffer(2,LongEntry);
   SetIndexBuffer(3,ShortEntry);
   SetIndexArrow(0,119);
   SetIndexArrow(1,119);
   SetIndexArrow(2,225);
   SetIndexArrow(3,226);
   SetIndexLabel(0,"Bulls");
   SetIndexLabel(1,"Bears");
   SetIndexLabel(2,"LongEnt");
   SetIndexLabel(3,"ShortEnt");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int limit;
   limit = Bars-counted_bars;
   if(limit<0)limit=0;
//----for
   for(int i=limit;i>=1;i--) 
      { 
      if(CheckPower(i,"CheckBuy"))     
         {
         Bulls[i]=Low[i]; 
         if(!UpBarCheck(i)) LongEntry[i-1]=Low[i+1];
         }
         else Bulls[i]=EMPTY_VALUE;
      if(CheckPower(i,"CheckSell"))    
         {
         Bears[i]=High[i];
         if(UpBarCheck(i)) ShortEntry[i-1]=High[i+1];
         }
         else Bears[i]=EMPTY_VALUE;
      }//end for
//----
   return(0);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool CheckPower(int i, string mode)   
   {
      double Bull_power =Bullspower(i);   
      double Bear_power =Bearspower(i);  
      double Bull_power_LK =Bullspower(i)+Bullspower(i+1);//+Bullspower(i+2)+Bullspower(i+3)+Bullspower(i+4)+Bullspower(i+5);   
      double Bear_power_LK =Bearspower(i)+Bearspower(i+1);//+Bearspower(i+2)+Bearspower(i+3)+Bearspower(i+4)+Bearspower(i+5);  
      if(mode=="CheckBuy")
         {
         for(int x=i+1;x<=Bars;x++ )
            {
            if(Bear_power > Bull_power_LK) {return(true); break;}
               else 
                  {
                  if(Bull_power > Bear_power_LK)   {return(false);break;}
                     else
                        {
                        Bull_power=Bull_power+Bullspower(x);
                        Bear_power =Bear_power+Bearspower(x);  
                        Bull_power_LK=Bull_power_LK+Bullspower(x+1);   
                        Bear_power_LK =Bear_power_LK+Bearspower(x+1);  
                        }
                  }///else
            }//for
         }//if   
      //----
      if(mode=="CheckSell")
         {
         for(x=i+1;x<=Bars;x++ )
            {
            if(Bull_power > Bear_power_LK)   {return(true);break;}
               else
                  {
                  if(Bear_power > Bull_power_LK) {return(false); break;}
                     else 
                        {
                        Bull_power=Bull_power+Bullspower(x);
                        Bear_power =Bear_power+Bearspower(x);  
                        Bull_power_LK=Bull_power_LK+Bullspower(x+1);   
                        Bear_power_LK =Bear_power_LK+Bearspower(x+1);  
                        }
                  }///else
            }//for
         }//if   
      }//if   

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Bullspower(int i)
   {
   double returnbullvalue = MathAbs(iBullsPower(NULL, 0, 1,PRICE_CLOSE,i));
   return(returnbullvalue);
   }
//----
double Bearspower(int i)
   {
   double returnbearvalue = MathAbs(iBearsPower(NULL, 0, 1,PRICE_CLOSE,i));
   return(returnbearvalue);
   }
   
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool UpBarCheck(int i)   
   {
   if(Close[i]<Close[i+1])    return(false);///down bar
   if(Close[i]>Close[i+1])    return(true);///up bar
   if(Close[i]==Close[i+1])   
      {
      if(Close[i]<Close[i+2])    return(false);///down bar
      if(Close[i]>Close[i+2])    return(true);///up bar
      }
   }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

Comments