NexusFi: Find Your Edge


Home Menu

 





VSA for ThinkorSwim


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one snowcloud with 93 posts (25 thanks)
    2. looks_two StockJock with 91 posts (27 thanks)
    3. looks_3 cbritton with 37 posts (71 thanks)
    4. looks_4 swimtrader with 22 posts (19 thanks)
      Best Posters
    1. looks_one Hornblower with 2.3 thanks per post
    2. looks_two cbritton with 1.9 thanks per post
    3. looks_3 StockJock with 0.3 thanks per post
    4. looks_4 snowcloud with 0.3 thanks per post
    1. trending_up 304,671 views
    2. thumb_up 223 thanks given
    3. group 86 followers
    1. forum 434 posts
    2. attach_file 131 attachments




 
Search this Thread

VSA for ThinkorSwim

  #411 (permalink)
 Haggerstone8 
London, UK
 
Experience: Intermediate
Platform: TOS
Trading: stocks
Posts: 5 since Mar 2013
Thanks Given: 3
Thanks Received: 0


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.


# 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;

Thanks for the green arrow scan hornblower - works great. i added the scan to my watchlists, also added a label and assignbackground color.

def cond1 = isStrengthConfirmationBarPlot >0;
addLabel (cond1, "^", Color.BLUE);

assignbackgroundcolor(if cond1>0 then color.green else color.black);

Is it a lot of work for you to extract the code (from VPA1_09) for red down arrows? I'll have a try and see how far I can get. Thanks

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
Are there any eval firms that allow you to sink to your …
Traders Hideout
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
 
  #412 (permalink)
 Haggerstone8 
London, UK
 
Experience: Intermediate
Platform: TOS
Trading: stocks
Posts: 5 since Mar 2013
Thanks Given: 3
Thanks Received: 0

Here's the code for Red DownArrow, seems to be working. But it's messy I'll try to clean up later.
I tested it with Russell 2000 and 1000.


# 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];



# utbar

#rec isWideSpreadBar = (spread > (wideSpreadFactor * avgSpread));

#def MiddleTermTrendSlope = LinearRegressionSlope(price = fiveDaysSma, length = midTermLength)[0]; # 15

rec isUpThrustBar = isWideSpreadBar && isDownCloseBar && ShortTermTrendSlope > 0 && middleTermTrendSlope > 0; #C_RP added positive middleTermTrendSlope requirement to filter out upThrusts in trends that are only short term. Consider adding longTermTrendSlope requirement as well.

# utcond1

def upThrustConditionOne = (isUpThrustBar[1] && isDownBar);


# utcond2

def upThrustConditionTwo = (isUpThrustBar[1] && isDownBar[0] && volume > volume[1]);

# utcond3

def upThrustConditionThree = (isUpThrustBar[0] && volume > 2 * sAvgVolume[0]);

# scond1

rec isConfirmedUpThrustBar = (upThrustConditionOne OR upThrustConditionTwo OR upThrustConditionThree);

# scond

rec isNewConfirmedUpThrustBar = (isConfirmedUpThrustBar[0] && !isConfirmedUpThrustBar[1]);


#Plot with Red Down Arrow

# new confirmed upthrust bar - red triangle (down) on top C_RP red arrow down at 4 * tickSize for conditions 2 and 3

plot isNewConfirmedUpThrustBarPlot23 = if isNewConfirmedUpThrustBar && (upThrustConditionTwo or upThrustConditionThree) then (high + 4 * tickSize()) else Double.NAN;

isNewConfirmedUpThrustBarPlot23.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

isNewConfirmedUpThrustBarPlot23.SetDefaultColor(Color.Red);

isNewConfirmedUpThrustBarPlot23.HideBubble();

isNewConfirmedUpThrustBarPlot23.HideTitle();

Reply With Quote
  #413 (permalink)
 
WilleeMac's Avatar
 WilleeMac 
Prospect, KY. USA
 
Experience: None
Platform: Sierra Chart
Broker: Infinity
Trading: /CL
Posts: 687 since Jan 2012
Thanks Given: 309
Thanks Received: 617


@StockJock

That VSA excel spreadsheet you're referencing can be found (not sure if you already know) over at thinkscripter dot com

Pro Member, Door Number Three, Building a Better Volume Spread Analysis

First three or four pages of the thread

After that it meanders off to here and there, then comes back into focus (SwimTrader does a damn good job)

There's a plethora of info in that thread

I've a few contributions/ additions towards the end (here2learn)

Hope this helps

Keep the rubber side down

-Bill_M

Follow me on Twitter Reply With Quote
  #414 (permalink)
 
WilleeMac's Avatar
 WilleeMac 
Prospect, KY. USA
 
Experience: None
Platform: Sierra Chart
Broker: Infinity
Trading: /CL
Posts: 687 since Jan 2012
Thanks Given: 309
Thanks Received: 617

Here's a screenshot I took earlier this morning

The strategy behind this is you bracket up or down spike bars with the ToS fib tool (my usual pull is either low to high or high to low, 100, to 0 with levels of .67, .5 and .33)

So let's say we bracket a bar w/ open 6300 and close of 6330, the levels would be 6300, 6310, 6315, 6320 and 6330.

The idea behind this is to play those levels for long or short with emphasis on 50% or 33% ie it's staying in the upper or lower range of the spike bar (nothing novel or fancy, I think I might have originally got this from Al Brooks or?)

I'm not in this for the long haul, one contract (low risk reward) 4-5-6 ticks here and there - adds up quickly

/CL M1 12-9-14

Pull on the first spike up bar is 6322 to 6333, 50% 6328
Pull on the second spike up bar is 6341 to 6354, 50% is 6347

Leaving the long pull up on both bars (50% is 50%) the 6347 went resistance and the 6322 gave us an area where price reacted, resumed north

I'm not cherry picking these charts (pull up you own chart, software not needed) go over to the thread I started over at thinkscripter dot com

-Bill_M




EDIT

Here's a better screenshot of the above (the only diff is now I'm testing fib pull with .75 and .25 vs .67 and .33)


Follow me on Twitter Reply With Quote
  #415 (permalink)
 
WilleeMac's Avatar
 WilleeMac 
Prospect, KY. USA
 
Experience: None
Platform: Sierra Chart
Broker: Infinity
Trading: /CL
Posts: 687 since Jan 2012
Thanks Given: 309
Thanks Received: 617

/CLF5 12-10-14 M1




Study = VSA_Lite with Lookback 89, Standard Deviation Moves 1.985, -1.985

-Bill_M

Follow me on Twitter Reply With Quote
  #416 (permalink)
 
WilleeMac's Avatar
 WilleeMac 
Prospect, KY. USA
 
Experience: None
Platform: Sierra Chart
Broker: Infinity
Trading: /CL
Posts: 687 since Jan 2012
Thanks Given: 309
Thanks Received: 617

Today M1, two red dots are 10000amET




-Bill

Follow me on Twitter Reply With Quote
  #417 (permalink)
 
WilleeMac's Avatar
 WilleeMac 
Prospect, KY. USA
 
Experience: None
Platform: Sierra Chart
Broker: Infinity
Trading: /CL
Posts: 687 since Jan 2012
Thanks Given: 309
Thanks Received: 617




Wow

-Bill

Follow me on Twitter Reply With Quote
  #418 (permalink)
 
WilleeMac's Avatar
 WilleeMac 
Prospect, KY. USA
 
Experience: None
Platform: Sierra Chart
Broker: Infinity
Trading: /CL
Posts: 687 since Jan 2012
Thanks Given: 309
Thanks Received: 617

Per the previous screen shots and below screenshot

The gray bars are normal spread/ volume, nothing taking place out of the ordinary: however one caveat - they are based on the look back period. Technically the bar(s) could be a wide spread or narrow spread on volume other than low volume etc (from experience this is not bad)

The yellow bars are low volume bars - I've added to the study to have them show as low volume if the volume on that bar is less than .30 volume of the bars in the look back period. I f you increase this factor (it can be set by the operator) then you would have less gray bars and more yellow bars.

The blue bars are churn bars - especially noticeable at the pit close (in conjunction w/ watching the DOM)

The cyan and magenta spike bars are exactly that. Keep in mind the volume on those bars is relative to what has happened in the look back period as well they are also based on a +/- 1.985 standard deviation move

An interesting thing concerning the spike bars - they can represent where they either hit the bid or lifted the offer

-Bill


Follow me on Twitter Reply With Quote
  #419 (permalink)
 
WilleeMac's Avatar
 WilleeMac 
Prospect, KY. USA
 
Experience: None
Platform: Sierra Chart
Broker: Infinity
Trading: /CL
Posts: 687 since Jan 2012
Thanks Given: 309
Thanks Received: 617

I'm going to re-post a post I posted at thinkscripter dot com




When you see this at a high or reverse at a low, it's in your best interest to take note

However if a genius to hold /CL over many moons never mind

-Bill

PS

I have yet to see any of the ToS VSA study's posted here so far to be this robust

Curious

Follow me on Twitter Reply With Quote
  #420 (permalink)
satanscashcow
Kansas City, MO USA
 
Posts: 8 since Jul 2014
Thanks Given: 0
Thanks Received: 5


I don't have time to read back through all of these posts to see if this has been mentioned, but you can scan for "Effort to move UP" in TOS Stock Hacker. Use with Fibonacci retracements or Ambush Fibonacci and you will see a lot of these on the 1hr charts pushing through those levels. Use with TOS RelativeVolumeStDev for confirmation. To reduce noise I have unchecked the "show plot" for all plots except: Effort to move up, Effort to move down,Two/Three per, and Weakness... I feel these are the most significant and most prevalent. Also look for confirmation of a signal across multiple time frames. I see "Weakness" on the 133tick and 1m chart side by side quite often near a top with "Effort to move up" close behind. Multiple "Effort to move down" bars followed by an "Effort to move up" on 5m. I will post some screen shots when I get the time and make my post count.

Reply With Quote




Last Updated on May 21, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts