Scripts: ThirdPartyTicks - page 2

 
Maxim Dmitrievsky:

Just thinking out loud, sorry, I can delete previous posts, should I? )

I don't fight for the purity of the ranks, let it live. As you have something on the toolkit, write.

For MO-strangers, the first thing I would do would be comparative performance with other sources.

And for the more down-to-earth - Tester.


ZЫ Suggest to "comrades in the shop".

Машинное обучение в трейдинге: теория и практика (торговля и не только)
Машинное обучение в трейдинге: теория и практика (торговля и не только)
  • 2016.05.26
  • www.mql5.com
Добрый день всем, Знаю, что есть на форуме энтузиасты machine learning и статистики...
[Deleted]  
fxsaber:

I don't fight for the purity of the ranks, let it live. If you have anything on the toolkit, write me.

For MO-strangers, the first thing I would do is comparative characteristics with other sources.

And for the more down-to-earth - Tester.


ZY Suggest to "comrades-in-arms".

unlikely to be perceived by anyone but me, until I show them on fingers, but wrote :)

 

Forum on trading, automated trading systems and testing trading strategies

Libraries: Symbol

fxsaber, 2018.04.07 22:37

At the same time a short test of this implementation too (just bar spread counted differently)

Two modes are compared: "All ticks" and "OHLC M1".


All ticks

final balance 10006150.00 EUR
TESTER4_Censored,M1: 6576734 ticks, 60353 bars generated. Test passed in 0:00:04.587 (including ticks preprocessing 0:00:00.343).
394 Mb memory used including 27 Mb of history data, 128 Mb of tick data


OHLC M1

final balance 10006119.00 EUR
TESTER_Censored,M1: 240366 ticks, 60353 bars generated. Test passed in 0:00:00.359 (including ticks preprocessing 0:00:00.031).
306 Mb memory used including 27 Mb of history data, 64 Mb of tick data


Backtest quality is the same, the performance of the second variant in a single run is 12 times higher.

 
Исторически сложилось, что для MetaTrader 4 пользуются популярностью сторонние приложения, позволяющие получать тиковую историю из различных источников. Как правило, ее используют в Тестере Стратегий как полигон для проверки советников, а также для исследований (машинное обучение и т.д.). Некоторые источники котировок в обсуждениях стали почти стандартом при поиске "грааля".
A simple example showing that so many people suffer from nonsense when looking for a working TC. In particular, fans of machine learning.

Let's run the EA Optimisation (by real ticks) in the first week of April in the "All symbols selected in the Market Watch window" mode

#include <fxsaber\ThirdPartyTicks\Data.mqh>

input double inCommissionProcent = 0.002;
sinput bool inLog = true;
sinput int inOnTester = 0;

#define  RESERVE 100000

// Potential profit in relative and absolute (pips) values
class MAXPROFIT : public DATA<double>
{
private:    
  bool FlagUP;
  double MinMax;

  const double MarkupAsk;  
  const double MarkupBid;

  void SetMarkup( MqlTick &Tick ) const
  {
    Tick.bid *= this.MarkupBid;
    Tick.ask *= this.MarkupAsk;
    
    return;
  }
  
  static void MathLog( MqlTick &Tick )
  {
    Tick.bid = ::MathLog(Tick.bid);
    Tick.ask = ::MathLog(Tick.ask);
    
    return;
  }
  
  double MathRelative( const double Value ) const
  {
    return(this.Relative ? ::MathExp(Value) : Value);
  }
  
public:  
  const bool Relative;
  
  MAXPROFIT( const double Commission = 0, const bool inRelative = false ) : FlagUP(true), MinMax(-DBL_MAX), Relative(inRelative),
                                                                            MarkupBid(1 - Commission), MarkupAsk(1 + Commission)
  {
  }
  
  void AddTick( MqlTick &Tick )
  {
    this.SetMarkup(Tick);
    
    if (this.Relative)
      MAXPROFIT::MathLog(Tick);
    
    if (this.FlagUP)
    {
      if (Tick.bid > this.MinMax)
        this.MinMax = Tick.bid;
      else if (Tick.ask < this.MinMax)
      {
        this.Add(this.MinMax, RESERVE);
        
        this.MinMax = Tick.ask;
        this.FlagUP = false;
      }
    }
    else
    {
      if (Tick.ask < this.MinMax)
        this.MinMax = Tick.ask;
      else if (Tick.bid > this.MinMax)
      {
        this.Add(this.MinMax, RESERVE);
        
        this.MinMax = Tick.bid;
        this.FlagUP = true;
      }
    }
    
    return;
  }
  
  double GetProfit() const
  {
    double Res = 0;
    
    const uint Size = this.GetAmount();
    
    for (uint i = 1; i < Size; i++)
      Res += this.MathRelative(::MathAbs(this.Data[i] - this.Data[i - 1]));
      
    if (Size)
      Res += this.MathRelative(::MathAbs(this.MinMax - this.Data[Size - 1]));
      
    return(Res);
  }
};

MAXPROFIT MaxProfit(inCommissionProcent / 100, inLog);

void OnTick()
{  
  MqlTick Tick;
  
  if (SymbolInfoTick(_Symbol, Tick))
    MaxProfit.AddTick(Tick);
}

double OnTester()
{  
  switch (inOnTester)
  {
  case 0:
    return(MaxProfit.Relative ? MaxProfit.GetProfit() : (int)(MaxProfit.GetProfit() / _Point + 0.1));
  case 1:
    return(MaxProfit.GetAmount());
  case 2:
    return((MaxProfit.Relative ? MaxProfit.GetProfit() : (int)(MaxProfit.GetProfit() / _Point + 0.1)) / MaxProfit.GetAmount());
  }
  
  return(0);
}


Result

The numerical value is the maximum possible profit on the history (including commission).

On the screenshot, EURUSD is highlighted, which is taken from MQ-Demo, the other symbols are ThirdPartyTicks. We can see that EURUSD has 8878.74, while its third-party namesake has 15134.94. This means that any TS on EURUSD will show less profit than on its namesake symbol.

It turns out that anyone who will conduct the same MO on MQ-Demo EURUSD will miss a whole layer of possible profitable TSs. And will greatly underestimate the FOREX-symbol.


At the very top is GBPAUD. Its level shows that it is very easy to write a pipsarist, which will show space on OOS in Tester with perfect execution.

It is not the demo that will break the illusion of grail, because the demo will also show a perfect result. But, of course, the real one.


First of all, the commission will interfere, because the expectation of a piper is low ~ 8 pips (* thousands of trades per week). But what is even worse, it will distort the result of execution.

In case of realisation through markets, we will get a lot of negative slippages, which together with the commission will overlap the mat. expectation. And there will be a drain.

In case of realisation through limit orders, we will get absence of negative slippages (sometimes there will be positive ones), but we will be ruined by very frequent re-jackets of orders, when they simply will not be executed. Hence a huge number of profitable trades that would have been on the same demo will simply be ignored. And that will lead to a drain again. If this were not forex, but a stock exchange, the situation would certainly be much better with execution.


The conclusion from this simple example can probably still be made. Before writing a TS, choose the best trading conditions (quotes) not only by the source of quotes (broker), but also by the symbol. This EA can help in this quite clearly. Using this methodology you can check one broker in MT5 and then another. And immediately understand where and by which symbol any TS will be more profitable to work.

[Deleted]  

Nobody does this, because such tick strategies are easily killed by brokers

It is clear that nobody tests on the quotes of demo metaquotes, but on the quotes of the broker where they are going to trade.

And what the MO has to do with it is still not clear :)

 
Maxim Dmitrievsky:

Nobody does it, because such tick strategies are easily killed by brokers

I don't think we have talked about tick-based TSs here. Low expectation is not pipsing.

It is clear that nobody tests on the quotes of demo metaquotes, but on the quotes of the broker where they are going to trade.

MQ-Demo was for example. What is the argument when choosing a dts that the search for TS goes on it?

And what does the MO have to do with it is still not clear :)

It should be noted that a reasonable and research object is taken first, and not some AUDCAD of a random brokerage house.

[Deleted]  
fxsaber:

I don't think there was any talk about tick TSs here. Low mat. expectation is not pipsing.

MQ-Demo was for example. What is the argument when choosing a brokerage house that the search for TS is carried out on it?

It should be noted that a reasonable and research object is taken first, not some AUDCAD from a random brokerage house.

Usually strategies are just taken at opening prices, ticks do not affect them at all. Then it doesn't matter which broker

 
Maxim Dmitrievsky:

Usually strategies are just taken at opening prices, ticks have no influence at all. Then it doesn't matter which broker

You can also take H1 or better D1 to become completely independent. In general, strange guys.

[Deleted]  
fxsaber:

And you can also take H1 or better yet D1 to become completely independent. In general, strange guys.

Well, on 1-5 minutes it's ok :) you can make up your own TFs, then you need good ticks, yes.

by the way, according to your archive - they have LP Admiral Markets, maybe it makes sense to take quotes directly from them, it should be the same.

 
Maxim Dmitrievsky:

Well, at 1-5 minutes it's normal.)

And where is the boundary, where before it is "normal" and after it is "not normal"?