Chronometer and customized candles

 

Hello people.

I would like to know if it is possible to create a programmable tick generator, like a chronometer where is possible to obtain, like a metronome, one signal each...1/10...1/5...1/2 seconds. I am not sure what type of signal is better. For example could be a simple counter (a variable that increase his value each time a "tick" is received from the internal generator)
The purpose of this tick generator, is to use it for creating customized candles, regardless of the standard candles that come with the MT4 platform
Thanks in advance to whom want to respond me

Alberto

 
search for renko, constant range bars which derive from the period converter.
 

//</This is EA : Compile and run in folder "/experts" > 
 
//< Metronome  : Content : LOC 35 >
//< 1. Entry Point              2 >
//< 2. Initialization           7 >
//< 3. Main Cycle              25 >
//< 4. Exit Point               1 >
//</Metronome  : Content : LOC 35 >
 
//< 1. Entry Point >
int init ()
{
//</1. Entry Point >
 
//< 2. Initialization ```````````````````````````````>
static int    iTimerPeriod    = 100  ; // milliseconds
 
static int    iTimeStampTimer = 0    ;
static int    iTimeStampLocal = 0    ;
 
static int    iRunTime        = 0   ;
static int    iRuns           = 0   ;
 
static int    iFraction       = 0   ;
 
static string sTimeFraction = "" ;
//</2. Initialization ```````````````````````````````>
 
//< 3. Main Cycle ````````````````````````````````````````````````````````````````>
while  ( ! IsStopped () )
       {
           iRuns ++                          ;
           iTimeStampTimer = GetTickCount () ;
 
           //< Main Routine >
           // ...
           //</Main Routine >
 
           iRunTime   = GetTickCount () - iTimeStampTimer ;
           Sleep      ( iTimerPeriod    - iRunTime      ) ;
 
           iRunTime   = GetTickCount () - iTimeStampTimer ;
 
           if ( iTimeStampLocal  != TimeLocal () )
              {
                iFraction       = 0              ;
                sTimeFraction   = "000"          ;
                iTimeStampLocal = TimeLocal   () ;
              }
           else
              {
                iFraction = iFraction + iRunTime                               ;
                if        ( iFraction <  10 ) sTimeFraction = "00" + iFraction ;
                else if   ( iFraction < 100 ) sTimeFraction = "0"  + iFraction ;
                else                          sTimeFraction =        iFraction ;
              }
 
           Comment ( "Time " , TimeToStr ( TimeLocal () , TIME_SECONDS ) , " "  ,
                               sTimeFraction                             , "\n" ,
                     "Runs " , iRuns                                            ) ;
       }
//</3. Main Cycle ````````````````````````````````````````````````````````````````>
 
//< 4. Exit Point >
}
//</4. Exit Point >
 
//</This is EA : Compile and run in folder "/experts" > 
  
  

 
Betowm:

Hello people.

I would like to know if it is possible to create a programmable tick generator, like a chronometer where is possible to obtain, like a metronome, one signal each...1/10...1/5...1/2 seconds. I am not sure what type of signal is better. For example could be a simple counter (a variable that increase his value each time a "tick" is received from the internal generator)
The purpose of this tick generator, is to use it for creating customized candles, regardless of the standard candles that come with the MT4 platform
Thanks in advance to whom want to respond me

Alberto


Thank you very much, Ais, zzuegg and WHRoeder .

I will try the codes that you gave me despite that I am not an experimented programmer. I will surely achieve something with your information. Thanks a lot

Best regards,


ALberto