Compared to program 86, the code in the new program has been slightly simplified with additional commentary added. Unused variables have been removed. Hopefully this will make it easier to understand. In addition, several methods have been written to avoid repeating code.
Program 87 uses the Price Series Provider class to create a volume profile for timed periods that repeat after a user input number of minutes. The first period begins at the date specified in user input: FirstDate and user input: StartTime. The length of this period is determined by a user input: RepeatTime expressed in minutes. When this time elapses the volume profile is calculated and drawn. Data collection then starts for the next recurring period. This is repeated throughout the day. The profile is color coded between two user specified colors: HistColor1 and HistColor2. The colors are entered as strings (e.g “Cyan”).
Note: Because the drawing tool used in this program can only draw to specific bars, the lengths of the profile are an approximation.
Having calculated the volume profile, Program87 then calculates at which price level most volume occurred during the previous period being analyzed. It plots three horizontal lines at the following levels:
- The price high of the period being analyzed
- The price low of the period being analyzed
- The price at which the highest volume occurred during the PREVIOUS period analyzed
N.B. The above lines are plotted. The histogram is drawn using the Tradestation drawing tools.
Program87 was designed and tested with TradeStation 10. It works on intraday minute bars (e.g. 1 minute, 2 minutes, 5 minutes etc).
Please note that the profiles are drawn from the Starttime bar, however note that the time of the bar actually indicates the end time of the TradeStation bar on a minute chart. The activity that occurred within the StartTime bar IS included in the analysis. For example, on a two minute chart the 1702 bar is the END time of the bar. The bar actually contains activity after 1700 and up to 1702.
The RepeatTime input determines both the time period over which the analysis takes place and when the analysis is repeated. For example, if 2 minute bars were used and the StartTime set to 1000, and RepeatTime set to 60 then the initial period analyzed would be 1000 to 1058. The analysis would then be automatically repeated for 11 to 1158, 1200 to 1258 etc.
For real-time updates, (i.e. a volume profile is being created at the end of the chart for a period that has not yet ended), the histogram is drawn to the latest bar. So, for example, if 5 bars are being analyzed, the maximum length bar in the histogram would be 5 bars. If 6 bars are being analyzed, the maximum length bar in the histogram would be 6 bars.
Calculation of the volume histogram
At the close of each recurring period, the program looks back through the Price Series Provider (PSP) to find the volume (or tick counts depending on settings) at each price level. At the close of each bar _Program87-VolProfile stores volume into a dictionary with a key of the closing price of the bar converted to a string. If a key-value pair already exists in the dictionary for the price, the volume is added to the existing volume for that price. If a key-value pair does not exist then one is created and the volume is stored. Once all the volume data has been collected and stored, for the entire period, the levels are then copied into vectors to be sorted. The price level with the maximum volume is the pivot. The dictionary is cleared before data collection for a new period begins.
Program87 will not work in MultiCharts because it uses the TradeStation collections and other functionality that is not available in the MultiCharts environment.
Key to the user inputs
Technical lessons
The tutorial is NOT compatible with MultiCharts.
The program has been thoroughly tested, however, please report any software bugs.
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.