wajdyss_ADX_Indicator_V1
Download scriptThis indicator is designed to analyze market trends and provide visual signals and audible alerts based on the Average Directional Index (ADX). By monitoring the strength and direction of price movements, it helps traders identify when a trend is significant enough to act upon.
Core Trading Logic
The script operates by analyzing three main components of the ADX:
- Trend Strength: It monitors the "Main" ADX line. The tool looks for instances where this value exceeds a specific threshold (a user-defined level), ensuring that the market is actually moving with enough momentum rather than just drifting sideways.
- Directional Analysis: It compares two specific sub-indicators: the Positive Directional Index (+DI) and the Negative Directional Index (-DI).
- When the +DI is higher than the -DI, it indicates bullish pressure (potential upward movement).
- When the -DI is higher than the +DI, it indicates bearish pressure (potential downward movement).
- Crossover Identification: The indicator looks for specific "crosses" where the directional indicators switch positions while the overall trend strength remains high.
Visual and Alert Systems
The script provides several layers of feedback to the user:
- Chart Signals: It places visual markers (arrows) on the chart to highlight where a bullish or bearish condition has been met.
- Audible & Pop-up Alerts: The tool is equipped with an alert system. When a trend shift occurs, it triggers a sound file and a text notification on your screen. These alerts specifically advise whether to look for "Buy" or "Sell" opportunities based on the most recent trend change.
- On-Screen Information: It displays dynamic text on your chart area, including the name of the indicator, contact information, and status labels.
Security and Access Control
The script includes a built-in expiration mechanism. It checks the current date against a hardcoded limit; if the current date passes the set deadline, the indicator will display an "expired" message on your chart and cease to function until it is updated by the author.
Customization Options
Users can adjust several parameters to tailor the logic to their specific trading style:
- ADX Period: Changes how much historical data is used for calculations.
- Apply To: Allows you to choose which price data (Close, Open, High, Low, etc.) the indicator should use as its primary source.
- Level: Sets the minimum strength required for the ADX to trigger a signal.
- Pips: Determines how far away from the candle's high or low the visual arrows are placed.
//+------------------------------------------------------------------+
//| wajdyss_ADX_indicator |
//| Copyright 2009 WAJDYSS |
//| wajdyss@yahoo.com |
//+------------------------------------------------------------------+
// ADX
#property copyright "Copyright 2008 Wajdyss"
#property link "wajdyss@yahoo.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 2
extern int ADX_Period=14;
extern string Note_Apply_to = "0=Close, 1=Open, 2=High, 3=Low, 4=Median (High+low)/2, 5=Typical (High+low+close)/3,6=Weighted close (High+low+close+close)/4";
extern int Apply_to =0;
extern string Note2="ÞæÉ ÇáÊÑäÏ";
extern int Level=30;
extern string Note3="ÈÚÏ ÇáÇÔÇÑÉ ÈÇáäÞÇØ ";
extern int Pips=20;
extern bool alert = true;
extern string file="alert.wav";
extern int TextSize=14;
extern color TextColor1=White;
extern color TextColor2=Yellow;
extern color TextColor3=Aqua;
extern color TextColor4=Red;
extern color TextColor5=Chartreuse;
string Name="wajdyss ADX indicator";
bool manual=true;
int w=0,ww=0;
double CrossUp[];
double CrossDown[];
int eyear=9999;
int emonth=9;
int eday=9;
bool al1=false;
bool al2=false;
int MA_Result;
int ADX_Buy=1;
int j1,j2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
Comment("");
ObjectDelete("a label");
ObjectDelete("b label");
ObjectDelete("c label");
ObjectDelete("d label");
ObjectDelete("e label");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//a
if(ObjectFind("a label") != 0)
{
ObjectCreate("a label", OBJ_LABEL, 0,0,0);
ObjectSetText("a label","ÈÓã Çááå ÇáÑÍãä ÇáÑÍíã" , TextSize, "Arial", TextColor1);
ObjectSet("a label", OBJPROP_XDISTANCE,350);
ObjectSet("a label", OBJPROP_YDISTANCE,0);
}
//b
if(ObjectFind("b label") != 0)
{
ObjectCreate("b label", OBJ_LABEL, 0,0,0);
ObjectSetText("b label",Name , TextSize, "Arial", TextColor2);
ObjectSet("b label", OBJPROP_XDISTANCE,330);
ObjectSet("b label", OBJPROP_YDISTANCE,25);
}
// c
if(ObjectFind("c label") != 0)
{
ObjectCreate("c label", OBJ_LABEL, 0,0,0);
ObjectSetText("c label","wajdyss@yahoo.com" , TextSize, "Arial", TextColor3);
ObjectSet("c label", OBJPROP_XDISTANCE,335);
ObjectSet("c label", OBJPROP_YDISTANCE,50);
}
//if (Symbol()!="EURJPY" || Period()!=1440) return(0);
if ((Year()>eyear) || (Year()==eyear && Month()>emonth) || (Year()==eyear && Month()==emonth && Day()>eday))
{
//d
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator has expired , contact us by E-mail" ,TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,250);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
return(0);
}
else
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator well expire after ( " + eday+"-"+emonth+"-"+eyear+" )",TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,265);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
int same , notsame, samef, notsamef, samer, notsamer, samecandle, notsamecandle ;
double GSignalUP=0 , SignalUP=0 , GSignalDOWN=0, SignalDOWN=0 , AllSignal=0 , BSignalUP=0
, BSignalDOWN=0 ,a=High[0]+50*Point ;
double samep,notsamep,all,GSignals,GSignalsP, GSignalUPP,GSignalDOWNP,fastMAnow,fastMAprevious,slowMAnow,slowMAprevious;
double FMA1,FMA2,SMA1,SMA2;
string sameforecast,notsameforecast, wajdyssforecast , status ;
int up=0;
for (int i=Bars;i>=1;i--)
{
if (iADX(Symbol(),0,ADX_Period,Apply_to,MODE_PLUSDI,i)>iADX(Symbol(),0,ADX_Period,Apply_to,MODE_MINUSDI,i) && ADX_Buy==-1 && iADX(Symbol(),0,ADX_Period,Apply_to,MODE_MAIN,i)>Level)
// && iADX(Symbol(),0,ADX_Period,Apply_to,MODE_PLUSDI,i+1)<iADX(Symbol(),0,ADX_Period,Apply_to,MODE_MINUSDI,i+1)
{
if ((Year()>eyear) || (Year()==eyear && Month()>emonth) || (Year()==eyear && Month()==emonth && Day()>eday))
{
//d
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator has expired , contact us by E-mail" ,TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,250);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
return(0);
}
else
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator well expire after ( " + eday+"-"+emonth+"-"+eyear+" )",TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,265);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
CrossUp[i] = Low[i]-Pips*Point;
AllSignal++;
SignalUP++;
up=1;
j1=i;
ADX_Buy=1;
if (iClose(Symbol(),NULL,i-1)>iOpen(Symbol(),NULL,i-1))
GSignalUP++;
else BSignalUP++;
}
//if ((iRSI(Symbol(),PERIOD_D1,RSI,PRICE_CLOSE,i)<50 && iRSI(Symbol(),PERIOD_D1,RSI,PRICE_CLOSE,i)>70) || iRSI(Symbol(),PERIOD_D1,RSI,PRICE_CLOSE,i)>30)
else if (iADX(Symbol(),0,ADX_Period,Apply_to,MODE_PLUSDI,i)<iADX(Symbol(),0,ADX_Period,Apply_to,MODE_MINUSDI,i) && ADX_Buy==1&& iADX(Symbol(),0,ADX_Period,Apply_to,MODE_MAIN,i)>Level)
//&& iADX(Symbol(),0,ADX_Period,Apply_to,MODE_PLUSDI,i+1)>iADX(Symbol(),0,ADX_Period,Apply_to,MODE_MINUSDI,i+1)
{
if ((Year()>eyear) || (Year()==eyear && Month()>emonth) || (Year()==eyear && Month()==emonth && Day()>eday))
{
//d
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator has expired , contact us by E-mail" ,TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,250);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
return(0);
}
else
if(ObjectFind("d label") != 0)
{
ObjectCreate("d label", OBJ_LABEL, 0,0,0);
ObjectSetText("d label","the indicator well expire after ( " + eday+"-"+emonth+"-"+eyear+" )",TextSize, "Arial", TextColor4);
ObjectSet("d label", OBJPROP_XDISTANCE,265);
ObjectSet("d label", OBJPROP_YDISTANCE,75);
}
CrossDown[i] = High[i]+Pips*Point;
AllSignal++;
SignalDOWN++;
up=-1;
j2=i;
ADX_Buy=-1;
if (iClose(Symbol(),NULL,i-1)<iOpen(Symbol(),NULL,i-1))
GSignalDOWN++;
else BSignalDOWN++;
}
}
GSignals=GSignalUP+GSignalDOWN;
GSignalsP=GSignals/AllSignal;
GSignalUPP=(GSignalUP/SignalUP);
GSignalDOWNP=(GSignalDOWN/SignalDOWN);
//a
int www=GSignalsP*100 ;
//e
if (up==1 && alert==true) {al1=false; if (al2==false) { Alert ("Symbol ",Symbol()," Time Frame ",Period()," Close Sell Orders And Buy AT ",Close[j1]); PlaySound(file); al2=true;}}
if (up==-1 && alert==true){al2=false; if (al1==false) { Alert ("Symbol ",Symbol()," Time Frame ",Period()," Close Buy Orders And Sell AT ",Close[j2]); PlaySound(file); al1=true;}}
return(0);
}
Comments