Rads_T3_Stochastic-3_obosx_alert
Download scriptThis tool is a specialized technical analysis indicator designed for the MetaTrader platform. It combines two well-known trading concepts—the Stochastic Oscillator and the T3 Moving Average—into a single visual tool to help traders identify potential momentum shifts and price reversals in the market.
Core Logic Overview
The primary goal of this script is to provide a "smoothed" version of the standard Stochastic Oscillator. While a standard Stochastic indicator can sometimes be "noisy" or produce many false signals, this script applies a sophisticated mathematical filter (the T3 logic) to create smoother, more reliable lines on your chart.
How it Works
- The Foundation (Stochastic): The script starts by calculating the standard Stochastic values. This measures the current price relative to its high-low range over a specific period, helping to determine if an asset is "overbought" or "oversold."
- The Smoothing Layer (T3 Filter): Instead of displaying the raw Stochastic lines, the script passes them through a T3 calculation. This specific type of moving average is designed to reduce "market noise" while maintaining much better responsiveness than traditional moving averages. It effectively "cleans up" the movement, making it easier for a trader to see the true direction of the momentum.
- Dual Line Tracking: The script generates two distinct lines:
- Main Line: The primary smoothed Stochastic value.
- Signal Line: A secondary smoothed value used to identify crossovers (where one line crosses over the other), which many traders use as a trigger for entering or exiting positions.
Visual Levels and Alerts
The indicator includes built-in thresholds to help manage risk:
- Overbought/Oversold Levels: It features standard boundary lines (typically 80 and 20) to highlight extreme market conditions.
- Automated Notifications: One of the key features of this script is its automated alerting system. It monitors the "Main Line" as it interacts with these overbought and oversold levels. If the price momentum crosses into or out of these zones, the script can provide real-time feedback via:
- On-Screen Pop-ups: Visual alerts on your trading platform.
- Audio Signals: Playing a specific sound file to grab your attention.
- Email Notifications: Sending an alert directly to your inbox (if configured).
Summary for the Trader
Essentially, this script acts as a high-quality "filter" for momentum trading. It takes the raw speed of the Stochastic oscillator and subjects it to a sophisticated smoothing algorithm, providing a cleaner visual representation of market strength. It then acts as a watchdog, notifying you immediately when the market reaches critical momentum thresholds so you don't have to watch the screen constantly.
//+------------------------------------------------------------------+
//| T3 Stochastic.mq4 |
//| Original Code by FX Sniper |
//| Copyright © 2007, Forex-TSD.com |
//| Written by Linuxser |
//+------------------------------------------------------------------+
//mod alerts obos cross
#property copyright "Copyright © 2007, Forex-TSD.com "
#property link "http://www.forex-tsd.com/"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Black
#property indicator_color2 DarkBlue
#property indicator_level1 80
#property indicator_level2 20
#property indicator_levelcolor DarkGray
#property indicator_levelstyle 2
//----
extern int KPeriod=13;
extern int DPeriod=3;
extern int Slowing=3;
extern int Price_field = 1; //Price field parameter. Can be one of this values: 0 - Low/High or 1 - Close/Close.
extern int MA_Method = 3; //MODE_SMA : 0 // MODE_EMA: 1 // MODE_SMMA: 2 // MODE_LWMA: 3 //
extern int T3_Period = 9;
extern double b = 0.81;
extern int Style = 0;
extern int OBlevel =80;
extern int OSlevel =20;
extern bool SoundAlert = true;
extern bool BoxAlert = true;
extern bool EmailAlert = false;
extern int AlertOnBar = 1;
extern string soundfile = "news.wav";
datetime alerttag;
//----
double e1, e2, e3, e4, e5, e6;
double e1a, e2a, e3a, e4a, e5a, e6a;
double c1, c2, c3, c4;
double c1a, c2a, c3a, c4a;
double n, w1, w2, b2, b3;
double na, w1a, w2a, b2a, b3a;
double Stochastic[];
double Stochastic_Signal[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators setting
SetIndexBuffer(0, Stochastic);
SetIndexBuffer(1, Stochastic_Signal);
//----
SetIndexStyle(0, DRAW_LINE,0);
SetIndexStyle(1, DRAW_LINE,0);
//----
IndicatorShortName("Rads Stochastic T3("+KPeriod+","+DPeriod+","+Slowing+", T3 "+T3_Period+ ")");
SetIndexLabel(0, "Stochastic");
SetIndexLabel(1, "Signal");
//---- variable reset
b2 = b*b;
b3 = b2*b;
c1 = -b3;
c2 = (3*(b2 + b3));
c3 = -3*(2*b2 + b + b3);
c4 = (1 + 3*b + b3 + 3*b2);
n = T3_Period;
b2a = b*b;
b3a = b2a*b;
c1a = -b3a;
c2a = (3*(b2a + b3a));
c3a = -3*(2*b2a + b + b3a);
c4a = (1 + 3*b + b3a + 3*b2a);
na = T3_Period;
//----
if(n < 1)
n = 1;
n = 1 + 0.5*(n - 1);
w1 = 2 / (n + 1);
w2 = 1 - w1;
na = 1;
na = 1 + 0.5*(na - 1);
w1a = 2 / (na + 1);
w2a = 1 - w1a;
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars = IndicatorCounted();
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
limit = Bars - counted_bars;
//---- indicator calculation
for(int i = Bars - 1; i >= 0; i--)
{
Stochastic[i] = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,MA_Method,Price_field,MODE_MAIN,i);
e1 = w1*Stochastic[i] + w2*e1;
e2 = w1*e1 + w2*e2;
e3 = w1*e2 + w2*e3;
e4 = w1*e3 + w2*e4;
e5 = w1*e4 + w2*e5;
e6 = w1*e5 + w2*e6;
Stochastic[i] = c1*e6 + c2*e5 + c3*e4 + c4*e3;
}
for(i = Bars - 1 ; i >= 0; i--)
{
Stochastic_Signal[i] = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,MA_Method,Price_field,MODE_SIGNAL,i);
e1 = w1*Stochastic_Signal[i] + w2*e1;
e2 = w1*e1 + w2*e2;
e3 = w1*e2 + w2*e3;
e4 = w1*e3 + w2*e4;
e5 = w1*e4 + w2*e5;
e6 = w1*e5 + w2*e6;
Stochastic_Signal[i] = c1*e6 + c2*e5 + c3*e4 + c4*e3;
//-------
string message1,message2 ;
message1 = " "+Symbol()+" M"+Period()+" T3sto:";
int b=AlertOnBar;
if ( Volume[0]>1 && alerttag!=Time[0])
{
if ( Stochastic[1+b]<OBlevel && Stochastic[0+b]>OBlevel)
{
message2 =" OBlevel "+OBlevel+" cross UP";
if ( BoxAlert ) Alert (message1,message2);
if ( SoundAlert ) PlaySound(soundfile);
if ( EmailAlert ) SendMail ("From T3sto",message1+message2);
alerttag =Time[0];
}
if ( Stochastic[1+b]>OBlevel && Stochastic[0+b]<OBlevel)
{
message2 =" OBlevel "+OBlevel+" cross DN";
if ( BoxAlert ) Alert (message1,message2);
if ( SoundAlert ) PlaySound(soundfile);
if ( EmailAlert ) SendMail ("From T3sto",message1+message2);
alerttag =Time[0];
}
//
if ( Stochastic[1+b]<OSlevel && Stochastic[0+b]>OSlevel)
{
message2 =" OSlevel "+OSlevel+" cross UP";
if ( BoxAlert ) Alert (message1,message2);
if ( SoundAlert ) PlaySound(soundfile);
if ( EmailAlert ) SendMail ("From T3sto",message1+message2);
alerttag =Time[0];
}
if ( Stochastic[1+b]>OSlevel && Stochastic[0+b]<OSlevel)
{
message2 =" OSlevel "+OSlevel+" cross DN";
if ( BoxAlert ) Alert (message1,message2);
if ( SoundAlert ) PlaySound(soundfile);
if ( EmailAlert ) SendMail ("From T3sto",message1+message2);
alerttag =Time[0];
}
}
}
//----
//----
return(0);
}
//+------------------------------------------------------------------+
Comments