Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

AFL Library

This is read-only version of AFL library entry. Ability to add user formulas and comment is only available from members-only area.


Formula name: Time segment value
Author/Uploader: ntk98 - ntk98_2000 [at] yahoo.co.uk
Date/Time added: 2004-05-22 17:34:18
Keywords: AFL
Level: basic
Flags: indicator

DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users and are provided here on an "as is" and "as available" basis. AmiBroker.com makes no representations or warranties of any kind to the contents or the operation of material presented here. We do not maintain nor provide technical support for 3rd party formulas. If you believe that formula has an error - contact the AUTHOR directly, not us. If you believe that you have copyright on that work (i.e. you have written this particular code yourself) please send us proper DMCA takedown notice. Please note that mathematical ideas/concepts can not be copyrighted, only actual AFL code if you wrote it yourself.


TJ has helped me translate the metastock formula of TSV(Time segment value) into AB language.

I thought I should share this formulas with other. This indicator uses volume and price, like OBV, but seems to be more reliable indicator then OBV.

In courtesy of The Wordens brothers I like to post the link for study on purpose and usage of this indicator.


// Time segment value

TSV=(Sum( IIf( C > Ref(C,-1), V * ( C-Ref(C,-1) ),
IIf( C < Ref(C,-1),-V * ( C-Ref(C,-1) ), 0 ) ) ,18));



Angelo Caminiti
a.caminiti [at] comcast.net
2004-05-30 13:05:49
I believe it is called Time Segmented Volume :)
Thanks for sharing.
nkishor [at] telus.net
2004-07-08 15:01:09
My plots never go below the ZERO line. Perhaps there is something missing.
bobg8993 [at] bellsouth.net
2004-09-06 20:24:59
this is not the Worden Brothers TSV indicator. the TSV veries above and below zero and never has the extream this has. This goes counter at meny times to the TVS. Also the Worden TVS has an option to use Simple or Exponential Moving Average Calculations which this has not MA at all.

2004-09-07 20:55:25
Sorry that you find that is not the Worden Brothers TSI. The meta formula came directly from meta fomula web page TC2000 webpage and the link I also provide. I did find few comments people over there on the WB board saying the formula was incorrect. I did not tell TJ, but TJ actually found the fault out himself. What TJ did is correct the fault (similar position as it was proposed on the other board as well), and translate in AB language. If you have the correct version of WB TSI indicator could please put the formular here?

The main thing is how do you win information when you apply the indicator on your stock? Does it give correctly signal, too many wrong signals, or no signal at all? I use this on small cap, mid cap, and I think it works quite well. I chart ths TSI and the EMA(TSI,20) look for cross over and under. This give me well in advance that trend is about to turn, I always use a time frame for example how many indications, and which type of indicator turns up in the last 2 days, until the signal is confirmed then the TSI is only then valid as member of an indicator group ummm you would call as such. Possibly that why I am not against the pitchextream ...

On the other hand, I would bring into discussion how would WB like to take close price and volume, both are positive units, and make them oscillate above and under the zero line, what information would it bring extra if moving into negative area? is it oversold/overbought infos like oscillator does?

2004-09-07 20:58:26
sorry the comment above is about quasi Worden Brothers TSV (Time segment volume) I misspell it to TSI

2004-09-07 21:17:46
sorry the comment above is about quasi Worden Brothers TSV (Time segment volume) I misspell it to TSI

2007-02-19 17:32:19
Nand's comment of 2004-07-08 states that plots never go below the zero line. This is correct, and I believe is in the logic of the formula; that is, IIf <condition> negative volume is multiplied by negative price <close - previous close> and gives a positive; Sum will always be positive.

I've changed the formula:
1. to adjust for the above logic, changing negative volume to volume.
2. Shortened the period to 13 ( just testing my own preference).
3. Added a (Simple) moving average and label. Adjust to your own preferences.
4. Bracketed some of the logic, though it may not be necessary, I found that following the logic was easier.

_SECTION_BEGIN(" Time Segmented Volume ");

t=(Sum(IIf( C>Ref(C,-1), (V*(C-Ref(C,-1))),IIf(C<Ref(C,-1),(V*(C-Ref(C,-1))),0)),13));
m=MA(t ,7 );
Plot(t, "Time Segmented Volume 13", colorRed);
Plot(m, " Simple Moving Average 7" , colorYellow);


The code is by no means elegant, but it produces output that is more consistent with other indicators. I'm new to this so comment / critique is appreciated.

ntk98 - thanks for the original code!

s_ogodo [at] hotmail.com
2008-01-25 00:42:19
To JP:
what's the difference it make if you just wrote as foll's:

//t=(Sum(IIf( C>Ref(C,-1), (V*(C-Ref(C,-1))),IIf(C<Ref(C,-1),(V*(C-Ref(C,-1))),0)),13));


it works in the the same way, it does not make any sense to compare current and previous Close if you use the same calculated value anyways.

Or I miss something obvious? :)

About | Privacy | Terms of Use | Contact information
Copyright © 2001 AMIBROKER.COM