//+------------------------------------------------------------------+ //| CheckiMACD.mq4 | //| Rosh | //| https://www.metaquotes.net/ru/ | //+------------------------------------------------------------------+ #property copyright "Rosh" #property link "https://www.metaquotes.net/ru/" //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- double MyMACD; MyMACD = iMACD(NULL,PERIOD_D1,12,26,9,PRICE_CLOSE,0,1) ; if ( Hour() == 15 && Minute() == 00 ) Alert("MACD_of_Previous_Day = ", DoubleToStr(MyMACD,8) ) ; //---- return(0); } //+------------------------------------------------------------------+
See log:
2007.05.30 22:05:04 2007.05.30 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= -0.00177078
2007.05.30 22:05:04 2007.05.29 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= -0.00162534
2007.05.30 22:05:04 2007.05.18 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= 0.00161915
2007.05.30 22:05:04 2007.05.17 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= 0.00220279
2007.05.30 22:05:04 2007.05.16 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= 0.00274259
2007.05.30 22:05:04 2007.05.15 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= 0.00259749
2007.05.30 22:05:04 2007.05.14 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= 0.00289379
2007.05.30 22:05:04 2007.05.11 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= 0.00340297
2007.05.30 22:05:04 2007.05.10 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= 0.00449210
2007.05.30 22:05:03 2007.05.09 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= 0.00529762
2007.05.30 22:05:03 2007.05.07 15:00 CheckiMACD EURUSD,M1: Alert: MACD_of_Previous_Day
= 0.00645343
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I would like to ask your help.
I have a little problem with the iMACD() indicator. I'm writeing an EA to a 1_minute EURUSD chart. I would like to calculate a value of the MACD(12, 26,9) of the previous day from a 1Day_Period timeframe.
I tried this formula, which doesnt work well:
I run a backtest with the model of 'Control points'. I get this result:
2007.05.30 17:38:00 2007.02.08 15:00 AXORYN_0529_0 EURUSD,M1: Alert: MACD_of_Previous_Day = 0.00000000
2007.05.30 17:38:00 2007.02.08 15:00 AXORYN_0529_0 EURUSD,M1: Alert: MACD_of_Previous_Day = 0.00000000
2007.05.30 17:38:00 2007.02.08 15:00 AXORYN_0529_0 EURUSD,M1: Alert: MACD_of_Previous_Day = 0.00000000
2007.05.30 17:38:00 2007.02.08 15:00 AXORYN_0529_0 EURUSD,M1: Alert: MACD_of_Previous_Day = 0.00000000
2007.05.30 17:38:00 2007.02.08 15:00 AXORYN_0529_0 EURUSD,M1: Alert: MACD_of_Previous_Day = 0.00000000
2007.05.30 17:38:00 2007.02.08 15:00 AXORYN_0529_0 EURUSD,M1: Alert: MACD_of_Previous_Day = 0.00000000
2007.05.30 17:38:00 2007.02.08 15:00 AXORYN_0529_0 EURUSD,M1: Alert: MACD_of_Previous_Day = 0.00000000
2007.05.30 17:38:00 2007.02.08 15:00 AXORYN_0529_0 EURUSD,M1: Alert: MACD_of_Previous_Day = 0.00000000
2007.05.30 17:37:59 AXORYN_0529_0 inputs: Short_Target=11; Short_Max=100; Long__Target=11; Long__Max=100; Lots=1; Spread=0.0002;
2007.05.30 17:37:59 AXORYN_0529_0 EURUSD,M1: loaded successfully
All Values are 0.0000000 ! Why doesnt work my code? Where did I take mistake?
Please, give me advice, help me to correct it.
Thank you in advance.
Relative