Comparing double for equality is troublesome.
Change your logic or use NormalizeDouble to eliminate unnecessary decimal places
hey phy,
thank u very much, it is working with NormalizeDouble.
regards
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi @ all,
i have some trouble with the icustom function.
i created an indicator that prints arrows for buy and sell and i wrote an ea to trade this indicator using icostum function.
the indicator looks like this:
#property indicator_chart_window#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- buffers
extern int N = 15;
extern int N1 = 50;
extern int sth = 80;
extern int stl = 20;
extern int rsh = 70;
extern int rsl = 30;
extern int cch = 200;
extern int ccl = -200;
double signal1[];
double signal2[];
the icustom in the ea looks this way:
double Buy1 = iCustom(NULL, 0, "indicat", 15, 50, 80, 20, 70, 30, 200, -200, 1,1);
double Buy2 = iCustom(NULL, 0, "indicat", 15, 50, 80, 20, 70, 30, 200, -200, 0,1);
double Buy3 = iClose(NULL,0,1);
for buy and sell i made the following definition:
if ((Buy1 == Buy3)) Order = SIGNAL_BUY;
if ((Buy2 == Buy3)) Order = SIGNAL_SELL;
the ea is trading, but not the way i´d like to have it. See picture below.
can u pls help me.
thanks