There is an interesting trading idea. Help me find errors in the code (mql4). - page 7

 
Sergey Gritsay:
This variant is suitable if you have a single-currency EA, if you make a multi-currency EA, then you have to create indicators for all pairs in the Iniq.
I see - I missed this point, does it mean for all currencies that are open in the terminal?
 
The MT5 version needs more work, the version I posted is quite glitchy
 
Сергей Криушин:
I see - I missed that point, does it mean for all currencies that are open in the terminal?

yes

 

Hi all, I rewrote my EA for MT5 using standard classes. So far, the flight is OK, let's test it and report any errors. For testing the EA in the visualization mode in the tester, I should prescribe the required symbols, the function looks like this

bool symbol_tester(string symbol)
  {
   if(!MQLInfoInteger(MQL_VISUAL_MODE))return(true);
//if(!MQLInfoInteger(MQL_TESTER))return(true);
//if(!MQLInfoInteger(MQL_OPTIMIZATION))return(true);

   if(symbol=="EURUSD")return(true);
   if(symbol=="AUDUSD")return(true);
   if(symbol=="GBPUSD")return(true);
   if(symbol=="USDCAD")return(true);
   if(symbol=="USDCHF")return(true);
   if(symbol=="USDJPY")return(true);
   if(symbol=="NZDUSD")return(true);
   if(symbol=="GBPCAD")return(true);

   return(false);
  }
Files:
 

Something is wrong with indicator classes or they are really heavy, the tester loses speed in front of my eyes. In general, I reworked indicator processing without standard classes. Also added selection of signals.

signal_01 - if cci(13) is less than -100 for buy, over 100 for sell.

signal_02 - if cci(13) crosses -100 from upside down for buy, if cci(13) crosses 100 from downside up for sell

signal_03 - if cci(13) crosses -100 from below for sell, if cci(13) crosses 100 from above for sell

signal_04 - if cci(13) crosses 100 from the bottom to the top, if cci(13) crosses -100 from the top to the bottom for sell

signal_05 - if cci(13) crosses above 100 for buy, below -100 for sell.

Removed some glitches in the panel, fixed the trend search on restart of the EA.

Files:
 
added a selection of signals in the mt4 version
Files:
 

Corrected getting the error wrong stops. I also noticed that in the MT5 tester the Expert Advisor runs faster in the OnTick() function than in OnTimer(). Therefore I recommend to replace them in the code when running it on the tester.

 
Sergey Gritsay:

Corrected getting the error wrong stops. I also noticed that in the MT5 tester the Expert Advisor runs faster in the OnTick() function than in OnTimer(). Therefore I recommend to replace them in the code when running it on the tester.

In the Strategy Tester it is not working at all... It is unclear how it makes lots without stopping in MT5 and places positions on pairs that are not present in the terminal: USDSEK; USD ZAR; USDMXM, but they are in Market Watch... maybe that's why the tester is slowing down...

 
the table became 2 columns full screen - one column
 

Fixed bugs. Tested instruments made in input parameters, written with comma. Checked on futures on demo also works.

Files: