Download MetaTrader 5

TradeATC class

To add comments, please log in or register
Sign up for MQL5.community to post your Forum topic
Atsushi Yamanaka
5416
Atsushi Yamanaka 2011.06.24 13:11 

Just a little modification Trade.mqh to make it easier to comply with the ATC rules.

Since it's not checked and I'm not very good coder, will someone please help to check it out for it works or not.

Those lines I added are marked with "/////////////////////////////" or between "/////////////////////**********"s.

Thanks.

Files:
TradeATC.mqh 58 kb
Atsushi Yamanaka
5416
Atsushi Yamanaka 2011.07.10 12:50  
Sample EA for multi-symbolize from the EA generated by the wizard, revised tradeATC class and some related classes.



edit:Files are deleted since they are revised below.

Andrei Moraru
1157
Andrei Moraru 2011.07.10 13:44  
alohafx:
Sample EA for multi-symbolize from the EA generated by the wizard, revised tradeATC class and some related classes.

Thanks! Will look closely into it later. Just wanted to note that using OnTick() in multi-symbol EAs isn't a good thing to do. You can read more about it here.
RTATC2011 — Day 5 — Multi-Currency Expert Advisor
  • www.earnforex.com
Following the recent success with Z-Score optimization of my MT5 expert advisor for the Automated Trading Championship 2011, I present the next entry in my Road to ATC 2011 journal. This entry is all about adding a multi-currency support to my expert advisor. As I’ve already written, adding multi-currency support to an MT5 EA can be very...
Atsushi Yamanaka
5416
Atsushi Yamanaka 2011.07.10 14:58  
enivid:
Thanks! Will look closely into it later. Just wanted to note that using OnTick() in multi-symbol EAs isn't a good thing to do. You can read more about it here.

Mahalo for ya advise, but I don't know why just mod like below didn't work on tester.....

void OnTimer()
  {
   ExtExpert0.OnTimer();
   ExtExpert1.OnTimer();
   ExtExpert2.OnTimer();
   ExtExpert3.OnTimer();
   ExtExpert4.OnTimer();
   ExtExpert5.OnTimer();
   ExtExpert6.OnTimer();
   ExtExpert7.OnTimer();
   ExtExpert8.OnTimer();
   ExtExpert9.OnTimer();
   ExtExpert10.OnTimer();
   ExtExpert11.OnTimer();
  }
Atsushi Yamanaka
5416
Atsushi Yamanaka 2011.07.11 07:19  
enivid:
Thanks! Will look closely into it later. Just wanted to note that using OnTick() in multi-symbol EAs isn't a good thing to do. You can read more about it here.

Revised as your advise!

I don't understand but the OnTimer handler was doing nothing like below. Indeed it didn't work.

//+------------------------------------------------------------------+
//| OnTimer handler                                                  |
//| INPUT:  no.                                                      |
//| OUTPUT: no.                                                      |
//| REMARK: no.                                                      |
//+------------------------------------------------------------------+
void CExpert::OnTimer()
  {
//--- check process flag
   if(!m_on_timer_process) return;
  }

Andrei Moraru
1157
Andrei Moraru 2011.07.11 13:04  
alohafx:

Revised as your advise!

I don't understand but the OnTimer handler was doing nothing like below. Indeed it didn't work.


Sorry, I've accidentally inserted a wrong link. Now it's corrected. The idea is to use OnChartEvent instead of OnTimer() or OnTick(). Nevertheless, the test results will still differ if you run the EA on different currency pairs, though in theory they shouldn't.
Atsushi Yamanaka
5416
Atsushi Yamanaka 2011.07.13 15:24  
enivid:
Sorry, I've accidentally inserted a wrong link. Now it's corrected. The idea is to use OnChartEvent instead of OnTimer() or OnTick(). Nevertheless, the test results will still differ if you run the EA on different currency pairs, though in theory they shouldn't.
The EA is set the timer for 100 sec. for testing purpose, we can set it for 1 sec. then maybe it's enough...?
Andrei Moraru
1157
Andrei Moraru 2011.07.13 15:40  
alohafx:
The EA is set the timer for 100 sec. for testing purpose, we can set it for 1 sec. then maybe it's enough...?
Doing it with a timer isn't good even if you set it to 1 sec. New ticks may appear even faster and you still add excess load when nothing happens on charts.
Atsushi Yamanaka
5416
Atsushi Yamanaka 2011.07.17 09:48  

Hey guys,

We need check this out first!

I knew they do this better than me....

https://championship.mql5.com/2011/en/news/79

A Class of Trade Operations for the ATC 2011 - Automated Trading Championship 2011
  • championship.mql5.com
The publication deals with restrictions on trade operations set by the Rules of the Automated Trading Championship 2011. It also describes the implementation of a ready-to-use class that checks trade operations. This class intercepts all trade requests of an Expert Advisor and checks if they meet the trade conditions of the Championship.
Atsushi Yamanaka
5416
Atsushi Yamanaka 2011.07.18 02:45  

I'm disappointed. Their work is not finished yet about the new class ExpertTradeForATC2011.mqh.

CheckVolumes(...) should return max volume which is the symbol can have currently, instead just say NO. (bool false)

If we have 12.0 lots already and some how try to get 5.0 more to same direction, it should say "you can get only 3.0 more".

And also some other classes include the EA generated by wizard are still using

double maxvol=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX);

instead

double maxvol=SymbolInfoDouble(symbol,SYMBOL_VOLUME_LIMIT);

so, we'll get error like " CExpert::ValidationSettings: error money parameters " when my EA try to open 5.01 lots or more.

Problem is there is no "divided volume" order implemented. If the EA wants to close 11.0 lots all together, my TradeATC class will make

multiple orders like 5.0, 5.0, 1.0. Same thing to Open.

We have to wait for a bit for them to get it finish.


But a good news is we can see they also making it for multi-symbol from a code in the article.

   //--- Initializing expert
   if(!Expert[i].Init(Symbol(),Period(),Expert_EveryTick,Expert_MagicNumber+i))

Expert[i] means the "i" should be int number for each symbol!

Wow, I'm looking forward to see them and I'll take a rest.

Atsushi Yamanaka
5416
Atsushi Yamanaka 2011.07.25 02:33  
Some bugs fixed.

Files:
12
To add comments, please log in or register