I couldn't find the OBV_Scan condition?.@Rojo Grande Use the script below:
Code:# # TD Ameritrade IP Company, Inc. (c) 2008-2020 # declare lower; def OBV = TotalSum(Sign(close - close[1]) * volume); plot scan = if OBV > OBV[1] then 1 else double.nan;
Add it as an indicator and then set up your scanner to something like this:
#
# TD Ameritrade IP Company, Inc. (c) 2020-2021
#
declare lower;
input length = 7;
input signalLength = 10;
input averageType = AverageType.EXPONENTIAL;
input levelLine = -5;
plot Level = levelLine;
def obv = reference OnBalanceVolume();
plot OBVM = MovingAverage(averageType, obv, length);
plot Signal = MovingAverage(averageType, OBVM, signalLength);
OBVM.SetDefaultColor(GetColor(8));
Signal.SetDefaultColor(GetColor(2));
Hmm it's still stuck at 0. I plotted -5000 but it stays at 0.@fungus12
The other two plots in this script are in thousands, so a plot of -5 comes out as -0.005.
So you have to plot -5000 or divide each of the two other plots by 1000.
I have other lower indicators but not on top of each other. Can you please link your code? Not sure why it's not happening for me.
#
# TD Ameritrade IP Company, Inc. (c) 2020-2021
#
declare lower;
input length = 7;
input signalLength = 10;
input averageType = AverageType.EXPONENTIAL;
input levelLine = -5000;
plot Level = levelLine;
def obv = reference OnBalanceVolume();
plot OBVM = MovingAverage(averageType, obv, length);
plot Signal = MovingAverage(averageType, OBVM, signalLength);
OBVM.SetDefaultColor(GetColor(8));
Signal.SetDefaultColor(GetColor(2));
That was odd, it works now. Thanks for the help dude.@fungus12
It's the same exact code you posted.
Just changed -5 to -5000.
Code:# # TD Ameritrade IP Company, Inc. (c) 2020-2021 # declare lower; input length = 7; input signalLength = 10; input averageType = AverageType.EXPONENTIAL; input levelLine = -5000; plot Level = levelLine; def obv = reference OnBalanceVolume(); plot OBVM = MovingAverage(averageType, obv, length); plot Signal = MovingAverage(averageType, OBVM, signalLength); OBVM.SetDefaultColor(GetColor(8)); Signal.SetDefaultColor(GetColor(2));
Sorry dude just one more quick question. When I drag the OBV up to the other graph, I get these black bars on the side that say "millions". Is there any way to remove those?@fungus12
It's the same exact code you posted.
Just changed -5 to -5000.
Code:# # TD Ameritrade IP Company, Inc. (c) 2020-2021 # declare lower; input length = 7; input signalLength = 10; input averageType = AverageType.EXPONENTIAL; input levelLine = -5000; plot Level = levelLine; def obv = reference OnBalanceVolume(); plot OBVM = MovingAverage(averageType, obv, length); plot Signal = MovingAverage(averageType, OBVM, signalLength); OBVM.SetDefaultColor(GetColor(8)); Signal.SetDefaultColor(GetColor(2));
Hi Team,
Could you please assist and assign the arrows to be plotted on the actual candle of the chart?
declare lower;
input length = 7;
input maxVolumeCutOff = 2.5;
input signalLength = 10;
input averageType = AverageType.EXPONENTIAL;
def OBV = TotalSum(Sign(close - close[1]) * volume);
plot OBVM = MovingAverage(averageType, OBV, length);
plot Signal = MovingAverage(averageType, OBVM, signalLength);
OBVM.SetDefaultColor(GetColor(8));
Signal.SetDefaultColor(GetColor(2));
input showarrows = yes;
def price = close ;
def up = OBVM > Signal and Signal < OBVM ;
def dn = OBVM < Signal and Signal > OBVM ;
def neutral = between(close,min(OBVM,SIGNAL),max(SIGNAL,OBVM));
def x = CompoundValue(1,
if x[1]>=0 and (dn[1] or up[1]==0) and up
then 1
else if x[1]>=1 and (up or !dn)
then x[1]+1
else 0, 1);
def y = CompoundValue(1,
if y[1]<=0 and (up[1] or dn[1]==0) and dn
then 1
else if y[1]>=1 and (dn or !up)
then y[1]+1
else 0, 1);
plot uparrow = if showarrows and x == 3 and up then 1 else 0;
uparrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
uparrow.SetLineWeight(1);
uparrow.SetDefaultColor(Color.yellow);
plot dnarrow = if showarrows and y == 3 and dn then 1 else 0;
dnarrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
dnarrow.SetLineWeight(1);
dnarrow.SetDefaultColor(Color.white);
#
declare lower;
#declare lower;
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
W | BuySell Volume, PreMarket OBV & CumuVol For ThinkOrSwim | Custom | 3 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.