Author states:Good Afternoon,
I was seeing if anybody could convert this to ThinkorSwim
Volume Trend Meter - Trading View
https://www.tradingview.com/script/ywEEvEtI-Volume-Trend-Meter/
Is this possible to be converted to thinkorswim?
The indicator sums up all green candles volume and red candles volumes over a specific period of bars (you set in settings) and plots their values.
Use this indicator to identify increasing volume with the green candles (close higher than open) and increasing volume of the red candles (close is lower than open).
======= Calculation ==========
For Green Column: Total volume of green candles is higher than total red candles volume.
For Red Column: Total volume of red candles is higher than total green candles volume.
find below. I added price and volume trend meter along with MTF option
CSS:
#// This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License https:/
#// © dman103
#// Sweet little indicator which measures volume pressure over a specific period of time.
#// The indicator sums up all green candles volume and red candles volumes over a specific period of bars (you set in settings) and plots their values.
#// Use this indicator to identify increasing volume with the green candles (close bigger than open) and increasing volume of the red candles (close is smaller than open).
#study("Price/Volume Trend Meter","PVTM",overlay=false)
# Converted by Sam4Cok@Samer800 - 02/2024
Declare Lower;
input useChartTimeframe = yes;
input customTimeframe = AggregationPeriod.FIFTEEN_MIN;
input source = FundamentalType.CLOSE;
input PreviousBarsToCheck = 9;
input PositiveValuesOnly = no;
input calculationType = {Default "Volume Trend", "Price Trend"};
def na = Double.NaN;
def last = isNaN(close);
def tf = GetAggregationPeriod();
def v = volume(Period = if useChartTimeframe then tf else customTimeframe);
def o = open(Period = if useChartTimeframe then tf else customTimeframe);
def c = Fundamental(FundamentalType = source, Period = if useChartTimeframe then tf else customTimeframe);
def vol = calculationType==calculationType."Volume Trend";
def src = calculationType==calculationType."Price Trend";
def up = c > o;
def vol_up = sum(if up then v else 0, PreviousBarsToCheck);
def vol_dn = sum(if up then 0 else v, PreviousBarsToCheck);
def src_up = sum(if up then c else 0, PreviousBarsToCheck);
def src_dn = sum(if up then 0 else c, PreviousBarsToCheck);
def total_up_dn_vol = (vol_up - vol_dn);
def total_up_dn_src = (src_up - src_dn);
def col = if total_up_dn_src>0 and total_up_dn_vol>0 then 2 else
if total_up_dn_src<0 and total_up_dn_vol<0 then -2 else
if (col[1]== 2 or col[1]== 1) then 1 else
if (col[1]==-2 or col[1]==-1) then -1 else 0;
plot volHist = if !vol or last then na else
if PositiveValuesOnly then AbsValue(total_up_dn_vol) else total_up_dn_vol;
volHist.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
volHist.AssignValueColor(if col== 2 then Color.GREEN else
if col== 1 then Color.DARK_GREEN else
if col==-2 then Color.RED else
if col==-1 then Color.DARK_RED else Color.RED);
plot priceHist = if !src or last then na else
if PositiveValuesOnly then AbsValue(total_up_dn_src) else total_up_dn_src;
priceHist.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
priceHist.AssignValueColor(if col== 2 then Color.GREEN else
if col== 1 then Color.DARK_GREEN else
if col==-2 then Color.RED else
if col==-1 then Color.DARK_RED else Color.RED);
#-- END of CODE
Last edited by a moderator: