I've tried to correct several errors, but one more keeps popping up... if the aim was to make life easier for beginners, it's getting difficult like this and I'm losing my mind here...
Great article! I had to change two things to get it working.
On the file "TableOrders.mqh" on this function bool CTableOrders::Add(ulong Ticket,double stop_loss,double take_profit) line 89, the variable m_type should be replaced by:
I've tried to correct several errors, but one more keeps popping up... if the aim was to make life easier for beginners, it's getting difficult like this and I'm losing my mind here...
Help Please!
Airton this article is very advanced for beginners, you must first understand the concept of Object Oriented application development, hierarchies, polymorphism, inheritance, virtual methods, that is, you need to know advanced programming, the errors found in these examples however are related to class declarations, which in some of them are missing the public keyword that you must insert by hand, perhaps the previous version of MQL did not need these keywords to compile, but this version requires this correction.
'MACD_MA model.mq5' MACD_MA model.mq5 11'Trade.mqh' Trade.mqh 11'Object.mqh' Object.mqh 11'StdLibErr.mqh' StdLibErr.mqh 11'SymbolInfo.mqh' SymbolInfo.mqh 11'OrderInfo.mqh' OrderInfo.mqh 11'HistoryOrderInfo.mqh' HistoryOrderInfo.mqh 11'PositionInfo.mqh' PositionInfo.mqh 11'DealInfo.mqh' DealInfo.mqh 11'AccountInfo.mqh' AccountInfo.mqh 11'model_macd.mqh' model_macd.mqh 11'Model.mqh' Model.mqh 11'List.mqh' List.mqh 11'TableOrders.mqh' TableOrders.mqh 11'Time.mqh' Time.mqh 11'mm.mqh' mm.mqh 11'stdlib.mqh' stdlib.mqh 11'model_ma.mqh' model_ma.mqh 11'model_bollinger.mqh' model_bollinger.mqh 11returnvalue of 'OrderSelect' should be checked TableOrders.mqh 1204implicitenum conversion TableOrders.mqh 5044'new_message' - conversion is not accessible because of inheritance access Time.mqh 18521
possible use of uninitialized variable 'lot_limit' mm.mqh 12910't' - conversion is not accessible because of inheritance access Model.mqh 25227
declaration of 'trade' hides global variable Model.mqh 28216
see previous declaration of 'trade' MACD_MA model.mq5 188
declaration of 'i' hides local variable Model.mqh 31015
see previous declaration of 'i' Model.mqh 30712
possible loss of data due to type conversion Model.mqh 42847
possible loss of data due to type conversion model_macd.mqh 8611
possible loss of data due to type conversion model_macd.mqh 9014
possible loss of data due to type conversion model_macd.mqh 9114
possible loss of data due to type conversion model_macd.mqh 9216
expression not boolean model_macd.mqh 22811
expression not boolean model_macd.mqh 25411
possible loss of data due to type conversion model_ma.mqh 8511
possible loss of data due to type conversion model_ma.mqh 898
possible loss of data due to type conversion model_ma.mqh 9019
expression not boolean model_ma.mqh 21911
expression not boolean model_ma.mqh 24211
declaration of 'k_ATR' hides global variable model_bollinger.mqh 97110
see previous declaration of 'k_ATR' MACD_MA model.mq5 2516
possible loss of data due to type conversion model_bollinger.mqh 9922
possible loss of data due to type conversion model_bollinger.mqh 10422
possible loss of data due to type conversion model_bollinger.mqh 10722
variable 'rezult' not used model_bollinger.mqh 1709
variable 'rezult' not used model_bollinger.mqh 1959
expression not boolean model_bollinger.mqh 23811
expression not boolean model_bollinger.mqh 263112 errors, 25 warnings 326
You shouldn't delete node when iterating the list.
for example:
class Test : public CObject {
public:
int i_;
Test(int i) {
i_ = i;
};
int get_i() {
return i_;
};
};
CList *list = new CList();
for (int i = 0; i < 10; i++) {
Test *t = new Test(i);
list.Add(t);
}
for (int i = 0; i < list.Total(); i++) {
Test *t = list.GetNodeAtIndex(i);
if (i == 5) {
list.DeleteCurrent();
}
if (CheckPointer(t) == POINTER_INVALID) {
continue;
}
Print(t.get_i());
}
After deleting node at index 5, you iterate index 6, but the next element is still index 5.
It's a better idea using GetFirstNode / GetNextNode
for (Test *t = list.GetFirstNode(); t != NULL;) {
t_current = t;
if (t.get_i() == 5) {
list.DeleteCurrent();
t = list.GetCurrentNode();
if (t == t_current) {break;}
continue;
}
Print(t.get_i());
t = list.GetNextNode();
}
Thank you, this is a great article and a good framework. Exactly what I was looking for.
I plan to use it with real money, is it the latest version?
Thanks
Good afternoon!
I've tried to correct several errors, but one more keeps popping up... if the aim was to make life easier for beginners, it's getting difficult like this and I'm losing my mind here...
Help Please!
Great article!
I had to change two things to get it working.
On the file "TableOrders.mqh" on this function bool CTableOrders::Add(ulong Ticket,double stop_loss,double take_profit) line 89, the variable m_type should be replaced by:
From:
m_type=order_info.Type();
To:
m_type=order_info.OrderType();
The second one also on the "TableOrders.mqh":
From:
class CTableOrders : CObject
To:
class CTableOrders : public CObject
Regards,
A. HUPP
Good afternoon!
I've tried to correct several errors, but one more keeps popping up... if the aim was to make life easier for beginners, it's getting difficult like this and I'm losing my mind here...
Help Please!
Airton this article is very advanced for beginners, you must first understand the concept of Object Oriented application development, hierarchies, polymorphism, inheritance, virtual methods, that is, you need to know advanced programming, the errors found in these examples however are related to class declarations, which in some of them are missing the public keyword that you must insert by hand, perhaps the previous version of MQL did not need these keywords to compile, but this version requires this correction.
in order to compile the file simple_model.mq5 i had to add "public":
class CModel: public CObject at line 12
while compiling MACD_MA_model.mq5 i keep getting this error:
'MODE_OPEN' - enumerator identifier already defined stdlib.mqh 13 4
i cannot get around this error which refers to underlying library.
Thank you for your article and the effort to build a general framework for testing.
in order to compile the file simple_model.mq5 i had to add "public":
class CModel: public CObject at line 12
while compiling MACD_MA_model.mq5 i keep getting this error:
'MODE_OPEN' - enumerator identifier already defined stdlib.mqh 13 4
i cannot get around this error which refers to underlying library.
Thank you for your article and the effort to build a general framework for testing.
https://www.mql5.com/en/forum/244512
Tried to uncompile, got errors
Any plans to fix the code?
min_risk = point * tick_value * symbol_info_.LotsStep();
you should use tick count instead of point count.
tick_count = MathAbs(open_price - stop_loss) / symbol_info_.TickSize();
because in some symbols, tick size != point
for example:
Futures\Agricultural Commodities\#Coffee_H21:
You shouldn't delete node when iterating the list.
for example:
After deleting node at index 5, you iterate index 6, but the next element is still index 5.
It's a better idea using GetFirstNode / GetNextNode
Thanks for your contribution!