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"); // } } } //+------------------------------------------------------------------+