Download MetaTrader 5

Expert advisors to open new positions automatically close out position

To add comments, please log in or register
suoxinyang
73
suoxinyang  
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);
  }
//+------------------------------------------------------------------+

Simon Gniadkowski
Moderator
18025
Simon Gniadkowski  
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
73
suoxinyang  
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? 

suoxinyang
73
suoxinyang  
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?
Alain Verleyen
Moderator
33339
Alain Verleyen  
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.
Simon Gniadkowski
Moderator
18025
Simon Gniadkowski  
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.
suoxinyang
73
suoxinyang  
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.
suoxinyang
73
suoxinyang  
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.
To add comments, please log in or register