[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1070

 
dzhini:
But it doesn't work :(
So it doesn't work elsewhere or I'm missing something
 
Reshetov:
So it doesn't work elsewhere or I've missed something
Can I knock on your door in person?
 
dzhini:
Can I knock on your door in person?
No. Private messages are for personal communication only. And errors in code must be discussed publicly, so that others do not make the same mistakes, or someone could then share a link to a ready-made solution.
 

Hello. this simple code works with an error. I can't figure out the reason myself.

The first order opens, modifies. The second opens and... Doesn't modify. Keeps it until it fails.

In the log it says:

"01:23:22 MarkTrade started for testing

01:23:22 2010.01.29 00:00 MarkTrade EURUSD,H1: open #1 buy 1.00 EURUSD at 1.3965 ok

01:23:22 2010.01.29 00:00 MarkTrade EURUSD,H1: modify #1 buy 1.00 EURUSD at 1.3965 sl: 1.3935 tp: 0.0000 ok

01:23:22 2010.01.29 00:28 Tester: stop loss #1 at 1.3935 (1.3935 / 1.3937)

01:23:22 2010.02.01 00:00 MarkTrade EURUSD,H1: open #2 buy 1.00 EURUSD at 1.3877 ok

01:23:22 2010.05.05 13:17 MarkTrade: stopped because of Stop Out

01:23:22 2010.05.05 13:17 Tester: order #2 is closed

Got my mistake! OrderSend returns non-boolean value!

int start()
  {
  int total=OrdersTotal();
  if (total==0)
   {
      if (TimeHour(TimeCurrent())==00&&TimeMinute(TimeCurrent())==00)
      {
      Buy();
      }
   }
return(0);
  }
//////////////////////////
void Buy()
 {
 RefreshRates();
 if (OrderSend(Symbol(), OP_BUY, 1, NormalizeDouble(Ask,Digits), 0,0,0,"",123321,0,Blue)==true)
         {
           Modify();
         }
 }
/////////////////////////////
void Modify()
 {
    int total = OrdersTotal();
      for(int i=total-1;i>=0;i--)
       {
       OrderSelect(i, SELECT_BY_POS,MODE_TRADES);
       if (OrderModify (OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-NormalizeDouble(30*Point,Digits),OrderTakeProfit(),0,CLR_NONE)== false) Modify();
       }
 }
 

good afternoon

How to create a tester that works on different reframes.

and run it through history.

 

Good morning !

Please clarify. When optimizing Expert Advisor, I noticed that setting different TPs with switched on genetic algorithm produces different results, i.e. if I set TP=400, I optimize in steps from 1 to 400, then I set 350, and optimize in steps from 1 to 350 and so on till TP=50. So it turns out that if I run only at TR = 400, then I "skip" the results that are at lower TP and better ! Is it because of genetics ? (The article https://www.mql5.com/ru/articles/1347 (Created: 25.12.2009 Author: Rider) says: "...Genetics is certainly a useful thing, but within reasonable limits. The thing is that its algorithm may play a cruel joke - some advantageous, from its point of view, set of parameters will be identified, and all further optimization will go "around it" until the very end. I think it's clear what the consequences are. Most of really good variants that will work outside the optimization area will be left "outside" and will not appear in the "Optimization results" table.

There are several ways out. One radical solution is to reject using genetic algorithm in optimization. But this is not always a good solution for one reason or another. The next two are half-measures, but at least something:

- Conduct the optimization not once, but two or more times. The first time, say, by "Balance", the next by "Maximal Drawdown" or something else ..."). So, in order not to get the best result, I should run it with different TPs + by different "optimizable parameters" and plus, for example, 9 forward tests with 9 optimizations for each test for reliability?

 
eddy:

the cycle is not interrupted for some reason

Break in your case triggers and interrupts the loop only when the condition is fulfilled. If the condition is not fulfilled, the loop is infinite. Try it this way.

int sec=Seconds();
       while(true) 
        {if(sec!=Seconds())          // new sec
          { int ms=GetTickCount(); }
       break;
        }
 
volshebnik:

break in your case only works if the condition is met

that's why it's in if()
 
Hello! How do I change the properties of a symbol in the terminal? It says that the minimum stop level is 300. I can't test the EA.
 
Pro

To change the spread for example there is a program TakeMySpread, but how or with what you can change the "Stop Level" to test the EA in different conditions. Help!
Reason: