VolumeProfileLibrary "VolumeProfile"
Analyzes volume and price and calculates a volume profile, in particular the Point Of Control and Value Area values.
new(rowSizeInTicks, valueAreaCoverage, startTime)
Constructor method that creates a new Volume Profile
Parameters:
rowSizeInTicks (float) : Internal row size (aka resolution) of the volume profile. Useful for most futures contracts would be '1 / syminfo.mintick'. Default '4'.
valueAreaCoverage (int) : Percentage of total volume that is considered the Value Area. Default '70'
startTime (int) : Start time (unix timestamp in milliseconds) of the Volume Profile. Default 'time'.
Returns: VolumeProfile object
method calculatePOC(vp)
Calculates current Point Of Control of the VP
Namespace types: VolumeProfile
Parameters:
vp (VolumeProfile)
Returns: void
method calculateVA(vp)
Calculates current Value Area High and Low of the VP
Namespace types: VolumeProfile
Parameters:
vp (VolumeProfile)
Returns: void
method update(vp, h, l, v, t)
Processes new chart data and sorts volume into rows. Then calls calculatePOC() and calculateVA() to update the VP. Parameters are usually the output of request.security_lower_tf.
Namespace types: VolumeProfile
Parameters:
vp (VolumeProfile)
h (array) : Array of highs
l (array) : Array of lows
v (array) : Array of volumes
t (array) : Array of candle times
Returns: void
method setSessionHigh(vp, h)
Sets the high of the session the VP is tracking
Namespace types: VolumeProfile
Parameters:
vp (VolumeProfile)
h (float)
Returns: void
method setSessionLow(vp, l)
Sets the low of the session the VP is tracking
Namespace types: VolumeProfile
Parameters:
vp (VolumeProfile)
l (float)
Returns: void
method getPOC(vp)
Gets the current Point Of Control
Namespace types: VolumeProfile
Parameters:
vp (VolumeProfile)
Returns: Point Of Control (float)
method getVAH(vp)
Gets the current Value Area High
Namespace types: VolumeProfile
Parameters:
vp (VolumeProfile)
Returns: Value Area High (float)
method getVAL(vp)
Gets the current Value Area Low
Namespace types: VolumeProfile
Parameters:
vp (VolumeProfile)
Returns: Value Area Low (float)
VolumeProfile
Fields:
rowSizeInTicks (series float)
valueAreaCoverage (series int)
startTime (series int)
valueAreaHigh (series float)
pointOfControl (series float)
valueAreaLow (series float)
sessionHigh (series float)
sessionLow (series float)
volumeByRow (map)
totalVolume (series float)
pocRow (series float)
pocVol (series float)
Volumeprofiler
SessionVolumeProfileLibrary "SessionVolumeProfile"
Analyzes price & volume during regular trading hours to provide a session volume profile analysis. The primary goal of this library is to provide the developer with three values: the value area high, low and the point of control. The library also provides methods for rendering the value areas and histograms. To learn more about this library and how you can use it, click on the website link in my profile where you will find a blog post with detailed information.
debug(vp, position)
Helper function to write some information about the supplied SVP object to the screen in a table.
Parameters:
vp (Object) : The SVP object to debug
position (string) : The position.* to place the table. Defaults to position.bottom_center
getLowerTimeframe()
Depending on the timeframe of the chart, determines a lower timeframe to grab volume data from for the analysis
Returns: The timeframe string to fetch volume for
get(volumeProfile, lowerTimeframeHigh, lowerTimeframeLow, lowerTimeframeVolume)
Populated the provided SessionVolumeProfile object with vp data on the session.
Parameters:
volumeProfile (Object) : The SessionVolumeProfile object to populate
lowerTimeframeHigh (float ) : The lower timeframe high values
lowerTimeframeLow (float ) : The lower timeframe low values
lowerTimeframeVolume (float ) : The lower timeframe volume values
drawPriorValueAreas(todaySessionVolumeProfile, extendYesterdayOverToday, showLabels, labelSize, pocColor, pocStyle, pocWidth, vahlColor, vahlStyle, vahlWidth, vaColor)
Given a SessionVolumeProfile Object, will render the historical value areas for that object.
Parameters:
todaySessionVolumeProfile (Object) : The SessionVolumeProfile Object to draw
extendYesterdayOverToday (bool) : Defaults to true
showLabels (bool) : Defaults to true
labelSize (string) : Defaults to size.small
pocColor (color) : Defaults to #e500a4
pocStyle (string) : Defaults to line.style_solid
pocWidth (int) : Defaults to 1
vahlColor (color) : The color of the value area high/low lines. Defaults to #1592e6
vahlStyle (string) : The style of the value area high/low lines. Defaults to line.style_solid
vahlWidth (int) : The width of the value area high/low lines. Defaults to 1
vaColor (color) : The color of the value area background. Defaults to #00bbf911)
drawHistogram(volumeProfile, bgColor, showVolumeOnHistogram)
Given a SessionVolumeProfile object, will render the histogram for that object.
Parameters:
volumeProfile (Object) : The SessionVolumeProfile object to draw
bgColor (color) : The baseline color to use for the histogram. Defaults to #00bbf9
showVolumeOnHistogram (bool) : Show the volume amount on the histogram bars. Defaults to false.
Object
Fields:
numberOfRows (series__integer)
valueAreaCoverage (series__integer)
trackDevelopingVa (series__bool)
valueAreaHigh (series__float)
pointOfControl (series__float)
valueAreaLow (series__float)
startTime (series__integer)
endTime (series__integer)
dayHigh (series__float)
dayLow (series__float)
step (series__float)
pointOfControlLevel (series__integer)
valueAreaHighLevel (series__integer)
valueAreaLowLevel (series__integer)
volumeRows (array__float)
priceLevelRows (array__float)
ltfSessionHighs (array__float)
ltfSessionLows (array__float)
ltfSessionVols (array__float)