how to get the positons of macd (a, b,c) ? please help me,thanks ! i have write some codes of that,but it is wrong when i test,i don't know why ?can you help me ?
#include <stdlib.mqh>
#include <WinUser32.mqh> #property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
int macd[];
double buffer1[];
double buffer2[];
double MacdCurrent,SignalCurrent,MacdPrevious,SignalPrevious;
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(0,233);
SetIndexBuffer(0,buffer1);
int j=0;
int i=0;
MacdCurrent=0.0;
SignalCurrent=0.0;
MacdPrevious=0.0;
SignalPrevious=0.0;
if (j<3)
{
MacdCurrent=iMACD(NULL,0,8,21,5,PRICE_CLOSE,MODE_MAIN,i);
SignalCurrent=iMACD(NULL,0,8,21,5,PRICE_CLOSE,MODE_SIGNAL,i);
MacdPrevious=iMACD(NULL,0,8,21,5,PRICE_CLOSE,MODE_MAIN,i+1);
SignalPrevious=iMACD(NULL,0,8,21,5,PRICE_CLOSE,MODE_SIGNAL,i+1);
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
how to get the positons of macd (a, b,c) ? please help me,thanks ! i have write some codes of that,but it is wrong when i test,i don't know why ?can you help me ?
#include <stdlib.mqh>
#include <WinUser32.mqh>
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
int macd[];
double buffer1[];
double buffer2[];
double MacdCurrent,SignalCurrent,MacdPrevious,SignalPrevious;
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(0,233);
SetIndexBuffer(0,buffer1);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(1,234);
SetIndexBuffer(1,buffer2);
return(0);
}
int start()
{
int j=0;
int i=0;
MacdCurrent=0.0;
SignalCurrent=0.0;
MacdPrevious=0.0;
SignalPrevious=0.0;
if (j<3)
{
MacdCurrent=iMACD(NULL,0,8,21,5,PRICE_CLOSE,MODE_MAIN,i);
SignalCurrent=iMACD(NULL,0,8,21,5,PRICE_CLOSE,MODE_SIGNAL,i);
MacdPrevious=iMACD(NULL,0,8,21,5,PRICE_CLOSE,MODE_MAIN,i+1);
SignalPrevious=iMACD(NULL,0,8,21,5,PRICE_CLOSE,MODE_SIGNAL,i+1);
if((MacdCurrent > SignalCurrent &&MacdPrevious<SignalPrevious)
||(MacdCurrent < SignalCurrent &&MacdPrevious>SignalPrevious))
{
macd[j]=i;
j=j+1;
}
i++;
}
Comment(macd[0]," : ",macd[2]," : ",macd[3]);
return (0);
}