Price Volume Anomoly by Anna Coulling for ThinkorSwim

Afghan1

New member
Has anyone ever tried creating the script by infamous Anna coulling?

Simply put it utilizes capitulations and only spits out hidden buyers and sellers. few diff variables but when price action is tanking and big volume bar comes in to stop it (hidden buyer etc).

Have been hunting for this code for ages, it does exist have seen few guys at hedge fund use it. would love to know if anyone else has it. the overall objective of script would be to find hidden seller, it just reduces some eye strain from looking at tape.

http://prntscr.com/pm17vu
 
Last edited by a moderator:
Try the one below. Adapt as you see fit.

Code:
input OpenTime = 0945;
input CloseTime = 1555;

def active = if SecondsFromTime(OpenTime) >= 0 and
                SecondsTillTime(CloseTime) > 0
                then active[1] + 1
                else 0;

def anomaly1 = if active then (close >= close [1]) and (close[1]>close[2])and (close[2]>close[3])and (close[3]>close[4])and volume > (volume[1]*1.33) else Double.NaN;

def anomaly2 =if active then (close <= close [1]) and (close[1]<close[2])and (close[2]<close[3])and (close[3]>close[4]) and volume > (volume[1]*1.33) else Double.NaN;

plot H = if anomaly1 > 0 then high else Double.NaN;

plot L = if anomaly2 > 0 then low else Double.NaN;

H.SetStyle(Curve.POINTS);
H.SetDefaultColor(Color.red);

L.SetStyle(Curve.POINTS);
L.SetDefaultColor(Color.white);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@guga while I have not seen any prior studies regarding Anna Couling, I have optimized the logic based on your script using a bunch of boolean constructs. Hope this is helpful

Code:
input OpenTime = 0945;
input CloseTime = 1555;

def active = SecondsFromTime(OpenTime) >= 0 and SecondsTillTime(CloseTime) > 0;
def anomaly1 = active and sum(close > close[1], 5) >= 5 and volume > (volume[1] * 1.33);
def anomaly2 = active and sum(close < close[1], 5) >= 5 and volume > (volume[1] * 1.33);

plot H = if anomaly1 then high else Double.NaN;
plot L = if anomaly2 then low else Double.NaN;

H.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
H.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
H.SetDefaultColor(Color.CYAN);
L.SetDefaultColor(Color.YELLOW);
H.SetLineWeight(3);
L.SetLineWeight(3);
 
Doing some testing today using this indicator on the 5min timeframe and i can definitely see usefulness in this indicator to find hidden buyers/sellers. Very good stuff 👍 Thanks @guga for the code.

Btw, is it possible to add audio alerts as well for the signals?
 
Last edited:
@zeek per your request here is the study with alerts for both conditions added in

input OpenTime = 0945;
input CloseTime = 1555;

def active = SecondsFromTime(OpenTime) >= 0 and SecondsTillTime(CloseTime) > 0;
def anomaly1 = active and sum(close > close[1], 5) >= 5 and volume > (volume[1] * 1.33);
def anomaly2 = active and sum(close < close[1], 5) >= 5 and volume > (volume[1] * 1.33);

plot H = if anomaly1 then high else Double.NaN;
plot L = if anomaly2 then low else Double.NaN;

H.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
H.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
H.SetDefaultColor(Color.CYAN);
L.SetDefaultColor(Color.YELLOW);
H.SetLineWeight(3);
L.SetLineWeight(3);

# Alerts
Alert(anomaly1, "Price Volume Anomaly - High", Alert.BAR, Sound.RING);
Alert(anomaly2, "Price Volume Anomaly - Low", Alert.BAR, Sound.DING);
 
I have updated the code to fine tune it to pick anomalies on 5-min charts. So far it works very well in pick reversals spots. Let me know what you guys find out.
Also, I'm told that TOS scanning is delays by around 3-min, is this true? if yes, does anyone know if it's possible to improve it? Thanks

Code:
input OpenTime = 0945;
input CloseTime = 1555;



def active = if SecondsFromTime(OpenTime) >= 0 and
                SecondsTillTime(CloseTime) > 0
                then active[1] + 1
                else 0;

def anomaly1 = if active then (close < hl2) and (close > open) and volume > (volume[1]*1.5) else Double.NaN;

def anomaly2 =if active then (close > hl2)and (close < open)and volume > (volume[1]*1.5) else Double.NaN;

plot H = if anomaly1 > 0 then high else Double.NaN;

plot L = if anomaly2 > 0 then low else Double.NaN;



H.SetStyle(Curve.POINTS);
H.SetDefaultColor(Color.red);

L.SetStyle(Curve.POINTS);
L.SetDefaultColor(Color.white);

# Alerts
Alert(anomaly1, "Price Volume Anomaly - High", Alert.BAR, Sound.RING);
Alert(anomaly2, "Price Volume Anomaly - Low", Alert.BAR, Sound.DING);
 
I have updated the code to fine tune it to pick anomalies on 5-min charts. So far it works very well in pick reversals spots. Let me know what you guys find out.
Also, I'm told that TOS scanning is delays by around 3-min, is this true? if yes, does anyone know if it's possible to improve it? Thanks

Code:
input OpenTime = 0945;
input CloseTime = 1555;



def active = if SecondsFromTime(OpenTime) >= 0 and
                SecondsTillTime(CloseTime) > 0
                then active[1] + 1
                else 0;

def anomaly1 = if active then (close < hl2) and (close > open) and volume > (volume[1]*1.5) else Double.NaN;

def anomaly2 =if active then (close > hl2)and (close < open)and volume > (volume[1]*1.5) else Double.NaN;

plot H = if anomaly1 > 0 then high else Double.NaN;

plot L = if anomaly2 > 0 then low else Double.NaN;



H.SetStyle(Curve.POINTS);
H.SetDefaultColor(Color.red);

L.SetStyle(Curve.POINTS);
L.SetDefaultColor(Color.white);

# Alerts
Alert(anomaly1, "Price Volume Anomaly - High", Alert.BAR, Sound.RING);
Alert(anomaly2, "Price Volume Anomaly - Low", Alert.BAR, Sound.DING);

@guga Just a minor point in your revised code, the variable "active" is intended to flag a bracketed time period.
It is a boolean expression which evaluates to true or false. Hence you don't need to increment the variable.

Code:
def active = if SecondsFromTime(OpenTime) >= 0 and
                SecondsTillTime(CloseTime) > 0
                then active[1] + 1
                else 0;

Just use the definition of "active" I gave you earlier.
 
@guga Just a minor point in your revised code, the variable "active" is intended to flag a bracketed time period.
It is a boolean expression which evaluates to true or false. Hence you don't need to increment the variable.

Code:
def active = if SecondsFromTime(OpenTime) >= 0 and
                SecondsTillTime(CloseTime) > 0
                then active[1] + 1
                else 0;

Just use the definition of "active" I gave you earlier.
Hi Tom - sorry, but i didn't quite get what you meant by using the 'active' definition...
 
You want your condition to trigger only between the hours from 0945 - 1555
The way to do this is via the variable "active" which should evaluate to either true or false
True = 1, false = 0
Hence no need to increment the value of "active" like in your case.
 
@zeek per your request here is the study with alerts for both conditions added in

input OpenTime = 0945;
input CloseTime = 1555;

def active = SecondsFromTime(OpenTime) >= 0 and SecondsTillTime(CloseTime) > 0;
def anomaly1 = active and sum(close > close[1], 5) >= 5 and volume > (volume[1] * 1.33);
def anomaly2 = active and sum(close < close[1], 5) >= 5 and volume > (volume[1] * 1.33);

plot H = if anomaly1 then high else Double.NaN;
plot L = if anomaly2 then low else Double.NaN;

H.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
H.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
H.SetDefaultColor(Color.CYAN);
L.SetDefaultColor(Color.YELLOW);
H.SetLineWeight(3);
L.SetLineWeight(3);

# Alerts
Alert(anomaly1, "Price Volume Anomaly - High", Alert.BAR, Sound.RING);
Alert(anomaly2, "Price Volume Anomaly - Low", Alert.BAR, Sound.DING);
H.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

Shoudn't this one be
L.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
 
Now i am confused, is the updated code from @guga in post #9 the correct one or should i continue to use the older one?

@zeek it all really depends on what you're looking for. Here is the section of code I modified

def active = SecondsFromTime(OpenTime) >= 0 and SecondsTillTime(CloseTime) > 0;
def anomaly1 = active and sum(close > close[1], 5) >= 5 and volume > (volume[1] * 1.33);
def anomaly2 = active and sum(close < close[1], 5) >= 5 and volume > (volume[1] * 1.33);

Anomaly1 essentially is looking for a 33% increase in volume with 5 preceding bullish closes while anomaly2 just addresses the similar condition for the bearish case. At the end of the day it depends on what you're looking for. It's all math and logic.
 
Basically this either looks for either of the following conditions

5 consecutive GREEN candles and volume of the current bar exceeds the previous volume by 33%
5 consecutive RED candles and volume of the current bar exceeds the previous volume by 33%
 
good job @guga & @tomsk How do i set it up, so its good for 3 mins?

Code:
input OpenTime = 0945;
input CloseTime = 1555;

def active = if SecondsFromTime(OpenTime) >= 0 and
                SecondsTillTime(CloseTime) > 0
                then active[1] + 1
                else 0;

def anomaly1 = if active then (close < hl2) and (close > open) and volume > (volume[1]*1.5) else Double.NaN;

def anomaly2 =if active then (close > hl2)and (close < open)and volume > (volume[1]*1.5) else Double.NaN;

plot H = if anomaly1 > 0 then high else Double.NaN;

plot L = if anomaly2 > 0 then low else Double.NaN;

H.SetStyle(Curve.POINTS);
H.SetDefaultColor(Color.red);

L.SetStyle(Curve.POINTS);
L.SetDefaultColor(Color.white);

# Alerts
Alert(anomaly1, "Price Volume Anomaly - High", Alert.BAR, Sound.RING);
Alert(anomaly2, "Price Volume Anomaly - Low", Alert.BAR, Sound.DING);
 
input OpenTime = 0945; input CloseTime = 1555; def active = if SecondsFromTime(OpenTime) >= 0 and SecondsTillTime(CloseTime) > 0 then active[1] + 1 else 0; def anomaly1 = if active then (close < hl2) and (close > open) and volume > (volume[1]*1.5) else Double.NaN; def anomaly2 =if active then (close > hl2)and (close < open)and volume > (volume[1]*1.5) else Double.NaN; plot H = if anomaly1 > 0 then high else Double.NaN; plot L = if anomaly2 > 0 then low else Double.NaN; H.SetStyle(Curve.POINTS); H.SetDefaultColor(Color.red); L.SetStyle(Curve.POINTS); L.SetDefaultColor(Color.white); # Alerts Alert(anomaly1, "Price Volume Anomaly - High", Alert.BAR, Sound.RING); Alert(anomaly2, "Price Volume Anomaly - Low", Alert.BAR, Sound.DING);
beautifully done, is there a way to reduce the number of false positive? would be cool to let users pick through input.

i edited the the 1.5 to 1.8 in both situations. any other thing that could be changed?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
291 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top