//+------------------------------------------------------------------+ //| Trends.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" //---- ADX int ADX_period = 14; //---- FI int FI_period = 14; //---- RSI int RSI_period = 14; #property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); //---- Comment("\n NN \n ------------------------------------------------" +"\n EUR/USD Trend Analysis" +"\n ------------------------------------------------" +"\n 1st Indicator:" +"\n 2nd Indicator:" +"\n 3rd Indicator:" +"\n ------------------------------------------------" +"\n Analysis Result:" +"\n \n ------------------------------------------------" +"\n GBP/USD Trend Analysis" +"\n ------------------------------------------------" +"\n 1st Indicator:" +"\n 2nd Indicator:" +"\n 3rd Indicator:" +"\n ------------------------------------------------" +"\n Analysis Result:" +"\n \n ------------------------------------------------" +"\n USD/CHF Trend Analysis" +"\n ------------------------------------------------" +"\n 1st Indicator:" +"\n 2nd Indicator:" +"\n 3rd Indicator:" +"\n ------------------------------------------------" +"\n Analysis Result:" +"\n \n ------------------------------------------------" +"\n USD/CAD Trend Analysis" +"\n ------------------------------------------------" +"\n 1st Indicator:" +"\n 2nd Indicator:" +"\n 3rd Indicator:" +"\n ------------------------------------------------" +"\n Analysis Result:" +"\n \n ------------------------------------------------"); //---- Trend Analysis EURUSD //---- ADX string ADX_Trend = ""; color colt1; double ADXP=iADX("EURUSD",0,ADX_period,PRICE_CLOSE,MODE_PLUSDI,0); double ADXM=iADX("EURUSD",0,ADX_period,PRICE_CLOSE,MODE_MINUSDI,0); if ((ADXP > ADXM)) { ADX_Trend = "UP"; colt1 = LimeGreen; } if ((ADXP < ADXM)) { ADX_Trend = "DOWN"; colt1 = Red; } ObjectCreate("ADX", OBJ_LABEL, 0, 0, 0); ObjectSetText("ADX",ADX_Trend,8, "Arial", colt1); ObjectSet("ADX", OBJPROP_CORNER, 0); ObjectSet("ADX", OBJPROP_XDISTANCE, 80); ObjectSet("ADX", OBJPROP_YDISTANCE, 72); //---- FI string FI_Trend =""; color colt2; double FI=iForce("EURUSD",0,FI_period,1,PRICE_CLOSE,0); if((FI > 0)) { FI_Trend ="UP"; colt2 = LimeGreen; } if((FI < 0)) { FI_Trend ="DOWN"; colt2 = Red; } ObjectCreate("FI", OBJ_LABEL, 0, 0, 0); ObjectSetText("FI",FI_Trend,8, "Arial", colt2); ObjectSet("FI", OBJPROP_CORNER, 0); ObjectSet("FI", OBJPROP_XDISTANCE, 80); ObjectSet("FI", OBJPROP_YDISTANCE, 84); //---- RSI string RSI_Trend =""; color colt3; double RSI=iRSI("EURUSD",0,RSI_period,PRICE_CLOSE,0); if((RSI > 50)) { RSI_Trend ="UP"; colt3 = LimeGreen; } if((RSI < 50)) { RSI_Trend ="DOWN"; colt3 = Red; } ObjectCreate("RSI", OBJ_LABEL, 0, 0, 0); ObjectSetText("RSI",RSI_Trend,8, "Arial", colt3); ObjectSet("RSI", OBJPROP_CORNER, 0); ObjectSet("RSI", OBJPROP_XDISTANCE, 80); ObjectSet("RSI", OBJPROP_YDISTANCE, 96); string Analysis ="", Strength ="", Trend=""; color cola1, cola2, cola3; if(ADX_Trend=="UP"&&FI_Trend=="UP"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Strong]"; cola2=LimeGreen; Trend="BULLISH"; cola3=LimeGreen;} if(ADX_Trend=="UP"&&FI_Trend=="UP"&&RSI_Trend=="DOWN") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="UP"&&FI_Trend=="DOWN"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="UP"&&FI_Trend=="DOWN"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="DOWN"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Strong]"; cola2=Red; Trend="BEARISH"; cola3=Red;} if(ADX_Trend=="DOWN"&&FI_Trend=="DOWN"&&RSI_Trend=="UP") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="UP"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="UP"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} ObjectCreate("Analysis", OBJ_LABEL, 0, 0, 0); ObjectSetText("Analysis",Analysis,8, "Arial", cola1); ObjectSet("Analysis", OBJPROP_CORNER, 0); ObjectSet("Analysis", OBJPROP_XDISTANCE, 80); ObjectSet("Analysis", OBJPROP_YDISTANCE, 120); ObjectCreate("Strength", OBJ_LABEL, 0, 0, 0); ObjectSetText("Strength",Strength,8, "Arial", cola2); ObjectSet("Strength", OBJPROP_CORNER, 0); ObjectSet("Strength", OBJPROP_XDISTANCE, 113); ObjectSet("Strength", OBJPROP_YDISTANCE, 120); ObjectCreate("Trend", OBJ_LABEL, 0, 0, 0); ObjectSetText("Trend",Trend,8, "Arial", cola3); ObjectSet("Trend", OBJPROP_CORNER, 0); ObjectSet("Trend", OBJPROP_XDISTANCE, 80); ObjectSet("Trend", OBJPROP_YDISTANCE, 132); //---- Trend Analysis GBPUSD //---- ADX ADX_Trend = ""; ADXP=iADX("GBPUSD",0,ADX_period,PRICE_CLOSE,MODE_PLUSDI,0); ADXM=iADX("GBPUSD",0,ADX_period,PRICE_CLOSE,MODE_MINUSDI,0); if ((ADXP > ADXM)) { ADX_Trend = "UP"; colt1 = LimeGreen; } if ((ADXP < ADXM)) { ADX_Trend = "DOWN"; colt1 = Red; } ObjectCreate("ADX_GBP", OBJ_LABEL, 0, 0, 0); ObjectSetText("ADX_GBP",ADX_Trend,8, "Arial", colt1); ObjectSet("ADX_GBP", OBJPROP_CORNER, 0); ObjectSet("ADX_GBP", OBJPROP_XDISTANCE, 80); ObjectSet("ADX_GBP", OBJPROP_YDISTANCE, 180); //---- FI FI_Trend =""; FI=iForce("GBPUSD",0,FI_period,1,PRICE_CLOSE,0); if((FI > 0)) { FI_Trend ="UP"; colt2 = LimeGreen; } if((FI < 0)) { FI_Trend ="DOWN"; colt2 = Red; } ObjectCreate("FI_GBP", OBJ_LABEL, 0, 0, 0); ObjectSetText("FI_GBP",FI_Trend,8, "Arial", colt2); ObjectSet("FI_GBP", OBJPROP_CORNER, 0); ObjectSet("FI_GBP", OBJPROP_XDISTANCE, 80); ObjectSet("FI_GBP", OBJPROP_YDISTANCE, 192); //---- RSI RSI_Trend =""; RSI=iRSI("GBPUSD",0,RSI_period,PRICE_CLOSE,0); if((RSI > 50)) { RSI_Trend ="UP"; colt3 = LimeGreen; } if((RSI < 50)) { RSI_Trend ="DOWN"; colt3 = Red; } ObjectCreate("RSI_GBP", OBJ_LABEL, 0, 0, 0); ObjectSetText("RSI_GBP",RSI_Trend,8, "Arial", colt3); ObjectSet("RSI_GBP", OBJPROP_CORNER, 0); ObjectSet("RSI_GBP", OBJPROP_XDISTANCE, 80); ObjectSet("RSI_GBP", OBJPROP_YDISTANCE, 204); Analysis =""; Strength =""; Trend=""; if(ADX_Trend=="UP"&&FI_Trend=="UP"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Strong]"; cola2=LimeGreen; Trend="BULLISH"; cola3=LimeGreen;} if(ADX_Trend=="UP"&&FI_Trend=="UP"&&RSI_Trend=="DOWN") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="UP"&&FI_Trend=="DOWN"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="UP"&&FI_Trend=="DOWN"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="DOWN"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Strong]"; cola2=Red; Trend="BEARISH"; cola3=Red;} if(ADX_Trend=="DOWN"&&FI_Trend=="DOWN"&&RSI_Trend=="UP") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="UP"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="UP"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} ObjectCreate("Analysis_GBP", OBJ_LABEL, 0, 0, 0); ObjectSetText("Analysis_GBP",Analysis,8, "Arial", cola1); ObjectSet("Analysis_GBP", OBJPROP_CORNER, 0); ObjectSet("Analysis_GBP", OBJPROP_XDISTANCE, 80); ObjectSet("Analysis_GBP", OBJPROP_YDISTANCE, 228); ObjectCreate("Strength_GBP", OBJ_LABEL, 0, 0, 0); ObjectSetText("Strength_GBP",Strength,8, "Arial", cola2); ObjectSet("Strength_GBP", OBJPROP_CORNER, 0); ObjectSet("Strength_GBP", OBJPROP_XDISTANCE, 113); ObjectSet("Strength_GBP", OBJPROP_YDISTANCE, 228); ObjectCreate("Trend_GBP", OBJ_LABEL, 0, 0, 0); ObjectSetText("Trend_GBP",Trend,8, "Arial", cola3); ObjectSet("Trend_GBP", OBJPROP_CORNER, 0); ObjectSet("Trend_GBP", OBJPROP_XDISTANCE, 80); ObjectSet("Trend_GBP", OBJPROP_YDISTANCE, 240); //---- Trend Analysis USD/CHF //---- ADX ADX_Trend = ""; ADXP=iADX("USDCHF",0,ADX_period,PRICE_CLOSE,MODE_PLUSDI,0); ADXM=iADX("USDCHF",0,ADX_period,PRICE_CLOSE,MODE_MINUSDI,0); if ((ADXP > ADXM)) { ADX_Trend = "UP"; colt1 = LimeGreen; } if ((ADXP < ADXM)) { ADX_Trend = "DOWN"; colt1 = Red; } ObjectCreate("ADX_JPY", OBJ_LABEL, 0, 0, 0); ObjectSetText("ADX_JPY",ADX_Trend,8, "Arial", colt1); ObjectSet("ADX_JPY", OBJPROP_CORNER, 0); ObjectSet("ADX_JPY", OBJPROP_XDISTANCE, 80); ObjectSet("ADX_JPY", OBJPROP_YDISTANCE, 288); //---- FI FI_Trend =""; FI=iForce("USDCHF",0,FI_period,1,PRICE_CLOSE,0); if((FI > 0)) { FI_Trend ="UP"; colt2 = LimeGreen; } if((FI < 0)) { FI_Trend ="DOWN"; colt2 = Red; } ObjectCreate("FI_JPY", OBJ_LABEL, 0, 0, 0); ObjectSetText("FI_JPY",FI_Trend,8, "Arial", colt2); ObjectSet("FI_JPY", OBJPROP_CORNER, 0); ObjectSet("FI_JPY", OBJPROP_XDISTANCE, 80); ObjectSet("FI_JPY", OBJPROP_YDISTANCE, 300); //---- RSI RSI_Trend =""; RSI=iRSI("USDCHF",0,RSI_period,PRICE_CLOSE,0); if((RSI > 50)) { RSI_Trend ="UP"; colt3 = LimeGreen; } if((RSI < 50)) { RSI_Trend ="DOWN"; colt3 = Red; } ObjectCreate("RSI_JPY", OBJ_LABEL, 0, 0, 0); ObjectSetText("RSI_JPY",RSI_Trend,8, "Arial", colt3); ObjectSet("RSI_JPY", OBJPROP_CORNER, 0); ObjectSet("RSI_JPY", OBJPROP_XDISTANCE, 80); ObjectSet("RSI_JPY", OBJPROP_YDISTANCE, 312); Analysis =""; Strength =""; Trend=""; if(ADX_Trend=="UP"&&FI_Trend=="UP"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Strong]"; cola2=LimeGreen; Trend="BULLISH"; cola3=LimeGreen;} if(ADX_Trend=="UP"&&FI_Trend=="UP"&&RSI_Trend=="DOWN") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="UP"&&FI_Trend=="DOWN"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="UP"&&FI_Trend=="DOWN"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="DOWN"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Strong]"; cola2=Red; Trend="BEARISH"; cola3=Red;} if(ADX_Trend=="DOWN"&&FI_Trend=="DOWN"&&RSI_Trend=="UP") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="UP"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="UP"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} ObjectCreate("Analysis_JPY", OBJ_LABEL, 0, 0, 0); ObjectSetText("Analysis_JPY",Analysis,8, "Arial", cola1); ObjectSet("Analysis_JPY", OBJPROP_CORNER, 0); ObjectSet("Analysis_JPY", OBJPROP_XDISTANCE, 80); ObjectSet("Analysis_JPY", OBJPROP_YDISTANCE, 336); ObjectCreate("Strength_JPY", OBJ_LABEL, 0, 0, 0); ObjectSetText("Strength_JPY",Strength,8, "Arial", cola2); ObjectSet("Strength_JPY", OBJPROP_CORNER, 0); ObjectSet("Strength_JPY", OBJPROP_XDISTANCE, 113); ObjectSet("Strength_JPY", OBJPROP_YDISTANCE, 336); ObjectCreate("Trend_JPY", OBJ_LABEL, 0, 0, 0); ObjectSetText("Trend_JPY",Trend,8, "Arial", cola3); ObjectSet("Trend_JPY", OBJPROP_CORNER, 0); ObjectSet("Trend_JPY", OBJPROP_XDISTANCE, 80); ObjectSet("Trend_JPY", OBJPROP_YDISTANCE, 348); //---- Trend Analysis USD/CAD //---- ADX ADX_Trend = ""; ADXP=iADX("USDCAD",0,ADX_period,PRICE_CLOSE,MODE_PLUSDI,0); ADXM=iADX("USDCAD",0,ADX_period,PRICE_CLOSE,MODE_MINUSDI,0); if ((ADXP > ADXM)) { ADX_Trend = "UP"; colt1 = LimeGreen; } if ((ADXP < ADXM)) { ADX_Trend = "DOWN"; colt1 = Red; } ObjectCreate("ADX_CAD", OBJ_LABEL, 0, 0, 0); ObjectSetText("ADX_CAD",ADX_Trend,8, "Arial", colt1); ObjectSet("ADX_CAD", OBJPROP_CORNER, 0); ObjectSet("ADX_CAD", OBJPROP_XDISTANCE, 80); ObjectSet("ADX_CAD", OBJPROP_YDISTANCE, 396); //---- FI FI_Trend =""; FI=iForce("USDCAD",0,FI_period,1,PRICE_CLOSE,0); if((FI > 0)) { FI_Trend ="UP"; colt2 = LimeGreen; } if((FI < 0)) { FI_Trend ="DOWN"; colt2 = Red; } ObjectCreate("FI_CAD", OBJ_LABEL, 0, 0, 0); ObjectSetText("FI_CAD",FI_Trend,8, "Arial", colt2); ObjectSet("FI_CAD", OBJPROP_CORNER, 0); ObjectSet("FI_CAD", OBJPROP_XDISTANCE, 80); ObjectSet("FI_CAD", OBJPROP_YDISTANCE, 408); //---- RSI RSI_Trend =""; RSI=iRSI("USDCAD",0,RSI_period,PRICE_CLOSE,0); if((RSI > 50)) { RSI_Trend ="UP"; colt3 = LimeGreen; } if((RSI < 50)) { RSI_Trend ="DOWN"; colt3 = Red; } ObjectCreate("RSI_CAD", OBJ_LABEL, 0, 0, 0); ObjectSetText("RSI_CAD",RSI_Trend,8, "Arial", colt3); ObjectSet("RSI_CAD", OBJPROP_CORNER, 0); ObjectSet("RSI_CAD", OBJPROP_XDISTANCE, 80); ObjectSet("RSI_CAD", OBJPROP_YDISTANCE, 420); Analysis =""; Strength =""; Trend=""; if(ADX_Trend=="UP"&&FI_Trend=="UP"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Strong]"; cola2=LimeGreen; Trend="BULLISH"; cola3=LimeGreen;} if(ADX_Trend=="UP"&&FI_Trend=="UP"&&RSI_Trend=="DOWN") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="UP"&&FI_Trend=="DOWN"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="UP"&&FI_Trend=="DOWN"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="DOWN"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Strong]"; cola2=Red; Trend="BEARISH"; cola3=Red;} if(ADX_Trend=="DOWN"&&FI_Trend=="DOWN"&&RSI_Trend=="UP") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="UP"&&RSI_Trend=="DOWN") {Analysis="DOWN"; cola1=Red; Strength="[Weak]"; cola2=Tomato; Trend="SIDEWAY"; cola3=Silver;} if(ADX_Trend=="DOWN"&&FI_Trend=="UP"&&RSI_Trend=="UP") {Analysis="UP"; cola1=LimeGreen; Strength="[Weak]"; cola2=Lime; Trend="SIDEWAY"; cola3=Silver;} ObjectCreate("Analysis_CAD", OBJ_LABEL, 0, 0, 0); ObjectSetText("Analysis_CAD",Analysis,8, "Arial", cola1); ObjectSet("Analysis_CAD", OBJPROP_CORNER, 0); ObjectSet("Analysis_CAD", OBJPROP_XDISTANCE, 80); ObjectSet("Analysis_CAD", OBJPROP_YDISTANCE, 444); ObjectCreate("Strength_CAD", OBJ_LABEL, 0, 0, 0); ObjectSetText("Strength_CAD",Strength,8, "Arial", cola2); ObjectSet("Strength_CAD", OBJPROP_CORNER, 0); ObjectSet("Strength_CAD", OBJPROP_XDISTANCE, 113); ObjectSet("Strength_CAD", OBJPROP_YDISTANCE, 444); ObjectCreate("Trend_CAD", OBJ_LABEL, 0, 0, 0); ObjectSetText("Trend_CAD",Trend,8, "Arial", cola3); ObjectSet("Trend_CAD", OBJPROP_CORNER, 0); ObjectSet("Trend_CAD", OBJPROP_XDISTANCE, 80); ObjectSet("Trend_CAD", OBJPROP_YDISTANCE, 456); //---- return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Movement directional index
Force index
Relative strength index
Custom Indicators Used:
Order Management characteristics:
Other Features: