Generated with sparks and insights from 8 sources
Introduction
-
To get the ask volume in Thinkscript, you can use the
[tick_count](prompt://ask_markdown?question=tick_count)
function with the[PriceType.ASK](prompt://ask_markdown?question=PriceType.ASK)
parameter. -
The
tick_count
function returns the number of ticks (trades) for a specified price type within a given aggregation period. -
You can specify the aggregation period using constants like
[AggregationPeriod.MIN](prompt://ask_markdown?question=AggregationPeriod.MIN)
,[AggregationPeriod.TWO_MIN](prompt://ask_markdown?question=AggregationPeriod.TWO_MIN)
, etc. -
For example, to get the ask volume for a 15-minute period, you can use the following code:
def ASK = tick_count(priceType = PriceType.ASK, period = [AggregationPeriod.FIFTEEN_MIN](prompt://ask_markdown?question=AggregationPeriod.FIFTEEN_MIN));
-
This function works well on time-based charts but may not be effective on tick charts due to data limitations.
-
You can plot the ask volume using the
plot
function and customize the appearance with[SetLineWeight](prompt://ask_markdown?question=SetLineWeight)
and[AssignValueColor](prompt://ask_markdown?question=AssignValueColor)
.
Tick Count Function [1]
-
Function:
tick_count
is used to count the number of ticks (trades) for a specified price type. -
Parameters: It accepts
priceType
andperiod
as parameters. -
Price Types: Valid price types include
ASK
,BID
,LAST
, andMARK
. -
Usage: Commonly used in custom quotes, study alerts, and conditional orders.
-
Example:
def ASK = tick_count(priceType = PriceType.ASK, period = AggregationPeriod.FIFTEEN_MIN);
Aggregation Periods [2]
-
Definition: Aggregation periods define the time frame for which data is aggregated.
-
Constants: Use constants like
AggregationPeriod.MIN
,AggregationPeriod.TWO_MIN
, etc. -
Pre-defined Values: String values like
Day
,Week
,Month
can also be used. -
Example:
def ASK = tick_count(priceType = PriceType.ASK, period = AggregationPeriod.FIFTEEN_MIN);
-
Limitations: For non-Forex symbols, certain price types are only supported on intraday charts with a time interval not greater than 15 days.
Example Code [3]
-
Basic Example:
def ASK = tick_count(priceType = PriceType.ASK, period = AggregationPeriod.FIFTEEN_MIN);
-
Plotting: Use
plot
to visualize the data, e.g.,plot a = ASK;
-
Customization: Adjust line weight with
SetLineWeight
and colors withAssignValueColor
. -
Sanity Check: Add labels for debugging, e.g.,
addLabel(yes, concat("Ask Volume: ", ASK));
-
Advanced Example: Combine with other indicators for more complex studies.
Limitations [3]
-
Tick Charts:
tick_count
may not work effectively on tick charts due to data limitations. -
Equities: May not work well with equities if there is insufficient data.
-
Time Input: The function requires a time input, which limits its use on non-time-based charts.
-
Data Delay: There may be delays in data, especially for Level 2 data.
-
Workarounds: Use time-based charts and ensure sufficient data for accurate results.
Customization [3]
-
Line Weight: Adjust using
SetLineWeight
, e.g.,a.SetLineWeight(5);
-
Colors: Use
AssignValueColor
to set colors based on conditions. -
Labels: Add labels for additional information, e.g.,
addLabel(yes, concat("Ask Volume: ", ASK));
-
Histograms: Use
SetPaintingStrategy(PaintingStrategy.HISTOGRAM)
for histogram plots. -
Combining Indicators: Combine with other indicators for more comprehensive analysis.
Related Videos
<br><br>
<div class="-md-ext-youtube-widget"> { "title": "Thinkorswim Bid-Ask Spread Label + Lines Indicator - Settings ...", "link": "https://www.youtube.com/watch?v=2Gd85S2a_xM", "channel": { "name": ""}, "published_date": "Nov 21, 2019", "length": "" }</div>
<div class="-md-ext-youtube-widget"> { "title": "Custom Thinkorswim Volume Indicator EVERY Trader Needs ...", "link": "https://www.youtube.com/watch?v=l7JIXig608E", "channel": { "name": ""}, "published_date": "Jul 5, 2020", "length": "" }</div>
<div class="-md-ext-youtube-widget"> { "title": "Ultimate Volume Indicator Study for ThinkOrSwim to Improve ...", "link": "https://www.youtube.com/watch?v=h4CSgFH4R5s", "channel": { "name": ""}, "published_date": "Apr 8, 2022", "length": "" }</div>