Price Data Components
Indicators Used
0
Views
0
Downloads
0
Favorites
OzFx Signals v1.2
//+------------------------------------------------------------------+
//| 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
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---