TDA TimeSegmentedValue, TimeSegmentedValueRatio Indicators
See original GitHub issueWhich version are you running? The lastest version is on Github. Pip is for major releases.
import pandas_ta as ta
print(ta.version)
0.3.14b0
Hi Kevin,
Do you think it is possible to create a couple of new indicators for me that I am currently using on TOS? Here is the thinkscript code for them. Thank you so much for your help.
### RelativeVolumeStDev: Also known as: Absolute Zscore of Volume. Does not need to be implemented, see example in comments below. - KJ
#
# TD Ameritrade IP Company, Inc. (c) 2014-2021
#
declare lower;
declare zerobase;
input length = 60;
input numDev = 2.0;
input allowNegativeValues = no;
def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
plot RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
plot StDevLevel = numDev;
RelVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
RelVol.SetLineWeight(3);
RelVol.DefineColor("Above", GetColor(0));
RelVol.DefineColor("Below", GetColor(2));
RelVol.AssignValueColor(if RelVol >= numDev then RelVol.Color("Above") else RelVol.Color("Below"));
StDevLevel.SetDefaultColor(GetColor(7));
StDevLevel.SetStyle(Curve.SHORT_DASH);
### Time Segmented Value
input length = 18;
input avgLength = 10;
#TSV=(Sum( IIf( C > Ref(C,-1), V * ( C-Ref(C,-1) ),
# IIf( C < Ref(C,-1),-V * ( C-Ref(C,-1) ), 0 ) ) ,18));
def TSV = sum( if close > close[1] then volume * (close - close[1]) else if close < close[1] then -1* volume *(close - close[1]) else 0, length);
#Plot TSVAvg = Average( TSV,2);
##TSVAvg.SetDefaultColor(Color.GREEN);
#TSVAvg.SetLineWeight(3);
#TSVAvg.AssignValueColor(color.blue);
#TSVAvg.SetStyle(Curve.MEDIUM_DASH);
##TSVAvg.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Plot TSVAvg2 = Average(TSV, avglength);
TSVAvg2.SetLineWeight(3);
TSVAvg2.AssignValueColor(color.yellow);
TSVAvg2.SetStyle(Curve.FIRM);
#TSVAvg2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
plot ZeroLine = 0;
ZeroLine.SetLineWeight(2);
ZeroLine.SetDefaultColor(Color.RED);
ZeroLine.SetStyle(Curve.SHORT_DASH);
plot TSV2 = TSV;
#TSV.SetDefaultColor(GetColor(1));
TSV2.SetLineWeight(1);
TSV2.AssignValueColor(if close > close[1] then color.green else color.red);
TSV2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
def tt = TSV / TSVAvg2;
#tt.SetLineWeight(3);
#tt.AssignValueColor(color.yellow);
#tt.SetStyle(Curve.SHORT_DASH);
AddLabel(yes, Round(tt, 2), if TSV > TSVAvg2 then if close > open then color.dark_green else color.yellow else color.white);
### Time Segmented Value Ratio:
input length = 18;
input avgLength = 10;
#TSV=(Sum( IIf( C > Ref(C,-1), V * ( C-Ref(C,-1) ),
# IIf( C < Ref(C,-1),-V * ( C-Ref(C,-1) ), 0 ) ) ,18));
def TSV = sum( if close > close[1] then volume * (close - close[1]) else if close < close[1] then -1* volume *(close - close[1]) else 0, length);
#Plot TSVAvg = Average( TSV,2);
##TSVAvg.SetDefaultColor(Color.GREEN);
#TSVAvg.SetLineWeight(3);
#TSVAvg.AssignValueColor(color.blue);
#TSVAvg.SetStyle(Curve.MEDIUM_DASH);
##TSVAvg.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
def TSVAvg2 = Average(TSV, avglength);
plot ZeroLine = 0;
ZeroLine.SetLineWeight(2);
ZeroLine.SetDefaultColor(Color.RED);
ZeroLine.SetStyle(Curve.MEDIUM_DASH);
#def TSV2 = TSV;
plot tt = TSV / TSVAvg2;
tt.SetLineWeight(3);
tt.AssignValueColor(color.yellow);
tt.SetStyle(Curve.SHORT_DASH);```
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Time Segmented Volume Definition - Investopedia
Time segmented volume (TSV) is a technical analysis indicator developed by Worden Brothers Inc. that segments a stock's price and volume by intervals....
Read more >Time Segmented Volume - TC2000 Help Site
A proprietary technical indicator developed by Worden Brothers, Inc. TSV is an oscillator, which is calculated by comparing various time segments of both...
Read more >Time Segmented Volume
A proprietary technical indicator developed by Worden Brothers, Inc. TSV is an oscillator, which is calculated by comparing various time segments of both...
Read more >TSV Time Segmented Volume - Indicators - ProRealTime
Time segmented volume (TSV) is a technical analysis indicator developed by Worden Brothers Inc. that segments a stock's price and volume ...
Read more >Enhanced Time Segmented Volume — Indicator by StephXAGs
Time Segmented Volume was developed by Worden Brothers, Inc to be a leading indicator by comparing various time segments of both price and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hhashim1,
Upon review of RelativeVolumeStDev source, it is essentially the zscore of volume input and therefore is no need to implement a separate indicator for this.
Kind Regards, KJ
Hey, count me in! I will download the development repo and start looking at the structure. In the meantime, I will also ask my friend.
By the way, I have already updated the code to use Polygon as a data source on top of AlphaAdvantage and Yahoo. My friend wrote a library for Polygon and I have used his as he makes it super easy. He is working on making his library the official Polygon library 😃
By the way, is it possible to have a Discord server for discussion and support? I think its much faster and you won’t be the one to be knee-deep in answering questions. You will have other members who can always chime in. You also have your collabs who can help.
Think about it. I am a member of a couple of other discord servers that are support systems for other libraries and it makes it much easier on the owner.
Let’s talk! Oh, you can email me directly. I emailed you last night so you can respond to my personal email.