Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
thanks for letting me know Cory, as I do not use ToS I assumed this was a correct version as per that thread. I would use TC2000 but they only focus only on the US markets, but I also need Australian market too. Appreciate your effort, thanks.
this version plots above and below the y axis. In essence the function is similar but I am unable to confirm as it is a different instrument, with potentially different volume data. The original source with comments for this was FXCodeBase.COM: Forex Chart Indicators and Development • View topic - Time Segmented Volume
and the lua code as follows (it uses candles instead of linear output):
-- Indicator profile initialization routine
-- Defines indicator profile properties and indicator parameters
-- TODO: Add minimal and maximal value of numeric parameters and default color of the streams
function Init()
indicator:name("Time Segmented Volume");
indicator:description("Time Segmented Volume");
indicator:requiredSource(core.Bar);
indicator:type(core.Oscillator);
indicator.parameters:addGroup("Calculation");
indicator.parameters:addInteger("Period", "Period", "Period", 14);
indicator.parameters:addGroup("Style");
indicator.parameters:addColor("Up_color", "Positive TSV Color", "Color of TSV", core.rgb(0, 255, 0));
indicator.parameters:addColor("Dn_color", "Negativ TSV Color", "Color of TSV", core.rgb( 255,0 , 0));
end
-- Indicator instance initialization routine
-- Processes indicator parameters and creates output streams
-- TODO: Refine the first period calculation for each of the output streams.
-- TODO: Calculate all constants, create instances all subsequent indicators and load all required libraries
-- Parameters block
local Period;
local first;
local source = nil;
local temp;
-- Streams block
local TSV = nil;
-- Routine
function Prepare(nameOnly)
Period = instance.parameters.Period;
source = instance.source;
assert(source:supportsVolume(), "The source must have volume");
first = source:first()+Period;
local name = profile:id() .. "(" .. source:name() .. ", " .. tostring(Period) .. ")";
instance:name(name);
temp = instance:addInternalStream(0, 0);
if (not (nameOnly)) then
TSV = instance:addStream("TSV", core.Bar, name, "TSV", instance.parameters.Up_color, first);
end
end
-- Indicator calculation routine
-- TODO: Add your code for calculation output values
function Update(period)
if source.close[period]> source.close[period-1] then
temp[period]= source.volume[period] * (source.close[period]- source.close[period-1]);
elseif source.close[period]< source.close[period-1] then
temp[period]= (-1) * source.volume[period] * (source.close[period-1]-source.close[period] );
else
temp[period]=0;
end
if period < first then
return;
end
TSV[period] = mathex.sum(temp, period-Period+1, period);
if TSV[period] > TSV[period-1] then
TSV:setColor(period, instance.parameters.Up_color);
else
TSV:setColor(period, instance.parameters.Dn_color);
end
end
This is a TSV approximation I've used for some time in my signal generation code with Telechart. I find that it is very true to Worden's TSV line form.
The Telechart PCF is TSV = V*(C-C1)/((H-L+ABS(H-C1)+ABS(C1-L)+0.0000001)/2).