drawdown in mq4 language

 

Please coding of EA i have done keeps opening same position as the one closed before it instead of waiting for the next opposite signal.


i want order history control that will select the last closed order that has same ordertype andsymbol with that of which is to be processed by the EA for making trading desision

while AccountBalance()>0

{

if (IsTradeAllowed())

{

for (int i=0;i<OrdersHistoryTotal; i++)

{ OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);

if (OrderType==OP_SELL && OrderSymbol()==Symbol())

{

OrderSend(------OP_BUY------------)



Please House Is this code capable of stopping same type and same symbol order from following each other. Because in my code, when one order open and close after reaching TakeProfitLevel it will open another same type order in the same direction even if market is about to go otherwise.

I need Help Urgently