OzFx Signals v1.2
Download scriptThis script is designed as a multi-pair market scanner for the MetaTrader 4 platform. It allows traders to monitor up to 24 different currency pairs simultaneously, providing real-time visual signals directly on the main trading chart.
Core Functionality
The primary purpose of this tool is to filter out market "noise" and identify potential trading opportunities across a broad basket of currencies. Instead of requiring a user to look at 24 different charts individually, the script processes all selected pairs in the background and displays only the active "Long" (buy) or "Short" (sell) signals on a single screen.
How the Logic Works
The script evaluates two distinct types of trading logic simultaneously: Original OzFX Signals and AES Signals. Both systems use a combination of three main technical indicators to confirm a trade:
-
Trend Filtering (Moving Averages): The script uses a Simple Moving Average (SMA) to determine the overall direction of the market. For example, it may only look for "Long" opportunities if the price is currently trading above a specific long-term average, ensuring that traders are moving with the primary trend rather than against it.
-
Momentum & Directional Change (Accelerator Oscillator): The script monitors an "Accelerator Oscillator" (AC) to detect shifts in momentum. It looks for specific "crosses"—points where the momentum switches from negative to positive (or vice versa)—to identify the exact moment a price movement gains strength.
-
Overbought/Oversold Confirmation (Stochastic Oscillator): To prevent entering a trade too late, the script uses a Stochastic Oscillator. This acts as a secondary check to ensure the market isn't already overextended in one direction before taking a position.
Visual Output and User Experience
- Dynamic Dashboard: The script creates a clean, organized layout on your chart. It categorizes signals into different sections (Original OzFX vs. AES) so you can easily distinguish between different trading strategies.
- Real-Time Data: For every signal generated, the script displays the currency pair name and the ATR (Average True Range). The ATR is useful because it tells the trader how volatile the current move is in terms of price distance.
- Time Tracking: The tool includes a "Time Signal" feature. This provides a countdown by telling you exactly how long ago the last signal was generated and how much time remains until the next potential check, helping traders maintain a disciplined schedule.
- Customization: Users can easily input their own list of preferred currency pairs, adjust the trend filter period, and toggle specific filtering rules on or off to match their personal trading style.
//+------------------------------------------------------------------+
//| OzFX Signals v1.1.mq4 |
//| Copyright © 2008 |
//| http://www.ozfx.com.au/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008"
#property link "http://www.ozfx.com.au/"
/*
Updates:
Original indicator by DGC
03/03/08:: Modified by lac_raz. Separate indicator window and signal maximum 20 pairs
03/03/08:: Modified by ydaudw. Add more signal maximum 24 pairs. Integrate with main chart.
03/04/08:: Modified by ydaudw. Add more parameter for filtering Original Method and when
signal was generate.
*/
#property indicator_chart_window
extern int iFiltPeriod = 200;
extern bool SMAFilterOriginal = True;
extern string PairsList="EURUSD,GBPUSD,USDJPY,USDCHF,USDCAD,AUDUSD,NZDUSD,GBPCHF,EURAUD,EURCHF,EURGBP,EURJPY,EURCAD,GBPAUD,GBPCAD,CHFJPY,AUDCAD,AUDJPY,AUDCHF,CADJPY,CADCHF,NZDCHF,NZDCAD,NZDJPY";//- This is where you add the currency pairs you want
extern string SymbolSuffix="";//- If your broker names the currency pairs with a suffix for a mini account (like an "m", for example), enter the suffix here
extern int ATRPeriod=5;
string Pair[24]; //Pairs array
int SymNo;
int iLastRegular;
double dLastAES;
int k;
bool bAlertSounded;
int init()
{
string short_name="OZFXPAIRS";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
iLastRegular = 0;
dLastAES = 0;
bAlertSounded = false;
int i,j,k;
bool AllCur;
string Cur;
for (i=0; i<20; i++) Pair[i]="";
for (i=0, j=0, k=1; i<20 && k>0; )
{
k=StringFind(PairsList,",",j);
if (k==0) Cur=StringSubstr(PairsList,j,0);
else Cur=StringSubstr(PairsList,j,k-j);
// if (AllCur || StringFind(Cur,MainCurrency,0)>-1)
// {
Pair[i]=Cur;
i++;
// }
j=StringFind(PairsList,",",j)+1;
if (j==0) break;
}
SymNo = i;
return(0);
}
int start()
{
string emailtext;
string aesPairs[24] ;
string ozfxRegPairs[24] ;
int i,k,regindex , aesindex;
createTitle();
for(i=0,regindex=0,aesindex=0 ; i<SymNo ; i++) {
string currPair = Pair[i]+SymbolSuffix;
/* OZFX REGULAR CODE */
/*---------------------*/
bool AboveMA = iClose(currPair,0,0) > iMA(currPair, 0, iFiltPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
bool belowMA = iClose(currPair,0,0) < iMA(currPair, 0, iFiltPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
if (SMAFilterOriginal) {
if (iAC(currPair, 0, 0) > 0 && iAC(currPair,0,1) < 0 && AboveMA &&
iAC(currPair, 0, 0) > iAC(currPair, 0, 1) &&
iStochastic(currPair, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0) > 50)
{
ozfxRegPairs[regindex] = Pair[i]+ " ( ATR - " + DoubleToStr(iATR(currPair,0,ATRPeriod,0),5) + " )" + " - Long";
regindex++;
//Print("regular up "+i+ currPair);
}
if (iAC(currPair, 0, 0) < 0 && iAC(currPair,0,1) > 0 && belowMA &&
iAC(currPair, 0, 0) < iAC(currPair, 0, 1) &&
iStochastic(currPair, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0) < 50)
{
//if (iLastRegular != -1) OzFX_Regular[k] = -1;
iLastRegular = -1;
ozfxRegPairs[regindex] = Pair[i] + " ( ATR - " + DoubleToStr(iATR(currPair,0,ATRPeriod,0),5) +" )"+ " - Short" ;
regindex++;
//Print("regular down "+i+currPair);
}
} else {
if (iAC(currPair, 0, 0) > 0 && iAC(currPair,0,1) < 0 &&
iAC(currPair, 0, 0) > iAC(currPair, 0, 1) &&
iStochastic(currPair, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0) > 50)
{
ozfxRegPairs[regindex] = Pair[i]+ " ( ATR - " + DoubleToStr(iATR(currPair,0,ATRPeriod,0),5) + " )" + " - Long";
regindex++;
//Print("regular up "+i+ currPair);
}
if (iAC(currPair, 0, 0) < 0 && iAC(currPair,0,1) > 0 &&
iAC(currPair, 0, 0) < iAC(currPair, 0, 1) &&
iStochastic(currPair, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0) < 50)
{
//if (iLastRegular != -1) OzFX_Regular[k] = -1;
iLastRegular = -1;
ozfxRegPairs[regindex] = Pair[i] + " ( ATR - " + DoubleToStr(iATR(currPair,0,ATRPeriod,0),5) +" )"+ " - Short" ;
regindex++;
//Print("regular down "+i+currPair);
}
}
/* OZFX AES CODE */
/*-----------------*/
// bool AboveMA = iClose(currPair,0,0) > iMA(currPair, 0, iFiltPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
// bool belowMA = iClose(currPair,0,0) < iMA(currPair, 0, iFiltPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
bool ACLongAESAbove0 = iAC(currPair,0,0) > 0 &&
iAC(currPair,0,1) > 0 &&
iAC(currPair,0,2) > 0 &&
iAC(currPair, 0, 0) > iAC(currPair, 0, 1) &&
iAC(currPair,0,1) < iAC(currPair,0,2) ;
bool ACLongAESbelow0 = iAC(currPair,0,0) < 0 && iAC(currPair, 0, 0) > iAC(currPair, 0, 1) &&
iAC(currPair,0,1) < iAC(currPair,0,2) ;
if (
(ACLongAESAbove0 || ACLongAESbelow0) && AboveMA &&
iStochastic(currPair, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0)
> iStochastic(currPair, 0, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0))
{
//Print ("up " + i + currPair);
aesPairs[aesindex] = Pair[i] + " ( ATR - " + DoubleToStr(iATR(currPair,0,ATRPeriod,0),5) + " )" + " - Long" ;
aesindex++;
//Print(currPair+dLastAES);
}
bool ACShortAESAbove0 = iAC(currPair,0,0) > 0 && iAC(currPair, 0, 0) < iAC(currPair, 0, 1) &&
iAC(currPair,0,1) > iAC(currPair,0,2);
bool ACShortAESbelow0 = iAC(currPair,0,0) < 0 &&
iAC(currPair,0,1) < 0 &&
iAC(currPair,0,2) < 0 &&
iAC(currPair, 0, 0) < iAC(currPair, 0, 1) &&
iAC(currPair,0,1) > iAC(currPair,0,2) ;
if (
(ACShortAESAbove0 || ACShortAESbelow0) && belowMA &&
iStochastic(currPair, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0)
< iStochastic(currPair, 0, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0))
{
//Print ("down " +iClose(currPair,0,0) + currPair);
aesPairs[aesindex] = Pair[i]+ " ( ATR - " + DoubleToStr(iATR(currPair,0,ATRPeriod,0),5) + " )"+ " - Short" ;
aesindex++;
//Print(currPair+ dLastAES);
}
}
int count = regindex;//ArraySize(ozfxRegPairs);
for(k = 0 ; k<count ; k++)
{
ObjectCreate("OZFXREG"+k, OBJ_LABEL, 0, 0, 0);
ObjectSetText("OZFXREG"+k,ozfxRegPairs[k] ,8, "Arial", Yellow);
ObjectSet("OZFXREG"+k, OBJPROP_CORNER, 0);
ObjectSet("OZFXREG"+k, OBJPROP_XDISTANCE, 10);
ObjectSet("OZFXREG"+k, OBJPROP_YDISTANCE, 32+k*15);
}
count = aesindex;//ArraySize(aesPairs);
for(k = 0 ; k<count ; k++)
{
ObjectCreate("OZFXAES"+k, OBJ_LABEL, 0, 0, 0);
ObjectSetText("OZFXAES"+k, aesPairs[k] ,8, "Arial", Yellow);
ObjectSet("OZFXAES"+k, OBJPROP_CORNER, 0);
ObjectSet("OZFXAES"+k, OBJPROP_XDISTANCE, 190);
ObjectSet("OZFXAES"+k, OBJPROP_YDISTANCE, 32+k*15);
}
ObjectCreate("OZFXTIMETXT1", OBJ_LABEL, 0, 0, 0);
ObjectSetText("OZFXTIMETXT1", TimeCheck(1),8, "Arial Bold", Yellow);
ObjectSet("OZFXTIMETXT1", OBJPROP_CORNER, 0);
ObjectSet("OZFXTIMETXT1", OBJPROP_XDISTANCE, 370);
ObjectSet("OZFXTIMETXT1", OBJPROP_YDISTANCE, 32);
ObjectCreate("OZFXTIMETXT2", OBJ_LABEL, 0, 0, 0);
ObjectSetText("OZFXTIMETXT2", TimeCheck(2),8, "Arial Bold", Yellow);
ObjectSet("OZFXTIMETXT2", OBJPROP_CORNER, 0);
ObjectSet("OZFXTIMETXT2", OBJPROP_XDISTANCE, 370);
ObjectSet("OZFXTIMETXT2", OBJPROP_YDISTANCE, 47);
return(0);
}
void createTitle()
{
ObjectCreate("OZFXREG", OBJ_LABEL, 0, 0, 0);
ObjectSetText("OZFXREG","Original Ozfx signal",10, "Arial Bold", Green);
ObjectSet("OZFXREG", OBJPROP_CORNER, 0);
ObjectSet("OZFXREG", OBJPROP_XDISTANCE, 10);
ObjectSet("OZFXREG", OBJPROP_YDISTANCE, 15);
ObjectCreate("OZFXAES", OBJ_LABEL, 0, 0, 0);
ObjectSetText("OZFXAES","AES Signal" ,10, "Arial Bold", Green);
ObjectSet("OZFXAES", OBJPROP_CORNER, 0);
ObjectSet("OZFXAES", OBJPROP_XDISTANCE, 190);
ObjectSet("OZFXAES", OBJPROP_YDISTANCE, 15);
ObjectCreate("OZFXTIME", OBJ_LABEL, 0, 0, 0);
ObjectSetText("OZFXTIME","Time Signal" ,10, "Arial Bold", Green);
ObjectSet("OZFXTIME", OBJPROP_CORNER, 0);
ObjectSet("OZFXTIME", OBJPROP_XDISTANCE, 370);
ObjectSet("OZFXTIME", OBJPROP_YDISTANCE, 15);
}
string TimeCheck(int iText)
{
int iHour = Hour();
int iMinute = Minute();
string sSignal;
if (iText == 1) {
sSignal = "Signal was generate "+DoubleToStr(iHour,0)+" hour(s) and "+DoubleToStr(iMinute,0)+" minute(s) ago.";}
else {
sSignal = "Next signal in "+DoubleToStr(23-iHour,0)+" hour(s) and "+DoubleToStr(60-iMinute,0)+" minute(s).";}
return(sSignal);
}
int deinit()
{
//----
ObjectsDeleteAll(0,OBJ_LABEL);
//----
return(0);
}
/*
datetime timestamp) {
int iBarHour = TimeHour(timestamp);
*/
Comments