I will attach the code and appreciate for your advices.
This is just for test. I just want to check to see if the EA receive the indicator signal correctly and open orders!
Can anyone know what the problems?
I think (in this case) is much better not to use iCustom() because the indicator logic is very simple. In this case is better to use the logic in your EA (see code bellow). BTW pay attention that the original indicator code has a bug in my opinion because it is asymmetric (a different rule for UP and DOWN).
//+------------------------------------------------------------------+//| indicator.mq4 icustom EA//+------------------------------------------------------------------+externdouble lots=0.01;
int cbars=0;
externint magic=8338;
int start() {
bool UP = High[0]>High[1]&& Low[0]>Low[1]&& (High[0]-Low[0])>(High[1]-Low[1])&& (High[0]-Close[0])>(High[1]-Close[1]);
// This line is in the original code but it is asymmetric.//bool DOWN = High[0]<High[1]&& Low[0]< Low[1]&& (High[0]-Low[0])>(High[1]-Low[1])&& (Low[0]-Close[0])>(Low[1]-Close[1]);// I think it should be like this line.bool DOWN = High[0]<High[1]&& Low[0]< Low[1]&& (High[0]-Low[0])>(High[1]-Low[1])&& (Close[0]-Low[0])>(Close[1]-Low[1]);
if( cbars!=Bars && UP )
{
RefreshRates();
OrderSend(Symbol(),OP_BUY,lots,Ask,3,0,0,"buy",magic,0,Blue);
}
if( cbars!=Bars && DOWN )
{
RefreshRates();
OrderSend(Symbol(),OP_SELL,lots,Bid,3,0,0,"sell",magic,0,Magenta);
}
cbars=Bars;
return(0);
}
I think (in this case) is much better not to use iCustom() because the indicator logic is very simple. In this case is better to use the logic in your EA (see code bellow). BTW pay attention that the original indicator code has a bug in my opinion because it is asymmetric (a different rule for UP and DOWN).
Petr, Thank you for taking time for me.
It is a good idea to copy main code to EA and I have just compile your code and run EA.
However it did not work...
You have skip the followings;
if (Bars <= 100) return(0);
int ExtCountedBars = IndicatorCounted();
if (ExtCountedBars < 0) return(-1);
if (ExtCountedBars > 0) ExtCountedBars--;
for (int i=Bars-ExtCountedBars-1; i>=0; i--)
I wonder if it is a reason for not working? Maybe no? Another reason?
I think (in this case) is much better not to use iCustom() because the indicator logic is very simple. In this case is better to use the logic in your EA (see code bellow). BTW pay attention that the original indicator code has a bug in my opinion because it is asymmetric (a different rule for UP and DOWN).
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.
Unada san
Thank you.What do you mean "It return 0.0" ?
You mean if BUY signal, it return 0.0?
Is this what you mention?
Yes, that's right.
"EMPTY_VALUE" is not 0.0.
I will attach the code and appreciate for your advices.
This is just for test. I just want to check to see if the EA receive the indicator signal correctly and open orders!
Can anyone know what the problems?
I think (in this case) is much better not to use iCustom() because the indicator logic is very simple. In this case is better to use the logic in your EA (see code bellow). BTW pay attention that the original indicator code has a bug in my opinion because it is asymmetric (a different rule for UP and DOWN).
I think (in this case) is much better not to use iCustom() because the indicator logic is very simple. In this case is better to use the logic in your EA (see code bellow). BTW pay attention that the original indicator code has a bug in my opinion because it is asymmetric (a different rule for UP and DOWN).
Petr, Thank you for taking time for me.
It is a good idea to copy main code to EA and I have just compile your code and run EA.
However it did not work...
You have skip the followings;
I wonder if it is a reason for not working? Maybe no? Another reason?
I have just added to check UP/DOWN signal.
And the result is as follows. It has no output..
I think (in this case) is much better not to use iCustom() because the indicator logic is very simple. In this case is better to use the logic in your EA (see code bellow). BTW pay attention that the original indicator code has a bug in my opinion because it is asymmetric (a different rule for UP and DOWN).
Petr san
I have tried to modify and finally get signals!
I made a success in the following;
I don't know if this logic is correct but I could made it!