Libraries: BestInterval - page 2

 
Sergey Chalyshev:

I haven't done anything yet, I'm trying to compile this code:

This code compiles. Virtual and BestInterval were updated yesterday. You may have an older version.

It compiles without Virtual ,

it compiles without BestInterval too,

but it won't compile together.

The libraries were completely independent before the update, so there was a conflict. The versions I posted yesterday do not have this problem.
 

What's that supposed to mean?

2018.10.16 15:54:45.104 Core 1  2018.08.30 23:59:59   Amount of Delete Intervals = 0
2018.10.16 15:54:45.104 Core 1  2018.08.30 23:59:59   SUMMARY: 00:00:00 - 23:59:59 : Profit = 0.00, Total = 0, PF = Max, Mean = 0.00
2018.10.16 15:54:45.104 Core 1  final balance 2978.46 USD
2018.10.16 15:54:45.104 Core 1  OnTester result 0
There is not another input parameter from your library.

 
Sergey Pavlov:

What do you mean by that?

There is not one more input parameter from your library.

Forum on trading, automated trading systems and testing trading strategies.

Libraries: BestInterval

fxsaber, 2018.10.16 2:57 pm.

Virtual and BestInterval were updated yesterday. You may have an older version.

 
fxsaber:

This code compiles. Virtual and BestInterval were updated yesterday. You may have an older version.

Thanks!

Updated Virtual, it compiles.

 
fxsaber:

The Expert Advisor compiles, intervals for skipping are calculated, the file appears in Common.

Stage 1.

But the inBestInterval_Action parameter is absent in the tester and does not appear either with or without VIRTUAL_TESTER.

Stage 2.

Consequently, I cannot perform the test taking into account the thrown intervals.

I need help - what am I doing wrong?

 
Mikola_2:

The Expert Advisor is compiled, intervals for skipping are calculated, the file appears in Common.

But the inBestInterval_Action parameter is missing in the tester and does not appear either with or without VIRTUAL_TESTER.

Accordingly, there is no way to perform the test taking into account the thrown intervals.

I need help - what am I doing wrong?

VIRTUAL_TESTER is needed only to speed up Optimisation or reverse. That is why it is not prescribed to work with BestInterval

Forum on trading, automated trading systems and testing trading strategies.

Libraries: BestInterval

fxsaber, 2018.10.15 13:30

1. take any Expert Advisor and write these lines in its beginning

#include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006

#define  BESTINTERVAL_ONTESTER // The optimisation criterion is the profit of the best interval.
#include <fxsaber\Virtual\Virtual.mqh> // https://www.mql5.com/en/code/22577
#include <fxsaber\BestInterval\BestInterval.mqh> // https://www.mql5.com/en/code/22710


ZY It's good that you've figured out the code. If the libraries are in the same form as in KB, I don't know why. Perhaps you forgot to compile them when you removed VIRTUAL_TESTER.

 

fxsaber:

ZY It's good that the code has been sorted out. If the libraries are the same as in KB, I don't know why. Perhaps you forgot to compile them when removing VIRTUAL_TESTER.

I created a file TesterEA_mq4.mq5 with the following content:

#include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006
#define  VIRTUAL_TESTER // Run in a virtual trading environment
#define  BESTINTERVAL_ONTESTER // The optimisation criterion is the profit of the best interval.
#include <fxsaber\Virtual\Virtual.mqh> // https://www.mql5.com/en/code/22577
#include <fxsaber\BestInterval\BestInterval.mqh> // https://www.mql5.com/en/code/22710
#include <..\Experts\fxsaber\TesterEA\TesterEA.mq4>

TesterEA.mq4 file is original, from KB. Compiled normally.

MT4Orders, Virtual, BestInterval are fresh from KB.

I corrected EMA.mqh (an error of division by zero was popping up):

EMA( const int period ) : Alpha(1.0 / period), Value(0)

by

EMA( const int period ) : Alpha(2.0 / (period+1.0)), Value(0)

I tried in BestInterval.mqh instead of

#ifndef  VIRTUAL_TESTER
  sinput
#endif
bool inBestInterval_Action = false; // BestInterval Action

make

//#ifndef VIRTUAL_TESTER
// sinput
//#endif.
sinput bool inBestInterval_Action = false; // BestInterval Action

BestInterval Action variable appears in the tester, with BestInterval Action=false everything is beautiful in the log, but with BestInterval Action=true the whole test runs and nothing about intervals is written in the log....

It's a pity... :)

MT4Orders
MT4Orders
  • www.mql5.com
Данная библиотека позволяет работать с ордерами в MQL5 (MT5-hedge) точно так же, как в MQL4. Т.е. ордерная языковая система (ОЯС) становится идентичной MQL4. При этом сохраняется возможность параллельно использовать MQL5-ордерную систему. В частности, стандартная MQL5-библиотека будет продолжать полноценно работать. Выбор между ордерными...
 
Mikola_2:

I created the following file TesterEA_mq4.mq5:

TesterEA.mq4 file is original, from KB. Compiled it normally.

MT4Orders, Virtual, BestInterval are fresh from KB.

Fixed EMA.mqh ( division by zero error was popping up):

EMA( const int period ) : Alpha(1.0 / period), Value(0)

by

EMA( const int period ) : Alpha(2.0 / (period+1.0)), Value(0)

Zero period is an incorrect value. So division by zero is normal and is left on purpose to show that such a value cannot be set.

I tried in BestInterval.mqh instead of

make

BestInterval Action variable appears in the tester, with BestInterval Action=false everything is beautiful in the log, but with BestInterval Action=true the whole test runs and nothing about intervals is written in the log....

It's a pity... :)


Here is the source for Action

#include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006

//#define VIRTUAL_TESTER // Run in virtual trading environment
#define  BESTINTERVAL_ONTESTER // The optimisation criterion is the profit of the best interval.
#include <fxsaber\Virtual\Virtual.mqh> // https://www.mql5.com/en/code/22577
#include <fxsaber\BestInterval\BestInterval.mqh> // https://www.mql5.com/en/code/22710

#include <..\Experts\fxsaber\TesterEA\TesterEA.mq4>


With Action = true, the same profit should appear in the Tester's report as was calculated in the log with Action = false.

 
fxsaber:

For Action, this is the source code

With Action = true, the same profit should appear in the Tester's report as was calculated in the log with Action = false.

Nope, the stone flower does not come out... :)

In this form, when Action = true, it stops closing orders at all and immediately eats up all the margin with new orders (probably something with CloseBy)....

With Virtual.mqh disabled, everything works, but Action intervals are ignored.

And it's a challenge to understand your code more deeply... I think I'll pass for now. ;)

 
Mikola_2:

Nope, no stone flower coming out... :)

In this form, when Action = true, it stops closing orders at all and immediately eats up all the margin with new orders (probably something with CloseBy)....

I wouldn't be surprised if it was run on Netting. CloseBy does not work there.

With Virtual.mqh disabled, everything works, but Action intervals are ignored.

And it's a challenge to understand your code more deeply... I think I'll pass for now. ;)

Do it on the hedge. I didn't bother with netting, because MT4-advisor was not supposed to run in this mode, of course.


The algorithm of ignoring bad intervals is simple. The TS is launched in a virtual environment. The netting position of only those open positions that fit the calculated intervals is calculated there. Then it synchronises its netting position with the virtual one in the real environment. This is done in the most ugly way for analysis, but simple to implement - CloseBy.

Actually, Reverse-mode is implemented in the same way. I could rewrite the CloseBy variant to make it work on netting accounts as well. I was not busy with it.