1
0
Fork 0
forked from e187038/SP_GVA1
SP_GVA1/SP_Pedro1/Homework1/SP_Pedro_Chapter04_v3.mq5
super.admin 066c2f4791 convert
2025-05-30 16:25:41 +02:00

99 lines
4.8 KiB
MQL5

long numTicks=0;
int i;
bool primeravez=true;
datetime fi;
ulong serverTime,miliseconds;
/*void OnStart()
{
//---
int i,veces=0;
Print ("HOLA HOLA");
do { //hago este if para que no se haga para todos los ticks, sino uno de cada 100
for (i=1;i<=5;i++) {
Comment("© Singularity Partners 2024","\n",
"num_ticks ",numTicks,"\n",
"VALOR DE i: ",i, " CODE LINE:",__LINE__,"\n");
Sleep (1500);
}
veces++;
}
while (veces<=20);
}
//--------------on tick
/*void OnStart()
{
//--- mostramos en el comentario del gráfico una cuenta atrás de 10 a 1
for(int i=10; i>0 && !IsStopped(); i--)
{
Comment(StringFormat("Wait %u seconds",i));
Sleep(1000);
Print ("SERIAMENTE");
}
//--- escribimos en el comentario "entrante" un texto describiendo el propósito del script
string text="This was a test showing how the Sleep() function works";
string mess="";
for(int i=0; i<(int)text.Length(); i++)
{
mess+=ShortToString(text.GetChar(i));
Sleep(100);
Comment(mess);
}
//--- nos despedimos...
Sleep(1000);
for(int i=0; i<6; i++)
{
mess=(i % 2 == 0 ? "" : " Bye!");
Comment(mess);
Sleep(300);
}
//--- borramos el texto en el gráfico
Comment("");
}
*/
void OnTick()
{
//---
int segundosactual,seconds;
numTicks++;
datetime tiempodeahora;
tiempodeahora=TimeCurrent();
//Print ("HOLA Y OLE ");
if (primeravez) {
fi=tiempodeahora;
primeravez=false;
}
//if (numTicks%100==0) {
for (i=1;i<=5;i++) {
serverTime = GetTickCount();
//Print ("Entra al bucle con estos seundos ",serverTime);
do { //con esto pretendo ralentizarlo
// Obtener el tiempo en milisegundos desde que se inició el sistema
miliseconds = GetTickCount();
// Convertir milisegundos a segundos
seconds = (int)(miliseconds / 1000);
// Imprimir los segundos en la consola del terminal
// Print("Segundos actuales: ", seconds);
} while ((miliseconds-serverTime)<300);
Comment("© Singularity Partners 2024","\n",
"num_ticks ",numTicks,"\n",
"VALOR DE i: ",i, " CODE LINE:",__LINE__,"\n");
// }
}
}
//+------------------------------------------------------------------+