Expert advisors to open new positions automatically close out position

 
Sometimes,The following code Expert advisors  to open new positions automatically After close out  position,We look at what is the problem?
//+------------------------------------------------------------------+
//|                                                            1.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"

#include <Trade\Trade.mqh>

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---   
       
                    CTrade trade;
                    trade.PositionClose(_Symbol,3);            
                          
  }
//+------------------------------------------------------------------+
//| Trade function                                                   |
//+------------------------------------------------------------------+
void OnTrade()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Tester function                                                  |
//+------------------------------------------------------------------+
double OnTester()
  {
//---
   double ret=0.0;
//---

//---
   return(ret);
  }
//+------------------------------------------------------------------+

 
suoxinyang:
Sometimes,The following code Expert advisors  to open new positions automatically After close out  position,We look at what is the problem?
How do I replicate this behaviour ?
 
suoxinyang:
Sometimes,The following code Expert advisors  to open new positions automatically After close out  position,We look at what is the problem?

Problem in Figure

 

 

Do you find? 

 
RaptorUK:
How do I replicate this behaviour ?
The same time close the positions and then open a new position, is not the problem of the code?
 
suoxinyang:
The same time close the positions and then open a new position, is not the problem of the code?
We can't help you if you don't show the code that open position.
 
suoxinyang:
The same time close the positions and then open a new position, is not the problem of the code?
Not if there is something else that is opening the position . . . no.  Tell me what to do to replicate your issue,  then when I have replicated it I can investigate it.
 
angevoyageur:
We can't help you if you don't show the code that open position.
Thank you very much, this problem has been solved, the opening conditions.
 
RaptorUK:
Not if there is something else that is opening the position . . . no.  Tell me what to do to replicate your issue,  then when I have replicated it I can investigate it.
Thank you very much, this problem has been solved, the opening conditions.