MetaTrader 4 Platform Update build 625: Magazines in MetaTrader Market and New MetaViewer - page 13 1...6789101112131415 New comment Tzvetan Jordanov 2014.03.28 17:34 #121 angevoyageur: Ah I see your problem now. I am using build 628 and you ? I'm with build 625 ... Maybe with build 628 its gonna be ok . [Deleted] 2014.03.29 00:00 #122 angevoyageur: This is not planned. (source : somewhere on Russian forum). ok, not planned means: now is not planned but maybe one day they will do it, or it will be never done, so only mt5 will have the metatester? Syed Naufal Gaddafi 2014.03.29 00:27 #123 didjeridoo: ok, not planned means: now is not planned but maybe one day they will do it, or it will be never done, so only mt5 will have the metatester? It seems that MT5 is the option, right now. Michael 2014.03.29 07:38 #124 angevoyageur: What is the problem with this code ? 2014.03.28 16:50:23.375 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164 2014.03.28 16:50:23.313 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164 2014.03.28 16:50:22.188 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164 2014.03.28 16:50:22.125 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164 2014.03.28 16:50:21.938 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164 I'm only seeing one value getting returned in your output. Where's the other one? Michael 2014.03.29 07:45 #125 This is going to sound stupid, but what is technique in line 3 called? And is it documented? datetime Diff=0; double buffer=0; buffer=(int)Diff; Alain Verleyen 2014.03.29 09:05 #126 nondisclosure: This is going to sound stupid, but what is technique in line 3 called? And is it documented? Explicit type casting. williamwong 2014.03.29 15:08 #127 class try { int a; public: try operator=(try &o) { a=o.a; return this; } }; void OnStart() { try x; try y; y=x; } This code crashes MT4. I was following the example in the help: complex operator+(const complex &r) const { return(Add(this,r)); } William Roeder 2014.03.29 20:26 #128 Complex plus returns a complex (value of Add.) Your try assignment says it returns a try but you return a reference (this.) The code crashes but I think it shouldn't compile. Try: try* operator=(... TradeWithMe 2014.03.29 20:59 #129 Hi dear traders Can anyone help in written this indicatotr (GMACD) based on the requirement of the new metatrader? Thank you in advance //+------------------------------------------------------------------+ //| GMACD_Signals.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" //+------------------------------------------------------------------+ //| Author: Muhammad Hamizi Jaminan (hymns) | //| Original Author: CJA | //| | //| Date: December 14, 2006 | //| Custom Indicator: GMACD_Signals.mq4 | //| Version: 1.0.1 | //| Description: Multi TimeFrame MACD Signal | //| | //| Change Logs | //| Version 1.0.1 | //| - Rewriting Code. Using less variable & ObjectCreate. Reduce CPU | //| Usage. Solve multiple object label show on load. | //| | //| Version G#MACD_Signal #2 | //| - Release by CJA | //+------------------------------------------------------------------+ #property indicator_separate_window //---- extern int FastEMA=8; extern int SlowEMA=17; extern int SignalSMA=9; extern bool Show_MAJOR_TREND=true; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorShortName("GMACD"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- ObjectsDeleteAll(0,OBJ_LABEL); ObjectDelete("Label1"); ObjectDelete("Label2"); ObjectDelete("Label3"); ObjectDelete("DataM1"); ObjectDelete("DataM5"); ObjectDelete("DataM15"); ObjectDelete("DataM30"); ObjectDelete("DataH1"); ObjectDelete("DataH4"); ObjectDelete("DataD1"); ObjectDelete("DataW1"); ObjectDelete("DataMN"); ObjectDelete("Trend1"); ObjectDelete("Trend2"); ObjectDelete("Level1"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); //---- double macd_M1=iMACD(NULL,PERIOD_M1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); double macd_MM1=iMACD(NULL,PERIOD_M1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); double macd_M5=iMACD(NULL,PERIOD_M5,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); double macd_MM5=iMACD(NULL,PERIOD_M5,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); double macd_M15=iMACD(NULL,PERIOD_M15,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); double macd_MM15=iMACD(NULL,PERIOD_M15,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); double macd_M30=iMACD(NULL,PERIOD_M30,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); double macd_MM30=iMACD(NULL,PERIOD_M30,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); double macd_H1=iMACD(NULL,PERIOD_H1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); double macd_HH1=iMACD(NULL,PERIOD_H1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); double macd_H4=iMACD(NULL,PERIOD_H4,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); double macd_HH4=iMACD(NULL,PERIOD_H4,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); //---- if (Show_MAJOR_TREND==true) { double macd_D1=iMACD(NULL,PERIOD_D1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); double macd_DD1=iMACD(NULL,PERIOD_D1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); double macd_W1=iMACD(NULL,PERIOD_W1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); double macd_WW1=iMACD(NULL,PERIOD_W1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); double macd_MN1=iMACD(NULL,PERIOD_MN1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0); double macd_MMN1=iMACD(NULL,PERIOD_MN1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0); } string trend_signal="", trend_main="", trend_level=""; color color_m1, color_m5, color_m15, color_m30, color_h1, color_h4, color_d1, color_w1, color_mn, color_signal, color_main, color_level; // UP Data if ((macd_M5 > macd_MM5) && (macd_M1 > macd_MM1)) { trend_signal="TREND/UP"; color_signal=Lime;} //Down Data if ((macd_M5 < macd_MM5) && (macd_M1 < macd_MM1)) { trend_signal="TREND/DN"; color_signal=Red; } //Consolidation Data if ((macd_M5 < macd_MM5) && (macd_M1 > macd_MM1)) { trend_signal="SIDEWAY"; color_signal=Orange; } if ((macd_M5 > macd_MM5) && (macd_M1 < macd_MM1)) { trend_signal="SIDEWAY"; color_signal=Orange; } if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 > macd_HH1)&& (macd_H4 < macd_HH4)) { trend_level="WEAK"; color_level=Tomato; } if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 < macd_HH1)&& (macd_H4 > macd_HH4)) { trend_level="WEAK"; color_level=Tomato; } if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1) && (macd_H4 < macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; } if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 > macd_HH1) && (macd_H4 > macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; } if ((macd_M5 > macd_MM5) && (macd_M15 > macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1) && (macd_H4 > macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; } if ((macd_M5 < macd_MM5) && (macd_M15 < macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 >macd_HH1) && (macd_H4 < macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; } if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 > macd_HH1)) { trend_main="TREND/UP"; color_main=YellowGreen; } if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 < macd_HH1)) { trend_main="TREND/DN"; color_main=Tomato; } if ((macd_M15 < macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 > macd_HH1)) { trend_main="TREND/DN"; color_main=Tomato; } if ((macd_M15 > macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1)) { trend_main="TREND/UP"; color_main=YellowGreen; } if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1)) { trend_main="TREND/DN"; color_main=Red; } if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 > macd_HH1)) { trend_main="TREND/UP"; color_main=Lime; } if ((macd_M5 < macd_MM5) && (macd_M15 < macd_MM15) && (macd_H1 > macd_HH1) && (macd_H4 > macd_HH4)) { trend_level="WEAK"; color_level=Tomato; } if ((macd_M5 > macd_MM5) && (macd_M15 > macd_MM15) && (macd_H1 < macd_HH1) && (macd_H4 < macd_HH4)) { trend_level="WEAK"; color_level=Tomato; } if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 < macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; } if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 > macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; } if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 > macd_HH4)) { trend_level="STRONG"; color_level=Yellow; } if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 < macd_HH4)) { trend_level="STRONG"; color_level=Yellow; } if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 > macd_HH4)) { trend_main="TREND/UP"; color_main=Lime; } if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 < macd_HH4)) { trend_main="TREND/DN"; color_main=Red; } if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 < macd_HH4)) { trend_main="TREND/UP"; color_main=Lime; } if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 > macd_HH4)) { trend_main="TREND/DN"; color_main=Red; } //MACD Direction if ((macd_M1 > macd_MM1)) { color_m1=Lime; } if ((macd_M1 < macd_MM1)) { color_m1=Red; } if ((macd_M5 > macd_MM5)) { color_m5=Lime; } if ((macd_M5 < macd_MM5)) { color_m5=Red; } if ((macd_M15 > macd_MM15)) { color_m15=Lime; } if ((macd_M15 < macd_MM15)) { color_m15=Red; } if ((macd_M30 > macd_MM30)) { color_m30=Lime; } if ((macd_M30 < macd_MM30)) { color_m30=Red; } if ((macd_H1 > macd_HH1)) { color_h1=Lime; } if ((macd_H1 < macd_HH1)) { color_h1=Red; } if ((macd_H4 > macd_HH4)) { color_h4=Lime; } if ((macd_H4 < macd_HH4)) { color_h4=Red; } if (Show_MAJOR_TREND==true) { if ((macd_D1 > macd_DD1)) { color_d1=Lime; } if ((macd_D1 < macd_DD1)) { color_d1=Red; } if ((macd_W1 > macd_WW1)) { color_w1=Lime; } if ((macd_W1 < macd_WW1)) { color_w1=Red; } if ((macd_MN1 > macd_MMN1)) { color_mn=Lime; } if ((macd_MN1 < macd_MMN1)) { color_mn=Red; } } //Signal Labels ObjectCreate("Label1", OBJ_LABEL, WindowFind("GMACD"), 0, 0); ObjectSetText("Label1","SIGNAL",8, "Arial Bold", Silver); ObjectSet("Label1", OBJPROP_CORNER, 0); ObjectSet("Label1", OBJPROP_XDISTANCE, 105); ObjectSet("Label1", OBJPROP_YDISTANCE, 4); //MACD Direction M1-M5 ObjectCreate("DataM1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//M1 SIGNAL ObjectSetText("DataM1","M1",9, "Arial Bold", color_m1); ObjectSet("DataM1", OBJPROP_CORNER, 0); ObjectSet("DataM1", OBJPROP_XDISTANCE, 150); ObjectSet("DataM1", OBJPROP_YDISTANCE, 4); //---- ObjectCreate("DataM5", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//M5 SIGNAL ObjectSetText("DataM5","M5",9, "Arial Bold", color_m5); ObjectSet("DataM5", OBJPROP_CORNER, 0); ObjectSet("DataM5", OBJPROP_XDISTANCE, 175); ObjectSet("DataM5", OBJPROP_YDISTANCE, 4); //M1 & M5 TREND Data ObjectCreate("Trend1", OBJ_LABEL, WindowFind("GMACD"), 0, 0); ObjectSetText("Trend1",trend_signal,12, "Arial Bold", color_signal); ObjectSet("Trend1", OBJPROP_CORNER, 0); ObjectSet("Trend1", OBJPROP_XDISTANCE, 200); ObjectSet("Trend1", OBJPROP_YDISTANCE, 4); //Main Trend Label ObjectCreate("Label2", OBJ_LABEL, WindowFind("GMACD"), 0, 0); ObjectSetText("Label2","MAIN TREND", 8, "Arial Bold", Silver); ObjectSet("Label2", OBJPROP_CORNER, 0); ObjectSet("Label2", OBJPROP_XDISTANCE, 300); ObjectSet("Label2", OBJPROP_YDISTANCE, 4); //MACD Direction M15-H4 ObjectCreate("DataM15", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//M15 SIGNAL ObjectSetText("DataM15","M15",9, "Arial Bold", color_m15); ObjectSet("DataM15", OBJPROP_CORNER, 0); ObjectSet("DataM15", OBJPROP_XDISTANCE, 370); ObjectSet("DataM15", OBJPROP_YDISTANCE, 4); ObjectCreate("DataM30", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//M30 SIGNAL ObjectSetText("DataM30","M30",9, "Arial Bold", color_m30); ObjectSet("DataM30", OBJPROP_CORNER, 0); ObjectSet("DataM30", OBJPROP_XDISTANCE, 400); ObjectSet("DataM30", OBJPROP_YDISTANCE, 4); ObjectCreate("DataH1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//H1 SIGNAL ObjectSetText("DataH1","H1",9, "Arial Bold", color_h1); ObjectSet("DataH1", OBJPROP_CORNER, 0); ObjectSet("DataH1", OBJPROP_XDISTANCE, 430); ObjectSet("DataH1", OBJPROP_YDISTANCE, 4); ObjectCreate("DataH4", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//H4 SIGNAL ObjectSetText("DataH4","H4",9, "Arial Bold", color_h4); ObjectSet("DataH4", OBJPROP_CORNER, 0); ObjectSet("DataH4", OBJPROP_XDISTANCE, 450); ObjectSet("DataH4", OBJPROP_YDISTANCE, 4); //M15 - H4 TREND Data ObjectCreate("Trend2", OBJ_LABEL, WindowFind("GMACD"), 0, 0); ObjectSetText("Trend2",trend_main,12, "Arial Bold", color_main); ObjectSet("Trend2", OBJPROP_CORNER, 0); ObjectSet("Trend2", OBJPROP_XDISTANCE, 475); ObjectSet("Trend2", OBJPROP_YDISTANCE, 4); //Level Data ObjectCreate("Level1", OBJ_LABEL, WindowFind("GMACD"), 0, 0); ObjectSetText("Level1",trend_level,8, "Arial Bold", color_level); ObjectSet("Level1", OBJPROP_CORNER, 0); ObjectSet("Level1", OBJPROP_XDISTANCE, 565); ObjectSet("Level1", OBJPROP_YDISTANCE, 4); if (Show_MAJOR_TREND==true) { ObjectCreate("Label3", OBJ_LABEL, WindowFind("GMACD"), 0, 0); ObjectSetText("Label3","MAJOR TREND", 8, "Arial Bold", Silver); ObjectSet("Label3", OBJPROP_CORNER, 0); ObjectSet("Label3", OBJPROP_XDISTANCE, 615); ObjectSet("Label3", OBJPROP_YDISTANCE, 4); //---- ObjectCreate("DataD1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//D1 SIGNAL ObjectSetText("DataD1","D1",9, "Arial Bold", color_d1); ObjectSet("DataD1", OBJPROP_CORNER, 0); ObjectSet("DataD1", OBJPROP_XDISTANCE, 695); ObjectSet("DataD1", OBJPROP_YDISTANCE, 4); //---- ObjectCreate("DataW1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//W1 SIGNAL ObjectSetText("DataW1","W1",9, "Arial Bold", color_w1); ObjectSet("DataW1", OBJPROP_CORNER, 0); ObjectSet("DataW1", OBJPROP_XDISTANCE, 715); ObjectSet("DataW1", OBJPROP_YDISTANCE, 4); //---- ObjectCreate("DataMN", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//MN SIGNAL ObjectSetText("DataMN","MN",9, "Arial Bold", color_mn); ObjectSet("DataMN", OBJPROP_CORNER, 0); ObjectSet("DataMN", OBJPROP_XDISTANCE, 740); ObjectSet("DataMN", OBJPROP_YDISTANCE, 4); } //---- return(0); } //+------------------------------------------------------------------+ need help "sendmail function" Multi Timeframe Indicators [WARNING CLOSED!] Any newbie Alain Verleyen 2014.03.29 23:39 #130 abuaseel: Hi dear traders Can anyone help in written this indicatotr (GMACD) based on the requirement of the new metatrader? Thank you in advance You have to create your own topic for such request, you are off-topic here. Also please use the SRC button when you post code. Thank you. I will remove your post later. 1...6789101112131415 New comment
Ah I see your problem now. I am using build 628 and you ?
I'm with build 625 ...
Maybe with build 628 its gonna be ok .
This is not planned. (source : somewhere on Russian forum).
ok,
not planned means: now is not planned but maybe one day they will do it, or it will be never done, so only mt5 will have the metatester?
ok,
not planned means: now is not planned but maybe one day they will do it, or it will be never done, so only mt5 will have the metatester?
It seems that MT5 is the option, right now.
What is the problem with this code ?
2014.03.28 16:50:23.375 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164
2014.03.28 16:50:23.313 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164
2014.03.28 16:50:22.188 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164
2014.03.28 16:50:22.125 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164
2014.03.28 16:50:21.938 _for_testing_ EURUSD,H1: Alert: Volume[1] - 5164
I'm only seeing one value getting returned in your output. Where's the other one?
This is going to sound stupid, but what is technique in line 3 called? And is it documented?
This is going to sound stupid, but what is technique in line 3 called? And is it documented?
Explicit type casting.
This code crashes MT4. I was following the example in the help:
complex operator+(const complex &r) const { return(Add(this,r)); }
Complex plus returns a complex (value of Add.) Your try assignment says it returns a try but you return a reference (this.) The code crashes but I think it shouldn't compile. Try: try* operator=(...
Hi dear traders
Can anyone help in written this indicatotr (GMACD) based on the requirement of the new metatrader? Thank you in advance
//+------------------------------------------------------------------+
//| GMACD_Signals.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| Author: Muhammad Hamizi Jaminan (hymns) |
//| Original Author: CJA |
//| |
//| Date: December 14, 2006 |
//| Custom Indicator: GMACD_Signals.mq4 |
//| Version: 1.0.1 |
//| Description: Multi TimeFrame MACD Signal |
//| |
//| Change Logs |
//| Version 1.0.1 |
//| - Rewriting Code. Using less variable & ObjectCreate. Reduce CPU |
//| Usage. Solve multiple object label show on load. |
//| |
//| Version G#MACD_Signal #2 |
//| - Release by CJA |
//+------------------------------------------------------------------+
#property indicator_separate_window
//----
extern int FastEMA=8;
extern int SlowEMA=17;
extern int SignalSMA=9;
extern bool Show_MAJOR_TREND=true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorShortName("GMACD");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectsDeleteAll(0,OBJ_LABEL);
ObjectDelete("Label1"); ObjectDelete("Label2"); ObjectDelete("Label3");
ObjectDelete("DataM1"); ObjectDelete("DataM5"); ObjectDelete("DataM15");
ObjectDelete("DataM30"); ObjectDelete("DataH1"); ObjectDelete("DataH4");
ObjectDelete("DataD1"); ObjectDelete("DataW1"); ObjectDelete("DataMN");
ObjectDelete("Trend1"); ObjectDelete("Trend2"); ObjectDelete("Level1");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
double macd_M1=iMACD(NULL,PERIOD_M1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0);
double macd_MM1=iMACD(NULL,PERIOD_M1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
double macd_M5=iMACD(NULL,PERIOD_M5,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0);
double macd_MM5=iMACD(NULL,PERIOD_M5,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
double macd_M15=iMACD(NULL,PERIOD_M15,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0);
double macd_MM15=iMACD(NULL,PERIOD_M15,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
double macd_M30=iMACD(NULL,PERIOD_M30,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0);
double macd_MM30=iMACD(NULL,PERIOD_M30,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
double macd_H1=iMACD(NULL,PERIOD_H1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0);
double macd_HH1=iMACD(NULL,PERIOD_H1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
double macd_H4=iMACD(NULL,PERIOD_H4,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0);
double macd_HH4=iMACD(NULL,PERIOD_H4,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
//----
if (Show_MAJOR_TREND==true)
{
double macd_D1=iMACD(NULL,PERIOD_D1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0);
double macd_DD1=iMACD(NULL,PERIOD_D1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
double macd_W1=iMACD(NULL,PERIOD_W1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0);
double macd_WW1=iMACD(NULL,PERIOD_W1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
double macd_MN1=iMACD(NULL,PERIOD_MN1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,0);
double macd_MMN1=iMACD(NULL,PERIOD_MN1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,0);
}
string trend_signal="", trend_main="", trend_level="";
color color_m1, color_m5, color_m15, color_m30, color_h1, color_h4, color_d1, color_w1, color_mn,
color_signal, color_main, color_level;
// UP Data
if ((macd_M5 > macd_MM5) && (macd_M1 > macd_MM1)) { trend_signal="TREND/UP"; color_signal=Lime;}
//Down Data
if ((macd_M5 < macd_MM5) && (macd_M1 < macd_MM1)) { trend_signal="TREND/DN"; color_signal=Red; }
//Consolidation Data
if ((macd_M5 < macd_MM5) && (macd_M1 > macd_MM1)) { trend_signal="SIDEWAY"; color_signal=Orange; }
if ((macd_M5 > macd_MM5) && (macd_M1 < macd_MM1)) { trend_signal="SIDEWAY"; color_signal=Orange; }
if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 > macd_HH1)&& (macd_H4 < macd_HH4)) { trend_level="WEAK"; color_level=Tomato; }
if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 < macd_HH1)&& (macd_H4 > macd_HH4)) { trend_level="WEAK"; color_level=Tomato; }
if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1) && (macd_H4 < macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; }
if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 > macd_HH1) && (macd_H4 > macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; }
if ((macd_M5 > macd_MM5) && (macd_M15 > macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1) && (macd_H4 > macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; }
if ((macd_M5 < macd_MM5) && (macd_M15 < macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 >macd_HH1) && (macd_H4 < macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; }
if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 > macd_HH1)) { trend_main="TREND/UP"; color_main=YellowGreen; }
if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 < macd_HH1)) { trend_main="TREND/DN"; color_main=Tomato; }
if ((macd_M15 < macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 > macd_HH1)) { trend_main="TREND/DN"; color_main=Tomato; }
if ((macd_M15 > macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1)) { trend_main="TREND/UP"; color_main=YellowGreen; }
if ((macd_M15 < macd_MM15) && (macd_M30 > macd_MM30) && (macd_H1 < macd_HH1)) { trend_main="TREND/DN"; color_main=Red; }
if ((macd_M15 > macd_MM15) && (macd_M30 < macd_MM30) && (macd_H1 > macd_HH1)) { trend_main="TREND/UP"; color_main=Lime; }
if ((macd_M5 < macd_MM5) && (macd_M15 < macd_MM15) && (macd_H1 > macd_HH1) && (macd_H4 > macd_HH4)) { trend_level="WEAK"; color_level=Tomato; }
if ((macd_M5 > macd_MM5) && (macd_M15 > macd_MM15) && (macd_H1 < macd_HH1) && (macd_H4 < macd_HH4)) { trend_level="WEAK"; color_level=Tomato; }
if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 < macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; }
if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 > macd_HH4)) { trend_level="MEDIUM"; color_level=Orange; }
if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 > macd_HH4)) { trend_level="STRONG"; color_level=Yellow; }
if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 < macd_HH4)) { trend_level="STRONG"; color_level=Yellow; }
if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 > macd_HH4)) { trend_main="TREND/UP"; color_main=Lime; }
if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 < macd_HH4)) { trend_main="TREND/DN"; color_main=Red; }
if ((macd_M15 > macd_MM15) && (macd_H1 > macd_HH1) && (macd_M30 > macd_MM30) && (macd_H4 < macd_HH4)) { trend_main="TREND/UP"; color_main=Lime; }
if ((macd_M15 < macd_MM15) && (macd_H1 < macd_HH1) && (macd_M30 < macd_MM30) && (macd_H4 > macd_HH4)) { trend_main="TREND/DN"; color_main=Red; }
//MACD Direction
if ((macd_M1 > macd_MM1)) { color_m1=Lime; }
if ((macd_M1 < macd_MM1)) { color_m1=Red; }
if ((macd_M5 > macd_MM5)) { color_m5=Lime; }
if ((macd_M5 < macd_MM5)) { color_m5=Red; }
if ((macd_M15 > macd_MM15)) { color_m15=Lime; }
if ((macd_M15 < macd_MM15)) { color_m15=Red; }
if ((macd_M30 > macd_MM30)) { color_m30=Lime; }
if ((macd_M30 < macd_MM30)) { color_m30=Red; }
if ((macd_H1 > macd_HH1)) { color_h1=Lime; }
if ((macd_H1 < macd_HH1)) { color_h1=Red; }
if ((macd_H4 > macd_HH4)) { color_h4=Lime; }
if ((macd_H4 < macd_HH4)) { color_h4=Red; }
if (Show_MAJOR_TREND==true)
{
if ((macd_D1 > macd_DD1)) { color_d1=Lime; }
if ((macd_D1 < macd_DD1)) { color_d1=Red; }
if ((macd_W1 > macd_WW1)) { color_w1=Lime; }
if ((macd_W1 < macd_WW1)) { color_w1=Red; }
if ((macd_MN1 > macd_MMN1)) { color_mn=Lime; }
if ((macd_MN1 < macd_MMN1)) { color_mn=Red; }
}
//Signal Labels
ObjectCreate("Label1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);
ObjectSetText("Label1","SIGNAL",8, "Arial Bold", Silver);
ObjectSet("Label1", OBJPROP_CORNER, 0);
ObjectSet("Label1", OBJPROP_XDISTANCE, 105);
ObjectSet("Label1", OBJPROP_YDISTANCE, 4);
//MACD Direction M1-M5
ObjectCreate("DataM1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//M1 SIGNAL
ObjectSetText("DataM1","M1",9, "Arial Bold", color_m1);
ObjectSet("DataM1", OBJPROP_CORNER, 0);
ObjectSet("DataM1", OBJPROP_XDISTANCE, 150);
ObjectSet("DataM1", OBJPROP_YDISTANCE, 4);
//----
ObjectCreate("DataM5", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//M5 SIGNAL
ObjectSetText("DataM5","M5",9, "Arial Bold", color_m5);
ObjectSet("DataM5", OBJPROP_CORNER, 0);
ObjectSet("DataM5", OBJPROP_XDISTANCE, 175);
ObjectSet("DataM5", OBJPROP_YDISTANCE, 4);
//M1 & M5 TREND Data
ObjectCreate("Trend1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);
ObjectSetText("Trend1",trend_signal,12, "Arial Bold", color_signal);
ObjectSet("Trend1", OBJPROP_CORNER, 0);
ObjectSet("Trend1", OBJPROP_XDISTANCE, 200);
ObjectSet("Trend1", OBJPROP_YDISTANCE, 4);
//Main Trend Label
ObjectCreate("Label2", OBJ_LABEL, WindowFind("GMACD"), 0, 0);
ObjectSetText("Label2","MAIN TREND", 8, "Arial Bold", Silver);
ObjectSet("Label2", OBJPROP_CORNER, 0);
ObjectSet("Label2", OBJPROP_XDISTANCE, 300);
ObjectSet("Label2", OBJPROP_YDISTANCE, 4);
//MACD Direction M15-H4
ObjectCreate("DataM15", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//M15 SIGNAL
ObjectSetText("DataM15","M15",9, "Arial Bold", color_m15);
ObjectSet("DataM15", OBJPROP_CORNER, 0);
ObjectSet("DataM15", OBJPROP_XDISTANCE, 370);
ObjectSet("DataM15", OBJPROP_YDISTANCE, 4);
ObjectCreate("DataM30", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//M30 SIGNAL
ObjectSetText("DataM30","M30",9, "Arial Bold", color_m30);
ObjectSet("DataM30", OBJPROP_CORNER, 0);
ObjectSet("DataM30", OBJPROP_XDISTANCE, 400);
ObjectSet("DataM30", OBJPROP_YDISTANCE, 4);
ObjectCreate("DataH1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//H1 SIGNAL
ObjectSetText("DataH1","H1",9, "Arial Bold", color_h1);
ObjectSet("DataH1", OBJPROP_CORNER, 0);
ObjectSet("DataH1", OBJPROP_XDISTANCE, 430);
ObjectSet("DataH1", OBJPROP_YDISTANCE, 4);
ObjectCreate("DataH4", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//H4 SIGNAL
ObjectSetText("DataH4","H4",9, "Arial Bold", color_h4);
ObjectSet("DataH4", OBJPROP_CORNER, 0);
ObjectSet("DataH4", OBJPROP_XDISTANCE, 450);
ObjectSet("DataH4", OBJPROP_YDISTANCE, 4);
//M15 - H4 TREND Data
ObjectCreate("Trend2", OBJ_LABEL, WindowFind("GMACD"), 0, 0);
ObjectSetText("Trend2",trend_main,12, "Arial Bold", color_main);
ObjectSet("Trend2", OBJPROP_CORNER, 0);
ObjectSet("Trend2", OBJPROP_XDISTANCE, 475);
ObjectSet("Trend2", OBJPROP_YDISTANCE, 4);
//Level Data
ObjectCreate("Level1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);
ObjectSetText("Level1",trend_level,8, "Arial Bold", color_level);
ObjectSet("Level1", OBJPROP_CORNER, 0);
ObjectSet("Level1", OBJPROP_XDISTANCE, 565);
ObjectSet("Level1", OBJPROP_YDISTANCE, 4);
if (Show_MAJOR_TREND==true)
{
ObjectCreate("Label3", OBJ_LABEL, WindowFind("GMACD"), 0, 0);
ObjectSetText("Label3","MAJOR TREND", 8, "Arial Bold", Silver);
ObjectSet("Label3", OBJPROP_CORNER, 0);
ObjectSet("Label3", OBJPROP_XDISTANCE, 615);
ObjectSet("Label3", OBJPROP_YDISTANCE, 4);
//----
ObjectCreate("DataD1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//D1 SIGNAL
ObjectSetText("DataD1","D1",9, "Arial Bold", color_d1);
ObjectSet("DataD1", OBJPROP_CORNER, 0);
ObjectSet("DataD1", OBJPROP_XDISTANCE, 695);
ObjectSet("DataD1", OBJPROP_YDISTANCE, 4);
//----
ObjectCreate("DataW1", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//W1 SIGNAL
ObjectSetText("DataW1","W1",9, "Arial Bold", color_w1);
ObjectSet("DataW1", OBJPROP_CORNER, 0);
ObjectSet("DataW1", OBJPROP_XDISTANCE, 715);
ObjectSet("DataW1", OBJPROP_YDISTANCE, 4);
//----
ObjectCreate("DataMN", OBJ_LABEL, WindowFind("GMACD"), 0, 0);//MN SIGNAL
ObjectSetText("DataMN","MN",9, "Arial Bold", color_mn);
ObjectSet("DataMN", OBJPROP_CORNER, 0);
ObjectSet("DataMN", OBJPROP_XDISTANCE, 740);
ObjectSet("DataMN", OBJPROP_YDISTANCE, 4);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Hi dear traders
Can anyone help in written this indicatotr (GMACD) based on the requirement of the new metatrader? Thank you in advance
You have to create your own topic for such request, you are off-topic here.
Also please use the SRC button when you post code. Thank you.
I will remove your post later.