2026-03-18 12:10:52 -05:00
//+------------------------------------------------------------------+
//| Def.mqh |
//| Copyright 2025, Niquel Mendoza. |
//| https://www.mql5.com/es/users/nique_372 |
//+------------------------------------------------------------------+
# property copyright " Copyright 2025, Niquel Mendoza. "
# property link " https://www.mql5.com/es/users/nique_372 "
# property strict
# ifndef AIDATATASKRUNNER_BACKEND_BASES_DEF_MQH
# define AIDATATASKRUNNER_BACKEND_BASES_DEF_MQH
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//---
# include <TSN\\ExtraCodes\\RunnerProtDef.mqh>
//---
enum ENUM_AIEXECUTOR_TASK_STATE
{
AIEXECUTOR_TASK_STATE_IN_PROCESS = 0 , // Se esta procesando
AIEXECUTOR_TASK_STATE_IN_QUEQE = 1 , // En cola
AIEXECUTOR_TASK_STATE_PENDIENTE = 2 , // Pendiente
AIEXECUTOR_TASK_STATE_FINISHED = 3 , // Listo
AIEXECUTOR_TASK_STATE_FAILED = 4 // Fallo
} ;
//---
# define TASKTESTER_VALUES ( 8 )
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
struct TaskTester
{
//---
string symbol ; // Simbolo
string set_file ; // SetFIle
datetime start_date ; // End date
datetime end_date ; // Start date
ENUM_TIMEFRAMES timeframe ; // Timeframe
string symbol_folder ; // Simbolo (Para el nombre del folder)
string label ; // Etiqueta
int label_id ; // Numero de la etiqueta
ENUM_AIEXECUTOR_TASK_STATE state ; // Estado
//---
TaskTester ( )
:
symbol_folder ( NULL ) , label ( NULL ) , label_id ( 0 ) , state ( AIEXECUTOR_TASK_STATE_PENDIENTE ) ,
set_file ( NULL ) , symbol ( NULL ) , timeframe ( WRONG_VALUE ) , start_date ( 0 ) , end_date ( 0 )
{
}
//---
__forceinline string ToStringFile ( )
{
return StringFormat ( " %d|%s|%s|%s|%s|%s|%s|%d " ,
int ( timeframe ) , // [0]
symbol , // [1]
set_file , // [2]
TimeToString ( start_date ) , // [3]
TimeToString ( end_date ) , // [4]
symbol_folder , // [5]
label , // [6]
label_id ) ; // [7]
}
//---
2026-07-07 13:38:29 -05:00
void Save ( const int fh , const long chart_id , const string & expert_path , const int8_t modelado )
2026-03-18 12:10:52 -05:00
{
2026-07-07 13:38:29 -05:00
// MISMO layout que extra codes.
//--- Strings (longitud + contenido)
FileWriteInteger ( fh , StringLen ( symbol ) ) ;
FileWriteString ( fh , symbol ) ;
FileWriteInteger ( fh , StringLen ( set_file ) ) ;
FileWriteString ( fh , set_file ) ;
2026-03-18 12:10:52 -05:00
2026-07-07 13:38:29 -05:00
FileWriteInteger ( fh , StringLen ( expert_path ) ) ;
FileWriteString ( fh , expert_path ) ;
//--- Longs
FileWriteLong ( fh , chart_id ) ;
FileWriteLong ( fh , ( long ) start_date ) ;
FileWriteLong ( fh , ( long ) end_date ) ;
FileWriteLong ( fh , ( long ) 0 ) ;
//--- Integers
FileWriteInteger ( fh , ( int ) timeframe ) ;
FileWriteInteger ( fh , -2 ) ;
//--- Int16
FileWriteInteger ( fh , ( int ) 0 , SHORT_VALUE ) ;
//--- Int 8
FileWriteInteger ( fh , ( int ) false , CHAR_VALUE ) ;
FileWriteInteger ( fh , ( int ) modelado , CHAR_VALUE ) ;
FileWriteInteger ( fh , ( int ) MTTESTER_OPTMIZATION_NONE , CHAR_VALUE ) ;
FileWriteInteger ( fh , ( int ) -1 , CHAR_VALUE ) ;
FileWriteInteger ( fh , ( int ) MTTESTER_FORWARD_NONE , CHAR_VALUE ) ;
}
/*
//---
__forceinline string ToStringToMTTester ( )
{
// 1er 0 por qeu no usaremos leverage (por defecotop)
// 2do 0 por visual mode tampoco usaremos visual mode (no es nceesario ver el backtest)
return StringFormat ( " %d|%s|%s|%s|%s|%I64d|%s|0|0|%d " ,
int ( timeframe ) , // [0]
symbol , // [1]
set_file , // [2]
TimeToString ( start_date ) , // [3]
TimeToString ( end_date ) , // [4]
chart_id ,
expert_path ,
modelado ) ;
}
* /
2026-03-18 12:10:52 -05:00
//---
void Assing ( const string & dyn_arr [ ] )
{
//---
timeframe = ENUM_TIMEFRAMES ( int ( dyn_arr [ 0 ] ) ) ;
symbol = dyn_arr [ 1 ] ;
set_file = dyn_arr [ 2 ] ;
start_date = StringToTime ( dyn_arr [ 3 ] ) ;
end_date = StringToTime ( dyn_arr [ 4 ] ) ;
//---
symbol_folder = dyn_arr [ 5 ] ;
label = dyn_arr [ 6 ] ;
label_id = int ( dyn_arr [ 7 ] ) ;
}
} ;
# endif // AIDATATASKRUNNER_BACKEND_BASES_DEF_MQH