Questions from Beginners MQL5 MT5 MetaTrader 5 - page 70

 

Good afternoon!

Does anyone know how to output data from an array to a file in test mode at the end of a test?

 
Andrey:

Good afternoon!

Does anyone know how to output data from an array to a file in test mode at the end of a test?

OnTester or OnDeinit to help
 

ResetLastError();
filehandle=FileOpen("Test",FILE_WRITE,'\t');
if(filehandle!=INVALID_HANDLE)
{
for(int j=0; j<line;j++)
{
FileWrite(filehandle,speed_speedup[j][0];

}
FileClose(filehandle);
Print("FileOpen OK");
}

OnTester or OnDeinit or OnTesterDeinit doesn't work, the file is not opened when testing, maybe there is another method for displaying the array.

 
Andrey:
   ResetLastError();
   filehandle=FileOpen("Test",FILE_WRITE,'\t');
   if(filehandle!=INVALID_HANDLE)
     {
      for(int j=0; j<line;j++) FileWrite(filehandle,speed_speedup[j][0]);
      FileClose(filehandle);
      Print("FileOpen OK");
     }

OnTester or OnDeinit or OnTesterDeinit does not work, the file is not opened when testing, maybe there is another method to output the array.

1. Insert the code correctly.

2. What error code is returned?

 
Lester:

Has anybody seen an EA where MA or AMA or DEMA is referring to handle of another indicator?
No problem with the theory, the problem is in the tester. And there must be someone who was able to solve the problem. (Servicedesk staff have written back...)

Hi,

I did this on MT4:

for(i=0; i<malimit; i++)
       RSIBuffer[i]=iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,i);
   for(i=0; i<malimit; i++)
       RSIEMA1Buffer[i]=iMAOnArray(RSIBuffer,0,RSIEMA1,0, MODE_EMA,i);

https://docs.mql4.com/ru/indicators/imaonarray here shows MT4.

https://www.mql5.com/ru/articles/81 here shows how to convert to MT5.

Look on the page where it says about iMAOnArray.

I have not done it myself in MT5 yet.

Good luck

iMAOnArray - Документация на MQL4
  • docs.mql4.com
iMAOnArray - Документация на MQL4
 
Please advise how to set a market price margin for a pending order
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров - Документация по MQL5
 
Lester:

Hasn't anyone seen an EA where MA or AMA or DEMA refers to the handle of another indicator?
No problem with the theory, the problem is in the tester. And there must be someone who was able to solve this problem. (Servicedesk staff have written back...)

I did something, I see that there is an error, well, who can help.

turkey

Files:
MA_MFI.ex5  14 kb
 
AlexGlazunov:
Please advise how to set a market price margin for a pending order
double Bid,Ask,сдвиг_верх,сдвиг_вниз; 

Bid  = SymbolInfoDouble(Symbol(),SYMBOL_BID);
Ask  = SymbolInfoDouble(Symbol(),SYMBOL_ASK);

сдвиг_верх = NormalizeDouble(Ask + сколко там надо,Digits())
сдвиг_вниз = NormalizeDouble(Bid - сколко там надо,Digits())
 

Lester:
It's very blunt.

I took the body of Custom Moving Average indicator and put MFI buffer inside.

I changed the price.

I did it for you as an expert, just an indicator and a comment to verify.

Files:
MA_MFI_2.ex5  13 kb
 

I have some questions concerning the operation of the strategy tester in mt5.

1) When I used the strategy tester in MT4 and tested the robot over the previously optimized time period, the optimizer results (profit for the optimization period, i.e., backtest run) and testing results (forward test) for the same period gave adequate results. Is there a similar phenomenon in MT5 or we can expect different profit obtained for the optimized period and for the test run in the same time interval ,,,, ???? !!!! And if they are different, how big can be this difference in percentage points (0.1%, 5%, 200%, etc.)? And if there is such a difference, what is its nature ?


2) If the optimization (backtest) was conducted over a period of 10 months and the 1/4 forward test option was selected, as an example, how should I understand:

(a) Optimisation was run for 10 months and after that another 2.5 months the optimiser checked the parameters outside the optimisation period. So in fact the optimization period was 12.5 months altogether


or

b) the optimizer splits 10 months into two intervals - 3/4 and 1/4. On the interval of 3/4 of 10 months is optimization and on the interval of 1/4 forward test?

How is it all organized in MT5 ?


3) It is a question of correlation between the optimization time (backtest time /BB/) and the time of profitable Expert Advisor operation in post-optimization period (time of profitable forward test /FPT/). If I'm not mistaken, in MT4 the UPFT was about 1/3 or 1/4 of the VB. What is this ratio from your experience in MT4 and MT5 respectively ? I understand that you can say it depends on the algorithm of the EA, on the trading strategy, on TIMFrame (very important!) and probably on something else. This is partially true and these ratios will vary, but for any strategy and for any of its programmatic implementations there is a certain minimum WFT period, less than that is simply not possible. In my opinion, for any currency pair and for any strategy EA's profitability cannot stop abruptly together with the backtest period (BB). What is your opinion on this matter?