Scripts: ThirdPartyTicks

 

ThirdPartyTicks:

A library for working with a third-party tick archive.


Author: fxsaber

 
Automated-Trading:

ThirdPartyTicks:

Author: fxsaber

But the strategy tester of mt5 cannot work with that tick data - correct? :(

Will you code a script that creates an artificial symbol for MT5 from the tick data so that this artificial symbol(s) can be tested and optimised with one owns local tick data?

== google translate ====>

But mt5 strategy tester cannot work with tick data - right? :(

Will you code a script that creates an artificial symbol for MT5 from tick data so that this artificial symbol(s) can be tested and optimised using one's own local tick data?
 
Carl Schreiber:

But the strategy tester of mt5 cannot work with that tick data - correct? :(

Will you code a script that creates an artificial symbol for MT5 from the tick data so that this artificial symbol(s) can be tested and optimized with one owns local tick data?

This script creates custom symbol that you can use for testing in Strategy Tester.

 
// https://www.mql5.com/en/code/20225
#include <fxsaber\ThirdPartyTicks\Web.mqh>
#include <fxsaber\ThirdPartyTicks\String.mqh>
#include <fxsaber\ThirdPartyTicks\Data.mqh>

struct SYMBOL_PROFILE 
{
  string Name;
  
  double BuyLots;
  double SellLots;
  
  bool operator ==( const SYMBOL_PROFILE &Value) const
  {
    return(this.Name == Value.Name);
  }
  
  string ToString( void ) const
  {
    return(this.Name + " +" + ::DoubleToString(this.BuyLots, 2) + " -" + ::DoubleToString(this.SellLots, 2));
  }
};

class SYMBOLS_PROFILE : public DATA<SYMBOL_PROFILE >
{
private:
  static const uchar CensoredURL[];
  
public:
  SYMBOLS_PROFILE( const string URL = NULL )
  {
    uchar Bytes[];
    
    if (WEB::Get(Bytes, (URL == NULL) ? ::CharArrayToString(SYMBOLS_PROFILE::CensoredURL) : URL))
    {
      string Str = ::CharArrayToString(Bytes);
      
      STRING::Between(Str, "<tbody>", "</tbody");
      STRING::Between(Str, "<tbody>", "</tbody");
      Str = STRING::Between(Str, "<tbody>", "</tbody");
      
      SYMBOL_PROFILE SymbProfile;
      
      while (::StringLen(Str) > 400)
      {
        SymbProfile.Name = STRING::Between(Str, "<td width=\"10%\">", "</td>");
        SymbProfile.BuyLots = (double)STRING::Between(Str, "<span>", "</span>");
        SymbProfile.SellLots = (double)STRING::Between(Str, "<span>", "</span>");
        
        this.Add(SymbProfile);
      }
    }
  }
  
  string ToString(void ) const
  {
    string Res = NULL;
    
    const uint Size = this.GetAmount();
    
    for (uint i = 0; i < Size; i++)
      Res += this[i].ToString() + "\n";
    
    return(Res);
  }
};

static const uchar SYMBOLS_PROFILE::CensoredURL[] =
{
  0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x72, 0x61, 0x6E, 0x6E, 0x66, 0x6F,
  0x72, 0x65, 0x78, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x72, 0x75, 0x2F, 0x73, 0x68, 0x6F,
  0x77, 0x2F, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x2F
};

// Profile
void OnStart()
{
  SYMBOLS_PROFILE Symbols;
  
  Print(Symbols.ToString());
}


Result

AUDCAD +0.06 -0.00
AUDCHF +0.02 -0.03
AUDUSD +0.05 -0.04
CADCHF +0.02 -0.03
CHFJPY +0.00 -0.01
DAX30 +0.00 -0.10
DJI30 +0.90 -0.00
EURAUD +0.16 -0.08
EURCAD +0.12 -0.00
EURCHF +0.00 -0.03
EURGBP +1.35 -19.99
EURJPY +0.00 -0.28
EURNZD +0.10 -0.00
EURRUB +0.00 -0.02
EURUSD +0.29 -0.19
GBPAUD +0.04 -0.03
GBPCAD +0.22 -0.54
GBPCHF +0.00 -0.06
GBPNZD +0.00 -0.05
GBPUSD +0.02 -0.02
NZDCAD +0.00 -0.01
NZDUSD +0.00 -0.01
USDCAD +0.09 -0.01
USDCHF +0.05 -0.01
USDJPY +0.15 -0.02
USDRUB +0.00 -0.02
USDZAR +0.00 -0.01
XAGUSD +0.00 -0.01
XAUUSD +0.02 -0.00
XBRUSD +0.00 -0.10
 
Библиотеки: Symbol
Библиотеки: Symbol
  • 2017.10.13
  • www.mql5.com
Symbol: Автор: fxsaber...
 

On ThirdPartyTicks-quotes without disabling slippage of limit orders with the help of this library we can get the following picture in the Tester

final balance 10005004.00 RUR
OnTester result 10004391
2018.04.04 23:59:57   deal #397 balance -613.00 [withdrawal] done
TESTER_Censored,M1: 6268667 ticks, 57486 bars generated. Environment synchronized in 0:00:00.468. Test passed in 0:00:03.416 (including ticks preprocessing 0:00:00.811).
TESTER_Censored,M1: total time from login to stop testing 0:00:03.884 (including 0:00:00.468 for history data synchronization)

I.e. profit of 5004 pips, while 631 pips (every eighth pip) is a "bonus" from the Tester, which is not good.


with disabling slippage of limit orders.

final balance 10004391.00 RUR
OnTester result 10004391
TESTER_Censored,M1: 6268667 ticks, 57486 bars generated. Environment synchronized in 0:00:00.031. Test passed in 0:00:03.432 (including ticks preprocessing 0:00:00.827).
TESTER_Censored,M1: total time from login to stop testing 0:00:03.463 (including 0:00:00.031 for history data synchronization)

there is no "bonus", which is not misleading.

SlipPage
SlipPage
  • votes: 20
  • 2016.08.25
  • fxsaber
  • www.mql5.com
Проскальзывания при исполнении ордеров вносят несистемные прибыль/убыток. Данный скрипт выводит величины этих проскальзываний в валюте счета. Можно оценить качество исполнения ордеров торговавшей ТС — вклад несистемных проскальзываний в ее мат. ожидание. Тестер в режиме...
[Deleted]  

You mentioned using cast. characters for MO, can you elaborate a bit more?

I understand that this is arbitration in the current version. Or are there options to load some other data?

I am also interested in loading data from another open real time terminal, how can this be more correctly implemented through the library?

 
Maxim Dmitrievsky:

You mentioned using cast. characters for MO, can you elaborate a bit more?

I suggested history for the MoD. I did not explain it - see the description. Custom symbols are convenient because they can be used through MQL and in the Tester at once.

I understand that in the current version it is arbitrage. Or are there variants of loading some other data?

Current version of what? I don't see any reason to use other sources myself.

also interested in loading data from another open terminal real-time, how can this be more properly implemented through the library?

Real-time custom ones are very easy to implement. For example, real-time Equity-symbol (with automatically generated M1 and "tick" history) is created in 5-10 lines of code in pure MQL.

I myself use custom ones so far only to create TS on the basis of Tester/Optimiser. For this purpose, I use this toolkit as a source of source material.

I speed up and adjust the Tester/Optimiser using other tools - see the post above.

[Deleted]  
fxsaber:

The current version of what? I don't see any reason to use other sources.

Current version - in the sense of using quotes from a third-party source, it is possible to add some macroeconomic indicators and so on, but this is just a subject of research for the MoD

But for arbitrage (multi-currency testing) on different quotes - very interesting, you can write interesting models, but also a subject of research.

There is also an idea to translate values from arbitrary distributions into a custom symbol... but how to apply it further is also a subject of research :)

 
Maxim Dmitrievsky:

current version - in the sense of using quotations from a third-party source, it is possible to cram some macroeconomic indicators and so on into it, but this is just a subject of research for the MoD.

But for arbitrage (multicurrency testing) on different quotes - very interesting, you can build interesting models, but this is also a subject of research.

There is also an idea to translate values from arbitrary distributions into a custom symbol... but how to apply it further is also a subject of research :)

This thread is not about methods of using custom symbols. Here is just a third-party tick history in the form of these very symbols.

And why exactly it is chosen - see the description.

[Deleted]  
fxsaber:

This thread is not about methods of using custom symbols after all. Here is just a third-party tick history in the form of these very symbols.

And why exactly it is chosen - see the description.

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