[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 915

 
ViktorF:

Hello!

Question on the tester:

When testing EAs, the tester stops processing prices after a s/l breach. What should I do to prevent this? What should I do, if I want the tester to continue testing the EA after breaching the stop?


Maybe you have a script, not an EA))) and what testing period do you set?

If everything is ok, post the EA, someone will tell you what to do.

 
gheka:


Maybe you have a script, not an EA))) and what testing period do you set?

If your timeframe is ok, post the EA, someone will tell you.


Mainly 30 minutes.

The most interesting thing is that when I bypass stop-losses by forced closing, the prices are further processed and the curve of the chart continues to be drawn. But if I close the same order at a stop (change the EA code a bit) - the testing stops after a stop breakdown... Maybe you should change some parameters in the tester's settings?

 
gheka:

Folks! is there a function that returns the value of a fixed loss in pips to close an order?

I know there is an OrderStopLoss, but it's a losing price.

I know there is an OrderStopLoss - but it is a value of the price at a loss, but I have not found anything, help me

Search here... :)

 
ViktorF:


Mostly 30 minutes.

The most interesting thing: when I bypass stops by forced closing - prices are processed further and the chart curve continues to be drawn. But if I close the same order by a stop (change the code of the Expert Advisor a bit) - testing stops after breakdown of a stop... Maybe, you should change some parameters in the tester settings?

 
ViktorF:


Mostly 30 minutes.

The most interesting thing: when I bypass stops by forced closing - prices are processed further and the chart curve continues to be drawn. But if I close the same order by a stop (change the code of the Expert Advisor a bit) - testing stops after breakdown of a stop... Maybe, you should change some parameters in the tester settings?

Most likely an error in the EA code and it stops opening new positions after closing on a stop
 

hello!

Question about strategy tester: When testing in the journal tester no results with the records in the log file, in the terminal log error records also no ..... at the end of the loading bar, in the tester, there is a nasty squeak. advisor lies in the folder experts all the checkboxes are set hundred help plz?

 
artmedia70:

Search here... :)


thank you!!!
 
artmedia70:
Most likely an error in the EA code and after closing on a stop it stops opening new positions

I think I figured out the error: the checkbox does not change value after order closing by stop (i.e. not by EA itself). How do I get around that?
 
ViktorF:

I think I figured out the error: flag does not change the value after order closing by stop (i.e. not by Expert Advisor). How do you get around that intelligently?

In the EA, check whether the order is closed on a stop. And if so, change the value of your flag.

You can use Igor Kim's ready-made function to determine if the last closed position was closed by a stop.

Or you can do it yourself. In any case, it may be a good example for you to start with:

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.05.2008                                                     |
//|  Описание : Возвращает флаг закрытия последней позиции по стопу.           |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//+----------------------------------------------------------------------------+
bool isCloseLastPosByStop(string sy="", int op=-1, int mn=-1) {
  datetime t;
  double   ocp, osl;
  int      dg, i, j=-1, k=OrdersHistoryTotal();

  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
      if (OrderSymbol()==sy || sy=="") {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (t<OrderCloseTime()) {
                t=OrderCloseTime();
                j=i;
              }
            }
          }
        }
      }
    }
  }
  if (OrderSelect(j, SELECT_BY_POS, MODE_HISTORY)) {
    dg=MarketInfo(sy, MODE_DIGITS);
    if (dg==0) if (StringFind(OrderSymbol(), "JPY")<0) dg=4; else dg=2;
    ocp=NormalizeDouble(OrderClosePrice(), dg);
    osl=NormalizeDouble(OrderStopLoss(), dg);
    if (ocp==osl) return(True);
  }
  return(False);
}
 
artmedia70:

In the EA, check whether the order is closed on a stop. And if so, change the value of your flag.

You can use Igor Kim's ready-made function to determine if the last closed position was closed by a stop.

Or you can do it yourself. In any case, it will be a good example for you to start with:


Thank you! I'll give it a try)
Reason: