Download MetaTrader 5

sell order and POSITION_TYPE_BUY

To add comments, please log in or register
HongDi s& t development co.,ltd.
1605
hongbin fei 2011.01.21 08:37 

I just sell GBPUSD, try test the code for modify stoploss,

bool Robot::ModifyPosition()
  {

  
   bool res=false;

   if(m_position.Select(Symbol()))
        {
         if(m_position.Type()==POSITION_TYPE_BUY)
           {
             //the robot run this code for a sell order

 what is the wrong? is m_position error?

HongDi s& t development co.,ltd.
1605
hongbin fei 2011.01.24 07:14  
codeidea:

I just sell GBPUSD, try test the code for modify stoploss,

 what is the wrong? is m_position error?

if have fix it,

if(m_position.Type()==POSITION_TYPE_BUY) 

change to:

if(m_position.PositionType()==POSITION_TYPE_BUY)  

 

There are more code use Type() , it is for the class type, oh,wish this can help you 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Position Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Position Properties - Documentation on MQL5
To add comments, please log in or register