1
0
Fork 0
forked from e187038/SP_GVA1
SP_GVA1/SP_Pedro1/Homework1/SP_Pedro_Chapter04_v2.mql.mq5

69 lines
3.3 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 16:25:41 +02:00
<EFBFBD><EFBFBD>long numTicks=0;
/*void OnStart()
{
//---
int i,veces=0;
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("<00> 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<EFBFBD>fico una cuenta atr<EFBFBD>s de 10 a 1
for(int i=10; i>0 && !IsStopped(); i--)
{
Comment(StringFormat("Wait %u seconds",i));
Sleep(1000);
}
//--- escribimos en el comentario "entrante" un texto describiendo el prop<EFBFBD>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<EFBFBD>fico
Comment("");
}
void OnTick()
{
//---
/*int i;
numTicks++;
if (numTicks%10==0) { //hago este if para que no se haga para todos los ticks, sino uno de cada 100
for (i=1;i<=5;i++) {
Sleep (500);
Comment("<00> Singularity Partners 2024","\n",
"num_ticks ",numTicks,"\n",
"VALOR DE i: ",i, " CODE LINE:",__LINE__,"\n");
}
}*/
}
//+------------------------------------------------------------------+