Join our fan page
- Views:
- 346
- Rating:
- Published:
- 2025.04.03 11:15
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
This library allows you to read/write tst files - MT5-Tester single pass format.
Some variants of use
Forum on trading, automated trading systems and testing trading strategies
fxsaber, 2019.10.04 07:18 pm.
If they open the format of tst-files and place the cache folder of the Tester in the sandbox, it is possible to create Market products of a new type, which will be analysers/correctors of the Tester results.
For example, it will be possible to write a Market-combine that shows all single passes available in the cache.
- You select the necessary ones with the mouse and it shows the combined statistics.
- It cleans the cache from unnecessary passes.
- Calculates the optimal portfolio with appropriate weighting coefficients from the passes.
- Shows the best trading intervals for each pass.
- Offers its own interactive visualisation of statistics, including filters.
- Calculates the optimal MM.
- For each hedge position in history shows OrderOpenPriceBest (the best opening price during the lifetime of the position), OrderClosePriceBest (similar), OrderOpenPriceLength (how long the price was not worse than OrderOpenPrice during the lifetime of the position), OrderClosePriceLength (similar), OrderProfitBest (the highest possible profit of a similar position during the lifetime of the original position).
- Shows the efficiency of each hedge position.
- Calculates the result when latency is enabled.
- Calculates the result at different order execution settings (whether they slide, etc.) and commissions.
- Shows the result of the TS on a different tick history.
- ...
You don't need to launch the Tester to implement each item.
All this can be done now, if you put the cache folder into the sandbox via mklink. You only need tst-format.
Whoever feels the strength in himself should probably start writing such a product. I would gladly join the team of its developers and purchase it. The niche is completely empty.
If cache-folder is not sandboxed, there may be an increased chance that similar products will appear outside the MQ ecosystem, as they will be written in other languages.
Examples.
#include <fxsaber\SingleTesterCache\SingleTesterCache.mqh> // Tester's single pass data. void OnStart() { SINGLETESTERCACHE SingleTesterCache; // Created a tester cache object. SingleTesterCache.Set(); // Put the real story of the bidding in it. // ..\.\.\MQL5\Files/Test.tst. Print(SingleTesterCache.Save("Test.tst")); // Write it to a file that can be imported into the Tester. }
This script corrals real account trading history into tst format. It is imported into the Tester as follows.
It turns out something like this.
DLL-solutions cannot be placed in KB, so below is the source code of another script, which is not included in KB delivery.
#include <fxsaber\SingleTesterCache\SingleTesterCache.mqh> // Tester's single pass data. #include <Graphics\Graphic.mqh> #include <fxsaber\MultiTester\MTTester.mqh> // https://www.mql5.com/en/code/26132 #define MIN_WIDTH 10 // Creating a graph. string GraphPlot( const double &Y1[], const double &Y2[], int Width = 0, int Height = 0, const ENUM_CURVE_TYPE Type = CURVE_NONE, const string CurveName1 = NULL, const string CurveName2 = NULL, string ObjName = NULL ) { Width = Width ? Width : (int)::ChartGetInteger(0, CHART_WIDTH_IN_PIXELS); Height = Height ? Height : (int)::ChartGetInteger(0, CHART_HEIGHT_IN_PIXELS); ObjName = (ObjName == NULL) ? __FUNCTION__ : ObjName; CGraphic Graphic; const bool Res = (::ObjectFind(0, ObjName) >= 0) ? Graphic.Attach(0, ObjName) : Graphic.Create(0, ObjName, 0, 0, 0, Width, Height); if (Res) { const int Size1 = ::ArraySize(Y1); const int Size2 = ::ArraySize(Y2); Graphic.CurveAdd(Y1, ((Type == CURVE_NONE) && Size1) ? ((Width / Size1 < MIN_WIDTH) ? CURVE_LINES : CURVE_POINTS_AND_LINES) : Type, CurveName1); Graphic.CurveAdd(Y2, ((Type == CURVE_NONE) && Size2) ? ((Width / Size2 < MIN_WIDTH) ? CURVE_LINES : CURVE_POINTS_AND_LINES) : Type, CurveName2); Graphic.CurvePlotAll(); Graphic.Update(); } return (Res ? Graphic.ChartObjectName() : NULL); } void OnStart() { uchar Bytes2[]; if (MTTESTER::GetLastTstCache(Bytes2) != -1) // If it was possible to read the last cache record of a single run { const SINGLETESTERCACHE SingleTesterCache(Bytes2); // Drive it into the corresponding object. SingleTesterCache.SaveSet(NULL, true, "Created by " + __FILE__); // Save the set file with details. double Balance[]; double Equity[]; // Print the balance and equity chart. if (SingleTesterCache.GetBalance(Balance) && SingleTesterCache.GetEquity(Equity)) GraphPlot(Balance, Equity, 1200, 500, CURVE_NONE, "Balance", "Equity"); Print(SingleTesterCache.Header.ToString()); // Output the header of a single pass. Print(SingleTesterCache.Summary.ToString()); // Statistica. Print(SingleTesterCache.Inputs); // Input parameters. } }
This script will automatically pick up the data of the last single pass and output its data, including a balance/equity graph.
Acknowledgements.
Thanks to the developers for creating the Tester caches and helping me to unpack its formats.
Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/27611

A zigzag based on the trend change of the parabolic sar

This MT5 Expert Advisor combines multi-timeframe candlestick pattern analysis with fundamental event filtering to execute trades with disciplined risk management.

Calendar - fundamental analysis on history and real-time.

Detecting the start of a new bar or candle in an Expert Advisor's OnTick() event handler.