Download MetaTrader 5

How to stop E.A from placing order during the end of trend

To add comments, please log in or register
Hi All,

I am creating an E.A based on IADX. When +D1 is greater then -D1 then it will buy and vice versa. my problem is when i integrate this E.A on chart it directly place buy or sell order based on these condition no matter where current trend is, like. if the buy trend is nearly to end no matter it will place buy. i want my E.A to place order only when its just the start of the buy or sell signal not when it is near to end this issue only occurs when i interate E.A for the firs time. Can any one help me regarding this please. 

Below is the condition i am using.

double IadxValuePlusdiForBuy= iADX(NULL,0,10,PRICE_HIGH,MODE_PLUSDI,0);
double IadxValueMinusdiForBuy= iADX(NULL,0,10,PRICE_HIGH,MODE_MINUSDI,1);


Many Thanks 
To add comments, please log in or register