This tool is designed to help traders visualize market momentum by combining two key elements of price action: Volume and Price Velocity. Instead of just showing you where the price is, it helps identify how much "force" is behind a move.
How the Logic Works
The script operates by looking at three primary components to generate its visual data:
- Price Movement (Velocity): The tool calculates the change in price over a specific period of time. Rather than looking at just one single candle, it compares the average movement of the current period against the previous one. This tells the indicator whether the trend is accelerating or slowing down.
- Volume: It incorporates the trading volume—the total amount of activity occurring in the market. This is crucial because a price move on low volume may be insignificant, while a move on high volume suggests strong conviction from buyers or sellers.
- The "Force" Calculation: The final result (the line you see on your chart) is created by multiplying the Price Velocity by the Volume.
What This Means for Your Trading
By multiplying these two factors together, the indicator highlights "significant" moves.
- If the price is moving quickly and the volume is high, the indicator will show a strong surge, signifying high-momentum force.
- If the price is moving but the volume is dropping, the "force" indicated by the tool will be much smaller, suggesting that the current move might lack staying power.
Customization Options
The script allows you to adjust three main settings to tailor it to different timeframes or assets:
- Period: You can choose how many candles back the tool should look to calculate its averages. A shorter period makes the tool more reactive to immediate changes, while a longer period provides a smoother, broader view of the trend.
- Moving Average Method: This allows you to choose how the "average" price is calculated (e.g., simple or smoothed), which impacts how much "noise" from the market filters into the indicator.
- Applied Price: You can decide which part of the candle the calculation should focus on, such as the closing price or the midpoint, to better suit your specific trading style.
//+------------------------------------------------------------------+
//| Force Index.mq4 |
//| Copyright © 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- input parameters
extern int ExtForcePeriod=13;
extern int ExtForceMAMethod=0;
extern int ExtForceAppliedPrice=0;
//---- buffers
double ExtForceBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string sShortName;
SetIndexBuffer(0, ExtForceBuffer);
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
//---- name for DataWindow and indicator subwindow label
sShortName="Force("+ExtForcePeriod+")";
IndicatorShortName(sShortName);
SetIndexLabel(0,sShortName);
//----
SetIndexDrawBegin(0,ExtForcePeriod);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Force Index indicator |
//+------------------------------------------------------------------+
int start()
{
int nLimit;
int nCountedBars=IndicatorCounted();
//---- check for possible errors
if(nCountedBars<0) return(-1);
//---- last counted bar will be recounted
nLimit=Bars-ExtForcePeriod;
if(nCountedBars>ExtForcePeriod) nCountedBars--;
nLimit=Bars-nCountedBars;
//---- Force Index counted
for(int i=0; i<nLimit; i++)
ExtForceBuffer[i]= Volume[i]*(iMA(NULL,0,ExtForcePeriod,0,ExtForceMAMethod,ExtForceAppliedPrice,i)-
iMA(NULL,0,ExtForcePeriod,0,ExtForceMAMethod,ExtForceAppliedPrice,i+1));
//---- done
return(0);
}
//+------------------------------------------------------------------+
Comments