Skip to content

Program 86 | Recurring volume profile for a user specified time period

P86

Program 86 is based on _Program57 v1.7. It has been modified to repeat the volume analysis, every time a user input number of minutes is elapsed.

Program 86 uses the Price Series Provider class to create a volume profile for specified periods during the day starting at a user input time and for subsequent days, the beginning of the day . The length of this period is determined by a user input: RepeatTime. 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 2 user specified colors: HistColor1 and HistColor2

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, _Program 86v1 then calculates at which price level most volume occurred during the 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

_Program 86v1 was designed and tested with TradeStation 10. It works on intraday minute bars. 

Please note that the profiles are drawn from the Starttime bar, however because the time of the bar actually indicates the end time of the bar, the activity that occurred within the StartTime bar is not included in the analysis.

The RepeatTime input determines both the time period over which the analysis takes place and when the analysis is repeated. For example, if 5 minute bars were used and the StartTime set to 1000, and RepeatTime set to 60 then the initial period analyzed would be the first tick after 1000 to 1100. The analysis would then be automatically repeated for the first tick after 1100 to 1200, first tick after 1200 to 1300 etc.

This program will not work in MultiCharts because it uses the TradeStation collections and other functionality that is not available in the MultiCharts environment.

Link
Program 86 applied to a 1 minute AMZN chart
Program 86 applied to a 1 minute AMZN chart

The above illustration shows program 86 applied to a 1 minute AMZN chart

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 program 86 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.

User inputs

int RepeatTime( 60 ), // Length of each period
 
int FirstDate( 1230630 ), // The first date that a volume profile is created for
int StartTime( 0100 ), // Analysis begins after this bar
int TicksOrVol( 1 ), // 0 = use ticks, 1 = use volume
 
int IntSpan( 5 ), // Interval span for PSP
int IntType( 1 ), // 0 = ticks, 1 = minutes, 14 = seconds
 
string HistColor1( “AliceBlue” ), // Color of prices at which the least volume occurred
string HistColor2( “Purple” ), // Color of the lines at which the most volume occurred
int HistWeight( 6 ), // Integer 0, 1, 2, 3, 4, 5, or 6
int HistAlpha( 255 ), // 0 is fully transparent and 255 is fully opaque
 
string TopLine( “Fuschia” ), // Color of line at the high of the period
string BottomLine( “Gainsboro” ), // Color of line at the low of the period
string VolPivLine( “LightSalmon” ); // Color of the line at the price at which most volume occurred

Technical lessons

Technically the program makes extensive use of the price series provider, vectors, the dictionary, drawing tools and the color class. The program also uses a method to convert between a color object and a legacy color.
Link
Program 86 applied to a 5 minute @NQ chart with repeat time set to 120
Program 86 applied to a 5 minute @NQ chart with repeat time set to 120

Video explaining program 86

Free download of program 86 for Gold Pass members

If you are a Gold Pass member you can download the program 86 program for free. (Make sure that you are logged into Gold Pass): This content is for members only.
The code then the program 86 is available for  IMMEDIATE download for $54.95  by clicking the following ‘add to cart’ button. 

The tutorial is NOT compatible with MultiCharts.

Colors available for LineColor input

AliceBlueDarkSlateGrayLightSalmonPaleVioletRed
AntiqueWhiteDarkTurquoiseLightSeaGreenPapayaWhip
AquaDarkVioletLightSkyBluePeachPuff
AquamarineDeepPinkLightSlateGrayPeru
AzureDeepSkyBlueLightSteelBluePink
BeigeDimGrayLightYellowPlum
BisqueDodgerBlueLimePowderBlue
BlackFirebrickLimeGreenPurple
BlanchedAlmondFloralWhiteLinenRed
BlueForestGreenMagentaRosyBrown
BlueVioletFuschiaMaroonRoyalBlue
BrownGainsboroMediumAquamarineSaddleBrown
BurlywoodGhostWhiteMediumBlueSalmon
CadetBlueGoldMediumOrchidSandyBrown
ChartreuseGoldenrodMediumPurpleSeaGreen
ChocolateGrayMediumSeaGreenSeashell
CoralGreenMediumSlateBlueSienna
CornflowerBlueGreenYellowMediumSpringGreenSilver
CornsilkHoneydewMediumTurquoiseSkyBlue
CyanHotPinkMediumVioletRedSlateBlue
DarkBlueIndianRedMidnightBlueSlateGray
DarkBrownIndigoMintCreamSnow
DarkCyanIvoryMistyRoseSpringGreen
DarkGoldenrodKhakiMoccasinSteelBlue
DarkGrayLavenderNavajoWhiteTan
DarkGreenLavenderBlushNavyTeal
DarkKhakiLawnGreenOldLaceThistle
Dark MagentaLemonChiffonOliveTomato
DarkOliveGreenLightBlueOliveDrabTurquoise
DarkOrangeLightCoralOrangeViolet
DarkOrchidLightCyanOrangeRedWheat
DarkRedLightGoldenrodYellowOrchidWhite
DarkSalmonLightGrayPaleGoldenrodWhiteSmoke
DarkSeaGreenLightGreenPaleGreenYellow
DarkSlateBlueLightPinkPaleTurquoiseYellowGreen

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.