Additionally, check this code that is suitable for random time frames (discovered using the first price quote):
Inserted Code #property strict void OnStart() datetime seconds = _Stage * 60; // state any amount in seconds datetime t_last_recorded = 0; // for demonion sake while(! IsStopped()) RefreshRates(); datetime t = TimeCurrent(); // time of last known quote datetime t_normalized = t / / moments * moments; when(t_normalized gt; t_last_recorded) // new bar printf(new bar!) ; t_last_recorded = t_normalized; Sleep(1);