[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 456

 
peshihod:


As a continuation of the theme.

It takes practice to learn.

Do the following in the trading terminal:
1.A demo account must be opened.
Enter the account details into the trading terminal: File->Login->...
2.Use an open chart or open a new one:File->New_chart->...
3.Set the max in: Service->Settings->Charts->Max Bar Histories->250000
4.Set the one-minute timeframe: Charts->Period->M1_One_minute
5.Update: Charts->Refresh
6.Open Strategy Tester: View->Tester_strategies
Close all other windows, leave one window with a chart and the Strategy Tester window.
------------------
Then in the Strategy Tester in the settings:
7.Symbol: Select the symbol, which chart is open.
8.Model: By open prices (.....)
<<This model to use until there is no OrderSend() function in the program.
9.Use date: checkbox.
Date: _From:<Yesterday(except Saturday and Sunday)>, _to:Today
10.Visualization: remove tick if any.
11.Period: M1
12.Optimisation: remove tick if present.
---------------------
Then open MetaEditor:
13.In the trading terminal menu: Service->Editor_MetaQuotes_Language
14.Write a programme, for example:
//=====================

//=============================

15.In MetaEditor, in the menu: File->Save_as: give a file name, save the extension .mq4, the folder should be 'experts'.
16.In MetaEditor in the menu: File->Compile
---------------------------------------
Then in the tester in the settings:
17.Advisor: find and select the program file name.
18. Click the 'Start' button with your mouse.
19.
After checking Print() messages we see the result of the application operation.
-----------------------------------------
For easier viewing:
20. Right-click on any line in the log->Open
This will open logs folder with a *.log file, which you can open with any text editor, Notepad, Word, etc.

PS
If the file is too big and no text editor is able to open it, delete this file using the Windows features and restart the program by pressing the "Start" button in the trading terminal. Tester folder: "...\Installation_folder\tester\logs", not to be confused with another: "...\Installation_folder\logs"

PPS
To learn how to program, you need a programming language compiler which transforms the textual writing of the necessary actions into a "program" (human-readable), into a language of machine commands -- understandable to a computer. Without practice, it is impossible to learn. Mql4 doesn't create separate programs, *.mq4 turns into *.ex4, which is run from a program shell.
*.ex4 cannot be run directly, the algorithm described above bypasses this point.


Why all this?
 
boris.45:

Hi all, I'm asking experienced traders for help in correctly optimising an EA...

There is no answer to your question, at least I pass... You can only catch individual points, e.g. in discussions and read articles in the "tester" section, after which you will have more questions.
 
Another question. What functions can be used to process the history of closed orders
 
boris.45:

Hi all, I'm asking experienced traders to help with the question of correctly optimising an Expert Advisor. I wrote an Expert Advisor on two moving averages. On the first stage I fixed period of a long moving and by changing a value of a moving period with a small period I found optimal moving periods for maximum profit. I obtained the profitability of less than 1.5, and the drawdown within 10 percents. I tested using these parameters for the next time interval and obtained about 70 percents of profit, but with large drawdowns. Obviously, I could not work with drawdowns of 10 percent. At the second stage I have introduced ADX indicator for controlling the trend change speed, moving averages and price levels control on different types of trends. As a result of optimization, I have got profitability not worse than 3.5 and the drawdown ratio not more than 3%. When testing based on optimal parameters, I got a complete absence of deals at very good optimal parameters and a loss of the account at worse optimal parameters. As I understand it, I have adjusted parameters of my Expert Advisor to statistical price parameters. I have looked through two dozens of Expert Advisors in Kodobase, looked through published articles and read a number of books on trading in my time, and the question of the correct methodology of expert optimization is missing everywhere. The problem: how to find the "golden mean" between the optimization of parameters and fitting them on a specific timeframe? Maybe someone knows the right site, article or just share their practical experience in solving this issue?

Thank you for your attention, I hope for your help.



See here, and search "How to optimise an EA correctly" site:mql4.com.
 

demlin:
Еще вопрос. Какими функциями можно обработать историю по закрытым ордерам

 for (orderIndex = (OrdersHistoryTotal() - 1); orderIndex >= 0; orderIndex--)
   {   
      if (!OrderSelect(orderIndex, SELECT_BY_POS, MODE_HISTORY))
      {
         Print("Ошибка при доступе к исторической базе (",GetLastError(),")");
         continue;
      }
   
      if ((OrderSymbol() != Symbol()) || (OrderMagicNumber() != MagicNumber))
      {
         continue;
      }
      
        
   //-------------------------Принимаем в расчет только ордер, закрытый недавно-----------------------
if(time<OrderCloseTime())     //(сравниваем его с хранящимся в пероеменной time) 
  {
    time=OrderCloseTime();     //если время закрытия ордера больше - ложим его в переменную
         
         
     
         int lastType = OrderType();
         double lastLots = OrderLots();
         double lastProfit = OrderProfit() + OrderSwap();
         
        // Print ("lastProfit = ", NormalizeDouble(lastProfit, 1));
  ....
......
......
       
Example. Bold.
 
semiromid:

What is all this for?


1. When you add your comment, you don't need to repeat so many lines, the less repetition the better.

2. You can find a C++ compiler and learn there.

 
boris.45:

Hi all, I'm asking experienced traders to help with the question of correctly optimising an Expert Advisor. I wrote an Expert Advisor on two slides. On

...............................................................................

I have written an Expert Advisor on two sliding timeframes, i.e. on the timeframe? Maybe someone knows the right site, article or just share their practical experience in solving this issue?

Thank you for your attention, I hope for your help.


I've been racking my brains about it myself. I don't think anyone can do it better than the author.
 
Roman.:
Example. Bold.
It's not going to be enough(((.
 
peshihod:


1. When adding your comment, don't repeat so many lines, the less repetition the better.

2. You can find a C++ compiler and learn there.


You take care of the cleanliness of the forum, but you create your own flood comments .Heh... You wrote a manual on how to use... toilet paper...MetaEditor and the Strategy Tester. This information will help all forum newbies in learning the mql4 programming language.

You know ...Stop bullying the newbie(s)!!!

If you don't want to help, don't want to talk directly, don't know how to explain, then you go straight to another thread "Topic: For Virtuoso Programmers". Will you be bored there? Of course, it makes you feel like Bill Gates among the newcomers.

Please don't answer any more questions. I can learn without you.

 
semiromid:

Please don't answer me again.

Please don't ask for anything else.