Resource icon

What is weak_volume_dependency in ThinkorSwim?

Use declare weak_volume_dependency; if you plan on changing input price = close; to input price = volume;. The weak_volume_dependency syntax move the indicator's plot to the volume section.

Usage

Code:
declare weak_volume_dependency;

Example

Ruby:
# Converted by WalkingBallista with help from Benten
# Source: https://www.tradingview.com/script/2TicXK2B-Ichimoku-EMA-Bands/
# https://usethinkscript.com/d/106-ichimoku-ema-bands-indicator-for-thinkorswim
# Ichimoku
#
input tenkan_period = 5;
input kijun_period = 26;

plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
plot "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
plot "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
def Chikou = close[-kijun_period];

DefineGlobalColor("A", Color.Dark_Gray);
DefineGlobalColor("B", Color.Dark_Gray);
DefineGlobalColor("Bull", Color.Blue);
DefineGlobalColor("Bear", Color.Red);
Tenkan.SetDefaultColor(Color.Orange);
Kijun.AssignValueColor(if close >= Kijun then GlobalColor("Bull") else GlobalColor("Bear"));
"Span A".SetDefaultColor(GlobalColor("A"));
"Span B".SetDefaultColor(GlobalColor("B"));

AddCloud("Span A", "Span B", GlobalColor("A"), GlobalColor("B"));

#
# EMAs
#

declare weak_volume_dependency;

input displace = 0;
input ema_length = 26;

input atr_factor = 2.272;
input atr_length = 200;
input price = close;
input averageType = AverageType.EXPONENTIAL;
input trueRangeAverageType = AverageType.WILDERS;

def shift = atr_factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), atr_length);

def average = MovingAverage(averageType, price, ema_length);

plot Avg = average[-displace];
Avg.SetDefaultColor(Color.Black);

plot Upper_Band = average[-displace] + shift[-displace];
Upper_Band.SetDefaultColor(Color.Red);

plot Lower_Band = average[-displace] - shift[-displace];
Lower_Band.SetDefaultColor(Color.Green);

Additional scripts related to declare weak_volume_dependency

  • Like
Reactions: Jonas99
Author
BenTen
Views
704
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from BenTen

Top