Tutorial 227 is a ShowMe study that implements a countdown timer showing the number of seconds remaining until the current bar closes.
It is specifically designed to work on live data only and contains logic to avoid starting the countdown on a symbol that has not yet opened for the day’s session.
This study implements a simple real-time countdown timer that estimates the remaining time in the current bar using a 1-second Timer object. Instead of deriving time from bar timestamps, it relies on a running counter (NumSeconds) that is decremented every second. This counter is initialized based on the bar type (minutes or seconds) and is then reduced by one on each timer tick, effectively simulating a live “seconds remaining in bar” display.
At the start of each new bar, detected via a change in BarNumber, the counter is reset to the full bar duration. This ensures that each bar begins with a fresh countdown. The variable is declared intrabarpersist, so it retains its value across intrabar updates but is explicitly reinitialized when a new bar begins. The study also waits for actual live market activity before enabling the countdown by using a LastTick flag, which prevents the timer from running prematurely during pre-market or historical data loading.
When applied to a chart, the study displays approximate remaining time both as a plotted value and through a floating text label (CtrLabel) that updates every second. On RadarScreen, only the plotted numeric output is used. Overall, the design treats the timer as the source of truth for time progression, using bar changes only to reset state rather than to calculate elapsed time.
The program only works with minute and seconds charts and generates an exception for other bar types.
Because this simplified design uses a fixed 1-second timer and a manual decrementing counter, it can differ slightly from the more complex TradeStation implementation, which calculates remaining time from actual bar timestamps and applies exchange/time-zone corrections. In practice, this means the simplified version may drift by a few seconds over time, especially if timer events are delayed by system load, or if bar timestamps do not align perfectly with real-time seconds. The TradeStation approach continuously recomputes time from authoritative time sources, whereas this version assumes a perfect one-second heartbeat, which makes it simpler but potentially less precise under real-world timing variations.
The "wait until the end of the bar" message
Explanation of tutorial 227
Download the tutorial 227 tutorial program
If you wish to save yourself some typing, the tutorial program is available for immediate download by clicking the ‘add to cart’ button below. You may pay using PayPal or a credit card. The price is $14.95
Free download for Gold Pass members
Download the tutorial 227 TradeStation EasyLanguageshow me study free for Gold Pass members. If you are a Gold Pass member you can download the tutorial code below, please make sure that you are logged in with your Gold Pass user name and password.
This content is for members only.
TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.
ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.
