#twitter-follow { border: 0;position: fixed; top: 240px; left:0;} #live-support { border: 0;position: fixed; top: 370px; left:0;} #knowledge-base { border: 0;position: fixed; top: 170px; left:0;}

## Time-series Sum for the first Minutes/Hours of a Trading Day

by Caleb, 4747 days ago

This trading indicator has the same parameters as the Price at a specific Intraday Time item I have shared yesterday. However, instead of getting a time-series value at a specific bar, this indicator calculates, for the specified price series/indicator, the sum of all bars that occurred before a given time.

For example, the following formula (YTimeSum(volume, 10, 30)) gets the total volume that occurred before 10:30. The result is available in bars starting from 10:30, while previous bars get a NAN or Not a Number value.

Even if this function returns the sum of the provided array, you can get the average value by dividing this sum by the number of trading bars that are available before the specified intraday time. If you are using a 15 minutes time-frame then to get the average volume before 10:30, simply divide the above formula by 4 (There are 4 trading bars between 9:30 and 10:30).

Here is a very good example that illustrates the power of this indicator. The formula below calculates the ratio of the today's first hour volume to yesterday's first hour volume. The higher the value is the higher today's volume (first trading hour) is compared to yesterday's volume.

todVolume = YTimeSum(volume, 10, 30);
yesVolume = iff(RemoveSameSignals(iff(NaNtoZero(todVolume, 1) == 0, 0, 1)) == 1, NaNtoZero(todVolume, 1), 0);
yesVolume = ValueWhen(yesVolume != 0, yesVolume, 2);
ratio = todVolume / yesVolume;

Yesterday's volume is calculated by transforming NaN values to zero. After that excessive signals are removed so that we can use the "ValueWhen" function to get the previous volume sum value. You can update the last parameter (2) in the "ValueWhen" function to get volume for previous days.

What is this?

 Type: Trading Indicator Object ID: 831 Country: All Market: All Style: Technical Analysis

 Related objects Empty
Number of reviews
Average rate
Click to rate this item
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object

 Random Blog Posts QuantShare Version 2.1.0 - Trading Software How to create a ratio indicator using QS Trading Software Screening with the composite indicators Synchronize Buy/Sell List of Rules in the Trading System Optimizer QS Trading Software: Global Script New Ranking and Percentile Composite Functions QS Trading Software: Database Optimization Stock Market Prediction with QuantShare Show All

Number of reviews
Average rate
Click to rate this item
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object