Discussion of article "Library for easy and quick development of MetaTrader programs (part I). Concept, data management and first results" - page 6

 
pennyhunter:

Thanks a lot!

I am fairly new to programming and I was afraid of your articles because they look so cryptic and have no pictures in them AHAHAHA.

But no actually they are very well written and well translated and they are helping me jump into object oriented programming.

:)

OK. Your welcome

 

Apparently there is an error in the following passage:

+------------------------------------------------------------------+
| Returns StopLoss position closing flag |
+------------------------------------------------------------------+
bool COrder::OrderCloseByStopLoss(void) const
{
#ifdef __MQL4__
return(::StringFind(::OrderComment(),"[sl")>WRONG_VALUE);
#else
return
(
this.Status()==ORDER_STATUS_HISTORY_ORDER ? this.OrderReason()==ORDER_REASON_SL :
this.Status()==ORDER_STATUS_DEAL ? this.OrderReason()==DEAL_REASON_SL : false
);
#endif
}
//+------------------------------------------------------------------+
//| Returns the flag for closing the position by TakeProfit |
//+------------------------------------------------------------------+
bool COrder::OrderCloseByTakeProfit(void) const
{
#ifdef __MQL4__
return(::StringFind(::OrderComment(),"[tp")>WRONG_VALUE);
#else
return
(
this.Status()==ORDER_STATUS_HISTORY_ORDER ? this.OrderReason()==ORDER_REASON_TP :
this.Status()==ORDER_STATUS_DEAL ? this.OrderReason()==DEAL_REASON_TP : false
);
#endif
}

The message returned is: 'Status' - undeclared identifier Order.mqh

Unfortunately I can't solve it.

Thank you.

 
albertpess:

Apparently there is an error in the following passage:

+------------------------------------------------------------------+
| Returns StopLoss position closing flag |
+------------------------------------------------------------------+
bool COrder::OrderCloseByStopLoss(void) const
{
#ifdef __MQL4__
return(::StringFind(::OrderComment(),"[sl")>WRONG_VALUE);
#else
return
(
this.Status()==ORDER_STATUS_HISTORY_ORDER ? this.OrderReason()==ORDER_REASON_SL :
this.Status()==ORDER_STATUS_DEAL ? this.OrderReason()==DEAL_REASON_SL : false
);
#endif
}
//+------------------------------------------------------------------+
//| Returns the flag for closing the position by TakeProfit |
//+------------------------------------------------------------------+
bool COrder::OrderCloseByTakeProfit(void) const
{
#ifdef __MQL4__
return(::StringFind(::OrderComment(),"[tp")>WRONG_VALUE);
#else
return
(
this.Status()==ORDER_STATUS_HISTORY_ORDER ? this.OrderReason()==ORDER_REASON_TP :
this.Status()==ORDER_STATUS_DEAL ? this.OrderReason()==DEAL_REASON_TP : false
);
#endif
}

The message returned is: 'Status' - undeclared identifier Order.mqh

Unfortunately I can't solve it.

Thank you.

MetaTrader 4 ? or MetaTrader 5 ?

 

The same occurs in:

m_long_prop[ORDER_PROP_PROFIT_EN] = this.ProfitInPoints();

e

m_double_prop[this.IndexProp(ORDER_PROP_PROFIT_FULL)] = this.ProfitFull();

Both snippets inside the Closed parametric constructor

Thank you

 
Artyom Trishkin:

MetaTrader 4 ? or MetaTrader 5 ?

MT5
 
albertpess :
MT5

I would like to know what you are doing.

Please insert the code using this button on the toolbar of the message input window

 

I'm studying your articles. My goal is to learn how to work with classes.

 
Artyom Trishkin:

I would like to know what you are doing.

Please insert the code using this button on the toolbar of the message input window

bool COrder::OrderCloseByStopLoss(void) const
  {
#ifdef __MQL4__
   return(::StringFind(::OrderComment(),"[sl")>WRONG_VALUE);
#else 
   return
     (
     this.Status()==ORDER_STATUS_HISTORY_ORDER ? this.OrderReason()==ORDER_REASON_SL : 
     this.Status()==ORDER_STATUS_DEAL ? this.OrderReason()==DEAL_REASON_SL : false
     );
#endif 
  }
//+------------------------------------------------------------------+
//| Returns the flag for closing the position by TakeProfit |
//+------------------------------------------------------------------+
bool COrder::OrderCloseByTakeProfit(void) const
  {
#ifdef __MQL4__
   return(::StringFind(::OrderComment(),"[tp")>WRONG_VALUE);
#else 
   return
     (
      this.Status()==ORDER_STATUS_HISTORY_ORDER ? this.OrderReason()==ORDER_REASON_TP : 
      this.Status()==ORDER_STATUS_DEAL ? this.OrderReason()==DEAL_REASON_TP : false
     );
#endif 
  }
 

Спасибо.

Я не знал об этой функции.

 
albertpess :

I'm studying your articles. My goal is to learn how to work with classes.

Is the test programme included with the article working?
What errors occur?
Please describe in more detail.