
Está perdiendo oportunidades comerciales:
- Aplicaciones de trading gratuitas
- 8 000+ señales para copiar
- Noticias económicas para analizar los mercados financieros
Registro
Entrada
Usted acepta la política del sitio web y las condiciones de uso
Si no tiene cuenta de usuario, regístrese
El ping también debería reducirse a la mitad: no es necesario ir de ida y vuelta, sino sólo de vuelta.
¿Y si los MQ sólo cuentan aquí?
Añadido por
Corregido
Añadido
Para que la EA trabaje con más confianza
En Market Watch debe añadirse la corriente de alta liquidez
futuros como RTS, Si, BR
Todavía tenemos que añadir la sincronización a la compensación nocturna.
Añadido
Hecho en la limpieza también
Hubo una corrección del desmonte (real)
Pero el resultado no fue nada feliz,
estaba a 49 segundos de distancia :(
Comprobaré el premercado mañana....
¡Mikalas, eres mi ídolo! :-)
Este es el problema.
" Sync sec = ", loc_time.wSecond, " Sync mcs = ", loc_time.wMilliseconds);
2017.01.18 20:05:01.869 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = Si-3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01.18 20:05:01.890 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = BR-2.17 Sync min = 5 Sync sec = 2 Sync mcs = 61
2017.01.18 20:05:01.918 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = BR-2.17 Sync min = 5 Sync sec = 2 Sync mcs = 61
2017.01.18 20:05:01.942 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = RTS-3.17 Sync min = 5 Sync sec = 1 Sync mcs = 428
2017.01.18 20:05:01.942 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = Si-3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01.18 20:05:01.983 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = RTS-3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01.18 20:05:02.055 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = BR-2.17 Sync min = 5 Sync sec = 2 Sync mcs = 61
2017.01.18 20:05:02.081 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = RTS-3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01.18 20:05:02.081 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = Si-3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01.18 20:05:02.121 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = RTS-3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01.18 20:05:02.216 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = BR-2.17 Sync min = 5 Sync sec = 2 Sync mcs = 385
2017.01.18 20:05:02.242 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = BR-2.17 Sync min = 5 Sync sec = 2 Sync mcs = 385
2017.01.18 20:05:02.255 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = RTS-3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01.18 20:05:02.255 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = Si-3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01.18 20:05:02.314 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = Si-3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01.18 20:05:02.405 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = Si-3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01.18 20:05:02.432 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = RTS-3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01.18 20:05:02.432 Time_sync_forts (RTS-3.17,M1) Local time sync is done. Symbol = Si-3.17 Sync min = 5 Sync sec = 2 Sync mcs = 614
La muleta anterior era mucho más elegante (por diseño), pero,
Probaré este.
//| Time_sync_forts.mq5 |
//| Copyright 2017 prostotrader |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017 prostotrader"
#property link "https://www.mql5.com"
#property version "1.00"
//---
struct _SYSTEMTIME
{
ushort wYear;
ushort wMonth;
ushort wDayOfWeek;
ushort wDay;
ushort wHour;
ushort wMinute;
ushort wSecond;
ushort wMilliseconds;
};
_SYSTEMTIME loc_time;
#import "kernel32.dll"
void GetLocalTime(_SYSTEMTIME &sys_time);
bool SetLocalTime(_SYSTEMTIME &sys_time);
#import
//---
bool is_sync;
string symb_rts;
string symb_si;
string symb_gold;
string symb_br;
string symb_gazr;
string symb_sbrf;
datetime last_time;
//
input string BrInstr="BR-2.17"; //Brent
//+------------------------------------------------------------------+
//| Expert set second symbol function |
//+------------------------------------------------------------------+
string SetSecSymbol(const string a_symbol,const string prefix)
{
int str_tire=0;
ushort let_symbol;
int str_size=StringLen(a_symbol);
for(int i=0; i<str_size; i++)
{
let_symbol=StringGetCharacter(a_symbol,i);
if(let_symbol=='-')
{
str_tire=i;
break;
}
}
if(str_tire>0)
{
return(prefix + StringSubstr(a_symbol, str_tire, str_size - str_tire));
}
return("");
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
last_time=TimeCurrent();
is_sync=false;
MarketBookAdd(Symbol());
//---
symb_rts=SetSecSymbol(Symbol(),"RTS");
if(!SymbolSelect(symb_rts,true))
{
MessageBox(symb_rts+" not found in the Market watch!","Error",MB_OK|MB_ICONERROR);
return(INIT_FAILED);
}
else MarketBookAdd(symb_rts);
//---
symb_si=SetSecSymbol(Symbol(),"Si");
if(!SymbolSelect(symb_si,true))
{
MessageBox(symb_si+" not found in the Market watch!","Error",MB_OK|MB_ICONERROR);
return(INIT_FAILED);
}
else MarketBookAdd(symb_si);
//---
symb_gold=SetSecSymbol(Symbol(),"GOLD");
if(!SymbolSelect(symb_gold,true))
{
MessageBox(symb_gold+" not found in the Market watch!","Error",MB_OK|MB_ICONERROR);
return(INIT_FAILED);
}
else MarketBookAdd(symb_gold);
//---
symb_gazr=SetSecSymbol(Symbol(),"GAZR");
if(!SymbolSelect(symb_gazr,true))
{
MessageBox(symb_gazr+" not found in the Market watch!","Error",MB_OK|MB_ICONERROR);
return(INIT_FAILED);
}
else MarketBookAdd(symb_gazr);
//---
symb_sbrf=SetSecSymbol(Symbol(),"SBRF");
if(!SymbolSelect(symb_sbrf,true))
{
MessageBox(symb_sbrf+" not found in the Market watch!","Error",MB_OK|MB_ICONERROR);
return(INIT_FAILED);
}
else MarketBookAdd(symb_sbrf);
//---
symb_br=BrInstr;
if(!SymbolSelect(symb_br,true))
{
MessageBox(symb_br+" not found in the Market watch!","Error",MB_OK|MB_ICONERROR);
return(INIT_FAILED);
}
else MarketBookAdd(symb_br);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
MarketBookRelease(Symbol());
MarketBookRelease(symb_rts);
MarketBookRelease(symb_br);
MarketBookRelease(symb_si);
MarketBookRelease(symb_gold);
MarketBookRelease(symb_gazr);
MarketBookRelease(symb_sbrf);
}
//+------------------------------------------------------------------+
//| Expert On book event function |
//+------------------------------------------------------------------+
void OnBookEvent(const string &symbol)
{
loc_time.wYear=0;
GetLocalTime(loc_time);
if(loc_time.wYear>0)
{
if(((loc_time.wHour==9) && (loc_time.wMinute>=50) && (loc_time.wMinute<=59)) ||
((loc_time.wHour==14) && (loc_time.wMinute>=0) && (loc_time.wMinute<=4)) ||
((loc_time.wHour==18) && (loc_time.wMinute>=45) && (loc_time.wMinute<=59)))
{
MqlDateTime sv_time;
datetime cur_time=TimeCurrent(sv_time);
if(ulong(cur_time) == ulong(last_time)) return;
if((loc_time.wDayOfWeek==ushort(sv_time.day_of_week)) &&
(loc_time.wHour==ushort(sv_time.hour)))
{
if(!is_sync)
{
loc_time.wMinute = ushort(sv_time.min);
loc_time.wSecond = ushort(sv_time.sec);
loc_time.wMilliseconds=0;
if(SetLocalTime(loc_time))
{
is_sync=true;
Print("Local time sync is done. Symbol = ",symbol," Sync min = ",loc_time.wMinute,
" Sync sec = ",loc_time.wSecond);
}
}
}
}
else
{
is_sync=false;
last_time=TimeCurrent();
}
}
}
//+------------------------------------------------------------------+
La muleta anterior era mucho más elegante (por diseño), pero,
Probaré este.
Esto no funcionará conOnBookEvent, tienes que sincronizarlo con OnTick.
se puede utilizar el tiempo de tictac y tomar los datos en el momento del cambio del vaso,
timeOnBookEvent!=OnTick
ElOnBookEvent no funcionará, hay que sincronizarlo con el OnTick.
Puede utilizar el tiempo de tictac y obtener los datos en el momento de cambiar el cristal,
timeOnBookEvent!=OnTick
¡No, Sergei!
Su OnTick para el símbolo seleccionado podría no llegar, mientras que OnBookEvent() se activará ante cualquier cambio de
vasos de todos los símbolos seleccionados.
¡No, Serge!
OnTick en el símbolo seleccionado puede no llegar, pero OnBookEvent() se activará en cualquier cambio de
vasos de todos los símbolos seleccionados.
OnBookEvent() se activará, pero la hora del cambio de copa no se fija en ningún sitio.
Sólo se fija la hora de llegada de la garrapata, es decir, el cambio de la oferta, la última, la demanda.
Así, el tipo de mercado ha cambiado, pero la hora de llegada del último tick es la misma que antes.