The Accelerator_4c_mtf is a sophisticated technical analysis tool designed to help traders identify momentum shifts by comparing different speeds of price movement. Rather than looking at the price directly, this script analyzes the "acceleration" of the market—essentially measuring how quickly the trend is speeding up or slowing down.
Core Logic and Functionality
1. Multi-Timeframe Analysis One of the primary features of this tool is its ability to look at larger timeframes while you are viewing a smaller one. For example, if you are looking at a 5-minute chart, the indicator can be configured to calculate data based on hourly or daily trends. This allows traders to ensure that their short-term moves align with the broader market direction.
2. The Momentum Calculation (Accelerator vs. Decelerator) The script operates by calculating two different types of Moving Averages:
- The Accelerator: This represents the primary momentum of the price.
- The Decelerator: This is a secondary calculation that measures the "speed" of the accelerator.
By subtracting the Decelerator from the Accelerator, the tool produces an oscillator. When this value rises, it suggests that the market trend is gaining strength; when it falls, it indicates the trend may be losing steam or reversing.
3. The Signal Line To smooth out "noise" and prevent false signals, the script applies a third moving average to the result. This creates a "Signal Line." By comparing the main oscillator value against this signal line, traders can more clearly identify turning points in the market.
4. Visual Signaling System The tool translates these complex mathematical differences into a clear visual histogram on your chart:
- Trend Strength: The script automatically detects whether the current momentum is moving upward or downward.
- Color Coding: It uses distinct colors (such as Lime Green and Red) to highlight these movements.
- Dynamic Positioning: The logic distinguishes between "positive" momentum (above zero) and "negative" momentum (below zero). It places the visual bars in a way that makes it easy to see at a glance whether the current strength is reinforcing the trend or signaling an impending change.
Summary for the Trader
In plain terms, this script acts as a "speedometer" for the market. It tells you not just which way the price is going, but how much gas is left in the tank. By identifying when the acceleration begins to drop off before the price actually turns around, it provides a proactive way to visualize market exhaustion and potential reversals across multiple timeframes simultaneously.
//+------------------------------------------------------------------+
//| Accelerator_4c_mtf|
//| Copyright © 2005, MetaQuotes Software Corp. |
//| mtf 2007_ForexTSD keris ki |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 CLR_NONE
#property indicator_color2 LimeGreen
#property indicator_color3 Red
#property indicator_color4 Lime
#property indicator_color5 Red
//----
#property indicator_width3 2
#property indicator_width4 2
//----
extern int TimeFrame=30;
extern int MA1_Period =7;
extern int MA2_Period =14;
extern int MA3_Period =3;
extern int MA_Mode=MODE_SMA;
extern int MA_Price= PRICE_MEDIAN;
extern int SigLineShift =0;
extern int MaxBarsToCount =15000;
//----
extern string TimeFrames="M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
extern string note_MA_Method_Price="SMA0 EMA1 SMMA2 LWMA3||0O,1C 2H3L,4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6";
extern string defaults="5,34,5; SMA,PRICE_MEDIAN";
//---- indicator buffers
double ExtBuffer0[];
double ExtBuffer1[];
double ExtBuffer2[];
double ExtBuffer3[];
double ExtBuffer4[];
double ExtBuffer11[];
double ExtBuffer21[];
double ExtBuffer5[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers(8);
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexShift(0,SigLineShift);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexStyle(3,DRAW_HISTOGRAM);
SetIndexStyle(4,DRAW_HISTOGRAM);
//
IndicatorDigits(Digits+2);
SetIndexDrawBegin(0,38);
SetIndexDrawBegin(1,38);
SetIndexDrawBegin(2,38);
SetIndexDrawBegin(3,38);
SetIndexDrawBegin(4,38);
SetIndexDrawBegin(5,38);
SetIndexDrawBegin(6,38);
//---- 4 indicator buffers mapping
SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
SetIndexBuffer(3,ExtBuffer11);
SetIndexBuffer(4,ExtBuffer21);
SetIndexBuffer(5,ExtBuffer3);
SetIndexBuffer(6,ExtBuffer4);
SetIndexBuffer(7,ExtBuffer5);
//---- name for DataWindow and indicator subwindow label
SetIndexLabel(0,NULL);
SetIndexLabel(1,NULL);
SetIndexLabel(2,NULL);
SetIndexLabel(3,NULL);
SetIndexLabel(4,NULL);
SetIndexLabel(5,NULL);
SetIndexLabel(6,NULL);
//----
switch(TimeFrame)
{
case 1: string TimeFrameStr="M1"; break;
case 5 : TimeFrameStr="M5"; break;
case 15 : TimeFrameStr="M15"; break;
case 30 : TimeFrameStr="M30"; break;
case 60 : TimeFrameStr="H1"; break;
case 240 : TimeFrameStr="H4"; break;
case 1440 : TimeFrameStr="D1"; break;
case 10080 : TimeFrameStr="W1"; break;
case 43200 : TimeFrameStr="MN1"; break;
default : TimeFrameStr ="TF 0";
}
IndicatorShortName("ACC ["+TimeFrameStr+"]");
//----
if (TimeFrame<Period()) TimeFrame=Period();
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Accelerator/Decelerator Oscillator |
//+------------------------------------------------------------------+
int start()
{
double prev,current;
datetime TimeArray[],TimeArray1[];
int i,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined time frame on to current time frame
ArrayCopySeries(TimeArray, MODE_TIME,Symbol(),TimeFrame);
ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),TimeFrame);
//----
limit= Bars-counted_bars;
limit= MathMax(limit,TimeFrame/Period());
limit= MathMin(limit,MaxBarsToCount);
//----
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
ExtBuffer3[i]=iMA(NULL,TimeFrame,MA1_Period,0,MA_Mode,MA_Price,y)
- iMA(NULL,TimeFrame,MA2_Period,0,MA_Mode,MA_Price,y);
ExtBuffer5[y]=ExtBuffer3[i];
}
//---- signal line counted in the 2-nd additional buffer
for(y=0,i=0; i<limit; i++)
{
if (Time[i]<TimeArray1[y]) y++;
ExtBuffer4[i]=iMAOnArray(ExtBuffer5,0,MA3_Period,0,MA_Mode,y);
}
//---- dispatch values between 2 buffers
bool up=true;
for(i=limit-1; i>=0; i--)
{
current=ExtBuffer3[i]-ExtBuffer4[i];
prev=ExtBuffer3[i+1]-ExtBuffer4[i+1];
//----
if(current>prev) up=true;
if(current<prev) up=false;
if(!up)
{
if(current>0)
{
ExtBuffer1 [i]=current;
ExtBuffer11[i]=0.0;
ExtBuffer2 [i]=0.0;
ExtBuffer21[i]=0.0;
}
else
{
ExtBuffer21[i]=current;
ExtBuffer1 [i]=0.0;
ExtBuffer2 [i]=0.0;
ExtBuffer11[i]=0.0;
}
}
else
{
if (current>0)
{
ExtBuffer11[i]=current;
ExtBuffer2 [i]=0.0;
ExtBuffer1 [i]=0.0;
ExtBuffer21[i]=0.0;
}
else
{
ExtBuffer2 [i]=current;
ExtBuffer11[i]=0.0;
ExtBuffer1 [i]=0.0;
ExtBuffer21[i]=0.0;
}
}
ExtBuffer0[i]=current;
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
Comments