RCFMA
Download scriptThis technical indicator is designed to provide traders with a visual representation of price momentum and trend shifts by calculating the differences between various Moving Averages. Instead of looking at price alone, it analyzes how different mathematical averages interact with each other to identify underlying market behavior.
The logic operates through two distinct components displayed in a separate window below your main chart:
1. The WASOM Component (Trend Distance)
The first part of the indicator measures the "gap" between two specific trends. It calculates a Medium-term Moving Average and a Slow-moving Moving Average. By subtracting the slow value from the medium value, it creates a histogram that shows the distance between these two trends.
- What this tells you: This helps in visualizing the strength of the current trend. When the histogram expands, it suggests that the medium-term momentum is pulling away from the long-term average. When it contracts, it may indicate that the trend is losing steam or consolidating.
2. The DFMA Component (Rate of Change)
The second part of the indicator focuses on the immediate acceleration of the price. It looks at a Fast Moving Average and calculates the difference between its current value and its previous value. This is represented as a continuous line on your screen.
- What this tells you: This acts as a momentum oscillator. It measures how quickly the price is moving right now. A sharp rise in this line indicates accelerating upward movement, while a drop suggests that the price is decelerating or reversing.
Customizable Parameters
The script is highly flexible, allowing you to tailor its sensitivity to different trading styles:
- Time Periods: You can adjust the lengths for the Fast, Medium, and Slow averages (e.g., shorter periods for aggressive day trading or longer periods for steady swing trading).
- Moving Average Type: You can choose between several mathematical models, including Simple, Exponential, Smoothed, and Linear-Weighted averages, depending on how much "lag" you want to eliminate from the data.
- Price Source: You can decide whether the indicator should calculate its data based on the closing price, opening price, highs, lows, or a combination of these values.
By combining these two metrics, the indicator allows you to see both the macro-strength of the trend (the histogram) and the micro-velocity of the current price action (the line) simultaneously.
//+------------------------------------------------------------------+
//| RCFMA.mq4 |
//| Copyright © 2009, LeMan. |
//| b-market@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, LeMan."
#property link "b-market@mail.ru"
//---- íàñòðîéêè èíäèêàòîðà
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_width1 1
#property indicator_width2 1
//---- Âõîäíûå ïàðàìåòðû
extern int FastMA = 4; // Äëèíà áûñòðîãî ÌÀ
extern int MiddleMA = 9; // Äëèíà ïðîìåæóòî÷íîãî ÌÀ
extern int SlowMA = 18; // Äëèíà ìåäëåííîãî ÌÀ
extern int TypeMA = 0; // 0 - ïðîñòîå(SMA), 1 - ýêñïîíåíöèàëüíîå(EMA), 2 - ñãëàæåííîå(SSMA), 3 - ëèíåéíî-âçâåøåííîå(LWMA)
extern int TypePrice = 0; // 0 - Çàêðûòèå, 1 - Îòêðûòèå, 2 - ìàêñèìàëüíàÿ, 3 - ìèíèìàëüíàÿ, 4 - ñðåäíÿÿ, 5 - òèïè÷íàÿ, 6 - âçâåøåííàÿ çàêðûòèÿ
//---- Áóôåðû èíäèêàòîðà
double WASOMBuffer[];
double DFMABuffer[];
//+------------------------------------------------------------------+
int init() {
//----
SetIndexStyle(0, DRAW_HISTOGRAM);
SetIndexStyle(1, DRAW_LINE);
SetIndexDrawBegin(1, SlowMA);
IndicatorDigits(Digits+1);
//----
SetIndexBuffer(0,WASOMBuffer);
SetIndexBuffer(1,DFMABuffer);
//----
IndicatorShortName("RCFMA ("+FastMA+","+MiddleMA+","+SlowMA+")");
SetIndexLabel(0, "WASOM");
SetIndexLabel(1, "DFMA");
//----
return(0);
}
//+------------------------------------------------------------------+
int start() {
int limit;
int counted_bars = IndicatorCounted();
//----
if (counted_bars > 0) counted_bars--;
limit = Bars-counted_bars;
//----
for (int i = 0; i < limit; i++) {
WASOMBuffer[i] = iMA(NULL,0,MiddleMA,0,TypeMA,TypePrice,i)-iMA(NULL,0,SlowMA,0,TypeMA,TypePrice,i);
}
//----
for (i = 0; i < limit; i++) {
DFMABuffer[i] = iMA(NULL,0,FastMA,0,TypeMA,TypePrice,i)-iMA(NULL,0,FastMA,0,TypeMA,TypePrice,i+1);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments