Hello fellow traders,
I have this little problem developing an Expert Advisor from a Custom indicator I created, I've tried the "iCustom" function but my indicator always returns the same value.
It returns something like 21474..., like that
I want the EA to be able to recognise when the sell and buy arrow signals are generated and it should perform the corresponding trade action (i.e. buy when the indicator says up and sell when it says down)
Here is the code of my indicator I would so much appreciate it if someone can come up with a solution ASAP.
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.
I have this little problem developing an Expert Advisor from a Custom indicator I created, I've tried the "iCustom" function but my indicator always returns the same value.
It returns something like 21474..., like that
I want the EA to be able to recognise when the sell and buy arrow signals are generated and it should perform the corresponding trade action (i.e. buy when the indicator says up and sell when it says down)
Here is the code of my indicator I would so much appreciate it if someone can come up with a solution ASAP.
####################################################################
--------------------------------------------------------------------
//+------------------------------------------------------------------+
//| Zeus.mq4 |
//| Copyright © 2008, Sola Ajayi, Nerdymonk |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Sola Ajayi, Nerdymonk"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_width1 2
#property indicator_color2 Lime
#property indicator_width2 2
extern int SignalGap = 4;
//indicator buffers
int dist=24;
double b1[];
double b2[];
bool test= false;
bool test2 = false;
int init() {
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(1,233);
SetIndexArrow(0,234);
SetIndexBuffer(0,b1);
SetIndexBuffer(1,b2);
//---- name for DataWindow
SetIndexLabel(0,"Zeus Says Down");
SetIndexLabel(1,"Zeus Says Up");
//---- initialization done
return(0);
}
int start() {
int counted_bars=IndicatorCounted();
int nCountedBars=IndicatorCounted();
int i,limit,hhb,llb,l;
if(nCountedBars<0 || Bars<5) return(-1);
l=Bars-nCountedBars-1;
if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit=Bars-1;
if(counted_bars>=1) limit=Bars-counted_bars-1;
if (limit<0) limit=0;
//Print ("Limit =", limit);
while(l>=0)
{
if(High[l+3]>High[l+4] && High[l+3]>High[l+5] && High[l+3]>High[l+2] && High[l+3]>High[l+1])
{
test = true;
}
if(Low[l+3]<Low[l+4] && Low[l+3]<Low[l+5] && Low[l+3]<Low[l+2] && Low[l+3]<Low[l+1])
{
test2 = true;
}
l--;
}
for (i=limit;i>=0;i--) {
hhb = iHighest(NULL,0,MODE_HIGH,dist,i-dist/2);
llb = iLowest(NULL,0,MODE_LOW,dist,i-dist/2);
if (i==hhb && test == true)
//sell arrow
b1[i]=High[hhb]+SignalGap*Point;
if (i==llb && test2 == true)
//buy arrow
b2[i]=Low[llb]-SignalGap*Point;
}
//----
return(0);
}
###########################################################################
---------------------------------------------------------------------------
Thanks in advance.