VSA for ThinkorSwim - ThinkOrSwim Programming | futures io social day trading
futures io futures trading


VSA for ThinkorSwim
Updated: Views / Replies:169,976 / 429
Created: by cbritton Attachments:131

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 131  
 
Thread Tools Search this Thread
 

VSA for ThinkorSwim

  #391 (permalink)
Trading Apprentice
Oxnard California
 
Futures Experience: Intermediate
Platform: TOS
Favorite Futures: Gold
 
Hornblower's Avatar
 
Posts: 10 since Aug 2012
Thanks: 2 given, 20 received

VSA Green Arrow Scan for TOS

The below code is for finding stocks that provides the VSA Green Arrow indications in TOS Scan Hacker. This code must be entered as one of the criteria and as custom code. I also add criteria for price above 5 and volume above 300,000 shares for day. The nice thing about the code is that you can selectively use for monthly, weekly, daily, etc by changing the time period. This may affect the volume filter but I am not sure.


# Arguments

def volumeEMALength = 30;
def narrowSpreadFactor = 0.7;
def wideSpreadFactor = 1.5;
def aboveAvgVolfactor = 1.5;

#######
# Calculations

rec spread = high - low;
def median = (high + low ) / 2;
rec avgVolume = compoundValue(volumeEMALength, ExpAverage(volume,
volumeEMALength), Double.NaN);

# Calculate Volume moving average and it's standard deviation
rec sAvgVolume = compoundValue(volumeEMALength, Average(volume,
volumeEMALength), Double.NaN);
def sAvgVolumeSTD = stdev(sAvgVolume, volumeEMALength);

# check if the vloume has been decreasing in the past two days.
def isTwoDaysLowVol = (volume < volume[1] && volume[0] < volume[2]);

# Calculate Range information
def avgSpread = WildersAverage(spread, volumeEMALength)[0];
rec isWideSpreadBar = (spread > (wideSpreadFactor * avgSpread));
rec isNarrowSpreadBar = (spread < (narrowSpreadFactor * avgSpread));





# Check if the close is in the Highs/Lows/Middle of the bar.
# C_RP 20100809
# original code - def x1 = if (close == low) then avgSpread else (spread /(close - low));
def x1 = if (high == low) then 2.0 else if (close == low) then 2.65 else (spread /
(close - low));
# C_RP try the line below with various divisors totalSum result in a minimum of 2.3 on a spread of 1 pip instead of using a fixed 2.3 as in the line above
# def x1 = if (high==low) then 2.0 else if (close == low) then (spread / 0.43 ) else (spread / (close - low));

# Price information
rec isUpBar = close > close[1];
rec isDownBar = close < close[1];
def isUpCloseBar = (x1 < 2);
def isDownCloseBar = (x1 > 2);
def isMidCloseBar = (x1 < 2.2 && x1 > 1.8);
def isVeryHighCloseBar = (x1 < 1.35);
# C_RP 20100809 added isVeryLowCloseBar
def isVeryLowCloseBar = (x1 >= 2.65);


# Trend Definitions

rec fiveDaysSma = compoundValue(5, Average(close, 5)[0], Double.NaN);
def LongTermTrendSlope = LinearRegressionSlope(price = fiveDaysSma, length =
40)[0];
def ShortTermTrendSlope = LinearRegressionSlope(price = fiveDaysSma, length =
5)[0];
def MiddleTermTrendSlope = LinearRegressionSlope(price = fiveDaysSma, length =
15)[0];

# stdn, stdn0, stdn1, stdn2
def strengthInDownTrend = (volume[0] > volume[1] && isDownBar[1] && isUpBar[0]
&& (isUpCloseBar or isMidCloseBar) && ShortTermTrendSlope < 0 &&
MiddleTermTrendSlope < 0);

def strengthInDownTrend1 = (volume[0] > (sAvgVolume[0] * aboveAvgVolfactor) &&
isDownBar[1] && isUpBar[0] && (isUpCloseBar or isMidCloseBar) &&
ShortTermTrendSlope < 0 && MiddleTermTrendSlope < 0 && LongTermTrendSlope < 0);
def strengthInDownTrend2 = (volume[1] < sAvgVolume[0] && isUpBar[0] &&
isVeryHighCloseBar && volume[0] > sAvgVolume[0] && ShortTermTrendSlope < 0);


rec bycond1 = (strengthInDownTrend or strengthInDownTrend1);
# bycond


def isStrengthConfirmationBar = (isUpBar[0] && bycond1[1]);

# bycond2 C_RP UpClose on higher volume with all slopes down adds extra strength
def isStrengthConfirmationBar2 = (isUpBar[0] && isUpCloseBar[0] && volume[0] >
volume[1] && LongTermTrendSlope < 0 && bycond1[1]);


# Plot with green arrow

# green triangle up at bottom of the bar C_RP Green arrow up 4 * tickSize for strong strength_In_DownTrend
# plot isStrengthConfirmationBarPlot = if isStrengthConfirmationBar then (low - 5 * tickSize()) else if isStrengthConfirmationBar2 then (low - 9 * tickSize()) else Double.NAN;
plot isStrengthConfirmationBarPlot = (isStrengthConfirmationBar);
# green triangle up at bottom of the bar C_RP Green arrow up 7 * tickSize for strongest strength_In_DownTrend with isUpCloseBar
# plot isStrengthConfirmationBarPlot2 = if isStrengthConfirmationBar2 then (low - 9 * tickSize()) else Double.NAN;

Reply With Quote
The following 4 users say Thank You to Hornblower for this post:
 
  #392 (permalink)
Trading for Profit
Chicago + Illinois/USA
 
Futures Experience: Beginner
Platform: ThinkOrSwim
Favorite Futures: Stock
 
StockJock's Avatar
 
Posts: 256 since Aug 2010
Thanks: 15 given, 148 received


Hornblower View Post
The below code is for finding stocks that provides the VSA Green Arrow indications in TOS Scan Hacker. This code must be entered as one of the criteria and as custom code. I also add criteria for price above 5 and volume above 300,000 shares for day. The nice thing about the code is that you can selectively use for monthly, weekly, daily, etc by changing the time period. This may affect the volume filter but I am not sure.

Great code, Hornblower. How do you get the "rec" command to work in a ThinkScript custom quote? For a long time "rec" commands didn't work in ThinkScript custom quotes, they worked only in indicators and I've been looking for a way arround that or waiting for the TOS developers to change ThinkScript. Also, could you show me what part of your code is the reference indicator and which part is the custom quote? Thanks.

Reply With Quote
The following user says Thank You to StockJock for this post:
 
  #393 (permalink)
Trading Apprentice
jennings missouri america
 
Futures Experience: Beginner
Platform: tos
 
Posts: 24 since Sep 2010
Thanks: 5 given, 27 received


it could be that if a rec command doesn't reference itself then it is treated as a def command?

Reply With Quote
 
  #394 (permalink)
Trading Apprentice
Oxnard California
 
Futures Experience: Intermediate
Platform: TOS
Favorite Futures: Gold
 
Hornblower's Avatar
 
Posts: 10 since Aug 2012
Thanks: 2 given, 20 received

VSA Green Arrow Scan for TOS

The code originated from the TOS thinkscript from the latest Volume Spread Analysis code (VPAV1_09Study.ts) provided in this thread. I just extracted the code from that source that is necessary for scanning only for a green arrow and let the TOS scanner find those stocks meeting the criteria. Remember the code is limited to find those stocks that have a green arrow for that day but could be modified for green arrow for week, hour, etc by selecting the aggregate period. The default is the "D" (daily).

Early question on why the "rec" works is not important. All I know is that it works now when you paste the code into the custom box for scanning. If you get errors, just modify the code to make it work using thinkscript code. TOS may have also changed the rules in using "rec" since you previously utilized it. TOS also provides a wizard to aid "non-programmers" in building custom code.


Good Luck.

Reply With Quote
 
  #395 (permalink)
Elite Member
Prospect, KY. USA
 
Futures Experience: None
Platform: Sierra Chart
Broker/Data: Infinity
Favorite Futures: /CL
 
WilleeMac's Avatar
 
Posts: 684 since Jan 2012
Thanks: 301 given, 608 received

Regarding post 97 & 98

I took the links provided and compiled them into a word document

Hope this proves useful/ helpful

Regardless of time frame (these seem to be day) this applies to all timeframes - if I didn't suggest day you would no different than five (5) minute intraday

Think fractals

-Bill

Attached Files
Register to download File Type: doc VPA Logic and Setups2.doc (1.60 MB, 448 views)

Last edited by WilleeMac; April 5th, 2013 at 02:01 PM. Reason: CLARITY
Reply With Quote
 
  #396 (permalink)
Trading Apprentice
west palm beach
 
Futures Experience: Intermediate
Platform: tos
Favorite Futures: eur/usd
 
Posts: 2 since May 2012
Thanks: 0 given, 0 received

VSA

I am wondering where this thread migrated to, there was mention of bigmike's. How is the study being used? Why is it a video file and how to import to TOS?
Appreciate any information, thanks.

Reply With Quote
 
  #397 (permalink)
Elite Member
Prospect, KY. USA
 
Futures Experience: None
Platform: Sierra Chart
Broker/Data: Infinity
Favorite Futures: /CL
 
WilleeMac's Avatar
 
Posts: 684 since Jan 2012
Thanks: 301 given, 608 received

Windows thinks it's a video file because of the .ts extension

You can either manually cut and paste the code or use the TOS import function

If you use the import function it must have a .ts extension or TOS will not recognize it

-Bill_M

Reply With Quote
 
  #398 (permalink)
Trading Apprentice
jennings missouri america
 
Futures Experience: Beginner
Platform: tos
 
Posts: 24 since Sep 2010
Thanks: 5 given, 27 received


snowcloud View Post
After a few weeks work I have finished this round of changes to the study. Some of the changes are referenced in previous posts but many are not. One thing that bothered me about the original study was that the color scheme assigned to the symbols seemed to make no sense at all. (By reading a NinjaTrader thread on the original code I discovered that the programmer himself was less than satisified with the color scheme). I changed it using the ROYGBIV color spectrum as a model. I also added UpArrow and DownArrow symbols to indicate the strongest indications. The legend and a brief explanation is pasted below.

I was also bothered by the fact that candles identified as UpThrusts often don't look anything like traditional UpThrusts. However, in most cases the Red Squares, Triangles, and DownArrows attached to those candles seem to work pretty well as indications of an impending downtrend. Because they seem to work pretty well as indicators I decided not to change the underlying code, at least until I have a clearer picture of why they work but don't look like UpThrusts. I'm still watching them.

Another thing I noticed is that often times a group of two or three candles that don't contain an UpThrust identification individually would be considered an UpThrust if taken together. So, I added Two Period and Three Period UpThrust indicators. I just did this today so I'm still evaluating their effectiveness.

I'm very interested in hearing what works, what doesn't work, and what other traders think of this study so please post comments, criticisms, etc. here. I won't have much time to devote to tweaking the code in the next few weeks or months because of other projects I am working on, but I'm still very interested in hearing comments about the study.

Btw, I use this study mostly on 2-minute candles, but am also watching it on 5 and 15-minute candles. I've attached an image of a chart from this morning which shows, among other things, two really good examples of various kinds of UpThrusts (Red Square, Triangle, and DownArrow; Magenta Three Period UpThrust) indicating impending downtrends. It also shows two good examples of Stopping Volume (Green Circle) after the first downtrend of the second test of highs at around 7:00 and at the end of the longer-term downtrend at about 8:00.

And finally, I don't know why the original code for NinjaTrader is called VPA (Volume Price Analysis) instead of VSA but I just kept the acronym in the filename for consistency's sake.

Legend from the study Comments:
# This is a conversion of the NinjaTrader VPA indicator. ToS does not support directional
# triangles and diamonds, so there are some differences. The triangles are left as is, just
# not pointing a specific direction. The diamonds have been replaced with circles.

# C_RP Original notes by cbritton are above. Changes made after 20100722 by Richard Paske are marked below by the C_RP comment tag. A few bugs were fixed. More significantly, the color scheme for symbols was changed radically in an attempt to map directional strength to hue based on the ROYGBIV color spectrum. In addition, a symbol's shape and its vertical position above or below a candle now imparts added meaning to it. In general, the strength of a symbol is assigned by its color and shape in that order. In certain circumstances a symbol's vertical offset from its candle's top or bottom strengthens the symbol's meaning. The symbol strength hierarchy is defined as follows:

# 1. Color: Symbols below candles are assigned strength from weakest to strongest in this order: white (or grey), cyan (blue/green), green. A red symbol under a candle indicates the failure of the symbol attached below the candle immediately preceding it.
# Symbols above candles are assigned strength from weakest to strongest in this order: yellow, orange, red. A green symbol above a candle indicates the failure of a symbol attached above the candle immediately preceding it. A magenta (pinkish purple) square above a candle is a special case indicating Distribution. Another special case for testing purposes as of 20100830 is a white triangle high above a candle indicating a Gravestone Doji.
# Symbols drawn on the middle of a candle are of two types with one variation. A green circle indicates Effort to Move Up on up bars. A magenta (pinkish purple) circle indicates Effort to Move Down on down bars except for red down bars on which magenta displays poorly. In order to be seen easily, yellow circles indicate Effort to Move Down on red down bars.

# 2. Shape: A symbol of a given color is assigned increasing strength according to this hierarchy (from low to high): circle, square, triangle, downward or upward arrow. In certain circumstances two symbols of the same shape and color will be stacked vertically, adding strength through the combined symbols. Occasionally, two different symbols will be stacked vertically because that candle satisfies the criteria for two indications.

# Listed below are the symbols and their meanings.



# ___Symbols in the Middle of Candles___
# Green Circle - Effort to Move Up
# Magenta Circle - Effort to Move Down
# Yellow Circle - Effort to Move Down on Red Down Candles

is there a reason why you would not want to know of a move up on green up candles? or is that called something else?

tia
tony


Last edited by tonylipton; July 26th, 2013 at 07:54 AM. Reason: clarity
Reply With Quote
 
  #399 (permalink)
Trading Apprentice
Frankfurt
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 6 since Sep 2012
Thanks: 2 given, 0 received

Hi guys, great code to scan for arrows!

Reply With Quote
 
  #400 (permalink)
Trading Apprentice
Frankfurt
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 6 since Sep 2012
Thanks: 2 given, 0 received


I have a question:

Can the code below be turned around, so we can scan for the red arrows?


Many thanks
Jonas

Reply With Quote

Reply



futures io > > > > > VSA for ThinkorSwim

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Volume Spread Analysis (VSA) slumlord Traders Hideout 57 December 6th, 2017 01:19 AM
VSA indicator for MT4 sam1197 MetaTrader 12 December 21st, 2015 08:15 PM
VSA alexav Russian Traders 5 December 17th, 2012 05:03 AM
VSA in MC? TonyB MultiCharts 10 May 28th, 2011 11:37 AM


All times are GMT -4. The time now is 07:12 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-18 in 0.16 seconds with 20 queries on phoenix via your IP 54.163.209.109