You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You can use the switch operator.
{
case 0:
// Do Something...
break;
case 1:
// Do Something...
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
// etc...
}
Or use simple double if statement:
{
// Do Something...
}
If time hour is above > 0 but also && below < 22 etc.
Or you can use:
{
// Do Something...
}
If time hour is above > or == equal to 0 but also && below < or == equal to 22 etc.
Its slightly different because it includes the hour when its equal, where previous example >0 excludes 0 itself because it is equal so not above.
#Month Lines - Closed for me.
I tested with 'Strategy Tester' & real time so far works perfect.
I learned a lot of things from your comments, and I made my this indicator so good, big thanks @Marco vd Heijden
Special thanks to Mr. Marco & Mr. William.
Below code works good for me, but sometimes irrelevant it takes a long time (1250).
// which is good?
EventSetTimer( 1 );
Additionally, can I use 'Switch' function for that?
//--- 2nd times edited
I do not want to use start() function. Actually I need to set like below.
EventSetMillisecondTimer( 250 ); // 2nd will read in 250
EventSetMillisecondTimer( 1250 ); // 3rd will read in 1250
But I need help, please.
//--- 3rd times edited
{
case 1 : EventSetMillisecondTimer( 100 );
case 2 : EventSetMillisecondTimer( 250 );
case 3 : EventSetMillisecondTimer( 1250 );
default : EventSetMillisecondTimer( 10 ); break;
} //---switch Close
It does not work, like I want.
If someone understand my concern, please give me advice or help.
Thanks in advance.
I do not want to use start() function. Actually I need to set like below.
EventSetMillisecondTimer( 250 ); // 2nd will read in 250
EventSetMillisecondTimer( 1250 ); // 3rd will read in 1250
But I need help, please.
It does not work, like I want.
If someone understand my concern, please give me advice or help.
Thanks in advance.
no it does not work like that you use one timer and one timer only.
but you can split or splice the time interval by using a simple counter.
{
clock++;
switch(clock)
{
case 500:
//Do something...
break;
case 1000:
//Do something...
clock=0; // reset counter if need be.
break;
// Etc...
}
}
You mentioned twice 'Event Handling Functions', and I read few times (maybe I did not clearly understanding all of that page - also I use 'OnTimer' function) but I worry about that page, that will pull me another way - but my this indicator almost finished.
But I see just 'EventSetMillisecondTimer( 1250 );' sometimes takes 'irrelevant' long time.
but you can split or splice the time interval by using a simple counter.
Is that code right?
{
//---
_clock++;
//---
switch ( _clock )
{
case 500 :
if ( // will be same thing in here? ) )
{
...
_CreateLines_M5();
} //---if Close
break;
case 1000:
if ( // will be same thing in here? ) )
{
...
_CreateLines_M5();
} //---if Close
_clock = 0;
break;
} //---switch Close
}
But it does not work for me.
Thanks.
{
//---
_clock++;
//---
switch ( _clock )
{
case 500 :
if ( // will be same thing in here? ) )
{
...
_CreateLines_M5();
} //---if Close
break;
case 1000:
if ( // will be same thing in here? ) )
{
...
_CreateLines_M5();
} //---if Close
_clock = 0;
break;
} //---switch Close
}
But it does not work for me.
{
if(++_clock % 500 == 0)_CreateLines_M5();
}
{
if(++_clock % 500 == 0)_CreateLines_M5();
}
Big thanks!
I tried it, it continuously refreshing while in a minute even I choice PERIOD_M5.
Also I would like to know if I need to use PERIOD_M1 & PERIOD_M5 can I use like below?
if(++_clock % 500 == 0)_CreateLines_M5();
also, Is below method right, please?
{
_dt_Prd_M5 = iTime( Symbol(), _prd_M5, 0 );
_CreateLines_M5();
}
All the best.
Big thanks!
I tried it, it continuously refreshing while in a minute even I choice PERIOD_M5.
Also I would like to know if I need to use PERIOD_M1 & PERIOD_M5 can I use like below?
if(++_clock % 500 == 0)_CreateLines_M5();
also, Is below method right, please?
{
_dt_Prd_M5 = iTime( Symbol(), _prd_M5, 0 );
_CreateLines_M5();
}
All the best.