Buy / Sell Volume RoC For ThinkOrSwim

Seems Like a good entry might be an increase that follows balance. Maybe add an additional volume requirement, but looks better on a chart this way.

# mcdon
# addition 20211010
Input VPchLimit =.60;
def buprec =buying /(buying+ selling );
def beprec = selling /(buying+ selling );
def isPrimeV =if beprec >buprec then beprec else buprec;
def isPrimv2 =100*(isPrimeV-isPrimeV[1])/isPrimeV ;
def Balance= if(between(isPrimeV,.40,.60),1,0);
def entry;
if Balance[1] && IsPrimeV==beprec && isPrimeV>isPrimeV[1] && VPchLimit>=VPchLimit {
entry = -100; # bear
} else if Balance[1] && IsPrimeV==buprec && isPrimeV>isPrimeV[1] && VPchLimit>=VPchLimit {
entry = 100; # bull
} else{
entry=0;
}
You are correct, as of now, you only know who is in control at the current moment and without additional information, do you act on any given signal? I'm always thinking of ways to improve this indicator and by all means, I encourage anyone with ideas to share if they're willing
Thank you
 

mcdon030

Member
You are correct, as of now, you only know who is in control at the current moment and without additional information, do you act on any given signal? I'm always thinking of ways to improve this indicator and by all means, I encourage anyone with ideas to share if they're willing
Thank you

I'm not endorsing these additions as a trade plan, but this is what I do if I used it. The trend line shows volume direction, balance and correlation of balance and trend to price. I scaled volume to view both. I'm sure other have different opinions, but you can look at from 100 different ways

2021-10-12-TOS-CHARTS.png


Code:
# Show total volume in gray.  Buying volume in green.  Sell Volume in red.
# Volume average is gray line.
# Specified percent over average volume is cyan triangles.
# Horserider 12/30/2019 derived from some already existing studies.
# Change  20211012 mcdon030
#1. data choice, add percent, trend, scale volume and Correlation of trend

declare lower;

#Inputs
input ShowTodayVolumeLabel =  yes;
input UnusualVolumePercentLabel = 200;
input ShowCurrentBarLabel = yes;
input ShowSellVolumePercentLabel = yes;
input ShowHotVolumeArrows = yes;
input ShowVol = yes;
input ShowMultiBarVol5 = yes;
input ShowMultiBarVol10 = yes;
input ShowAllMultiBar = yes;


def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def tcnt = tick_count ;
def tickS= if(!IsNaN(TickSize()),TickSize(),.01);
def bn = BarNumber();
def nan = Double.NaN;


Input sLength = 3;
Input trLength = 7;
Input CorrelationThreshold = .65;
Input Upbound = .65;
Input Dnbound = .35;

def Data;
input Voltype = {TrRange,TickTrRange,isVolume, default Shares};
switch (Voltype) {
case TrRange:
    Data = (v / Max(TrueRange(h, c, l), tickS));
case TickTrRange:
    Data = (v / tcnt  / Max(TrueRange(h, c, l),tickS));
case isVolume:
    Data = v;
case Shares:
    Data =  (v/tcnt);

}

def buying = Data  * (C - L) / (H - L);
def selling = Data  * (H - C) / (H - L);
def buprec = buying / (buying + selling );
def beprec = selling / (buying + selling );
def PrimeData = if beprec > buprec then  beprec else buprec;
def Balance = If(Between(PrimeData,Dnbound, Upbound), 1, 0);
# TRend
def primesum = Sum(if PrimeData == beprec then -1 else 1,sLength);
def primeTrend = inertia(primesum,trLength);
# Confirm Trend's correlation to price
def x1 = if !isNaN(c) then c else x1[1];
def x2 = if !isNaN(c)  then  primeTrend  else x2[1] ;
def avx = Average(x1, trLength );
def avy = Average(x2, trLength );
def ax = x1 - avx;
def bx = x2 - avy;
def ax2 = sum(sqr(ax), trLength );
def bx2 = sum(sqr(bx), trLength );
def ab = sum(ax * bx, trLength );
def correlation = sum(ab, trLength ) / Sqrt(sum(ax2, trLength ) * sum(bx2, trLength ));


script Scale {
    input c = close;
    input Min = 0;
    input Max = 1;
    def hh = HighestAll(c);
    def ll = LowestAll(c);
    plot Range = (((Max - Min) * (c - ll)) /  (hh - ll)) + Min;
}

# Selling Volume

plot BuyVol = if showVol then scale(buying,-10,1) else double.NaN;
BuyVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BuyVol.SetDefaultColor(Color.DARK_GREEN);
BuyVol.HideTitle();
BuyVol.HideBubble();
BuyVol.SetLineWeight(5);

plot SellVol = if showVol then scale(selling,-10,1) else double.NaN;
SellVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SellVol.SetDefaultColor(Color.DARK_RED);
SellVol.HideTitle();
SellVol.HideBubble();
SellVol.SetLineWeight(5);

plot pPrime =PrimeData;
pPrime.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
pPrime.AssignValueColor( if PrimeData == beprec then Color.green else  Color.red);
#SellVol.HideTitle();
#SellVol.HideBubble();
pPrime.SetLineWeight(1);

plot pTrend = if !isnan(c) then primeTrend else nan;
pTrend.assignValueColor(
if Balance  && Correlation>=CorrelationThreshold then color.cyan else
if Balance  && Correlation<CorrelationThreshold then color.gray else
if pTrend>pTrend[1] && Correlation>=CorrelationThreshold then color.green else
if pTrend>pTrend[1] && Correlation<CorrelationThreshold then color.dark_green else   
if pTrend<pTrend[1] && Correlation>=CorrelationThreshold then color.red else
if pTrend<pTrend[1] && Correlation<CorrelationThreshold then color.dark_red else 
 color.red);
pTrend.SetLineWeight(2);
pTrend.HideTitle();
pTrend.HideBubble();
addCloud(pTrend,0,color.green,color.red);
 
Code in post #1 updated.

Added what I call the Buy/Sell Line

still looking at other requests but been busy with work and other people's scripts :p

Here's a 2 min chart of MU today


2IrkGqL.png



and a 10 min of PLUG

GIGMfCK.png



Tick Chart...Had You gone short (why you would've, I dunno but I've done dumb things :)...Anyhow, that little blip up of green out of nowhere shouldn't frighten you now. Also It's not on this screenshot but after the volume turns bullish, you get a red spike down....Buy line is still green, so nothing to worry about

UZWExBs.png



Hope you find it an additional benefit for this indicator
 
Last edited:
Also worth noting observing the slant of the Buyline.

If you look at a 10 min chart of TSLA yesterday, you'll see what I mean
 
Second code will be posted soon on pg 1

Imported RSI_laguerre w/fractal energy into Volume Study

I will leave original code for those who just want that version



First, a comparison chart with RSI_FE

rkzMqBa.png



And just with the new Volume w/FE

kM4sAmU.png
 

Splinter

Member
VIP
Second code will be posted soon on pg 1

Imported RSI_laguerre w/fractal energy into Volume Study

I will leave original code for those who just want that version



First, a comparison chart with RSI_FE

rkzMqBa.png



And just with the new Volume w/FE

kM4sAmU.png
Your work is greatly appreciated. I've been using your volume indicator since its first iteration.
I was hoping you would be able to help with some of the inputs, I'm not a coder so I'm not sure of their purpose:

1.glength
2.beta dev

3.Under NaN you have "length = 20" (not sure what this signifies)
4. Also length1 and
5. length12

Also I was wondering if the length of the RSI is adjustable.

Thank you for all your time and help.
 
Your work is greatly appreciated. I've been using your volume indicator since its first iteration.
I was hoping you would be able to help with some of the inputs, I'm not a coder so I'm not sure of their purpose:

1.glength
2.beta dev

3.Under NaN you have "length = 20" (not sure what this signifies)
4. Also length1 and
5. length12

Also I was wondering if the length of the RSI is adjustable.

Thank you for all your time and help.
That's great to hear...How's it been working out?

1.glength
2.beta dev have to do with the RSI laguerre study. i.e it will adjust the gamma, rsi lines

the original version had slightly different values which I tinkered with a bit.

Not saying my settings are the best but what I found promising.

The length and length 1 are both set to 20 so they probably could be consolidated . The length1 I believe is code left over from the original vol study...it's the vol avg line you see on vol indicators.....

The length12 has to do with the new oscillating green/orange line you see "BuyLine"


your last Q's refers to my 1st answer....glength....beta dev

I would refer to the original laguerre thread about that indicator, make adjustments there and if You like other settings better, then come back to the vol study and match the settings

Seepost#20

Hope I answered all your Q's

Good luck
 

Splinter

Member
VIP
That's great to hear...How's it been working out?

1.glength
2.beta dev have to do with the RSI laguerre study. i.e it will adjust the gamma, rsi lines

the original version had slightly different values which I tinkered with a bit.

Not saying my settings are the best but what I found promising.

The length and length 1 are both set to 20 so they probably could be consolidated . The length1 I believe is code left over from the original vol study...it's the vol avg line you see on vol indicators.....

The length12 has to do with the new oscillating green/orange line you see "BuyLine"


your last Q's refers to my 1st answer....glength....beta dev

I would refer to the original laguerre thread about that indicator, make adjustments there and if You like other settings better, then come back to the vol study and match the settings

Seepost#20

Hope I answered all your Q's

Good luck
Thanks for your response! I like the indicator quite a bit. I'm using it consistently and its definitely been helpful!
 

airgb

New member
Second code will be posted soon on pg 1

Imported RSI_laguerre w/fractal energy into Volume Study

I will leave original code for those who just want that version



First, a comparison chart with RSI_FE

rkzMqBa.png



And just with the new Volume w/FE

kM4sAmU.png
Thanks again RtG, I am not a fan of the RSI laguerre however the Buy/Sell line looks very good from the short period I have tested it and will more than likely add it to the indicator. Can you tell me where it derives it's data from?
 
Thanks again RtG, I am not a fan of the RSI laguerre however the Buy/Sell line looks very good from the short period I have tested it and will more than likely add it to the indicator. Can you tell me where it derives it's data from?

Yes, it's from post 20 of this thread. Based on this code

Oh your talking about the oscillating orange/ green line?

https://usethinkscript.com/threads/...djusting-with-fractal-energy-usage-notes.219/

Buy_Sell oscillating line

Code:
def Buyline = ExpAverage(sellbuydiff5[-displace], length12) ;

plot BVLine = (if showbuy_SellLine then Buyline else double.NaN);
BVLine.assignValueColor(if buyline > 0 then createColor(63,162,128) else color.DARK_ORANGE);
BVLine.SetLineWeight(3);
 
Last edited:

airgb

New member
Yes, it's from post 20 of this thread. Based on this code

Oh your talking about the oscillating orange/ green line?

https://usethinkscript.com/threads/...djusting-with-fractal-energy-usage-notes.219/

Buy_Sell oscillating line

Code:
def Buyline = ExpAverage(sellbuydiff5[-displace], length12) ;

plot BVLine = (if showbuy_SellLine then Buyline else double.NaN);
BVLine.assignValueColor(if buyline > 0 then createColor(63,162,128) else color.DARK_ORANGE);
BVLine.SetLineWeight(3);
Yes the Buy/Sell line posted in post 64. So it's a exponential moving average, correct?
 
Updated Watchlist column once more with new Features with dynamic status of the BuyLine

So what you're seeing here is..

1st: you have Long or Short or nothing

Long = 5 bar Buyvolume on the indicator is green, rsi laguerre is green and buyline is > zeroline

Short would be the opposite

2nd: you have a Number indicating how many bars the buyline has been trending

3rd: (1) = its trending up
(2) = it's trending down

Enjoy

Sk4p1SO.png
 
Last edited:

bmn

Member
@RedToGreen : This is an interesting indicator. I just added the V1 version. Could you please summarize what the following indicates?

Vol Bars:
-- Light green
-- Dark green
-- Light red
-- Dark red

RSI Center horizontal line:
-- Light green
-- Dark green
-- Light red
-- Dark red

Gamma Center dots:
-- Gray
-- Black
-- Yellow

Buy Curvy line:
-- Green
-- Yellow

Buy/Sell Arrows:
-- Blue
-- Dark red
-- Light red
 
@RedToGreen : This is an interesting indicator. I just added the V1 version. Could you please summarize what the following indicates?

Vol Bars:
-- Light green. - difference between sell and buy volume over 5 bars
-- Dark green. -10 bars
-- Light red. -5 bars
-- Dark red. -10 bars

RSI Center horizontal line:
-- Light green rsi Laguerre up high
-- Dark green rsi lag break out, moving up
-- Light red. Laguerre down low
-- Dark red.. Break to downside

Gamma Center dots:
-- Gray - rsi Laguerre exhausted
-- Black - nothing
-- Yellow - energy building

Buy Curvy line:
-- Green
-- Yellow
Just an average line of the 5bar buying and selling

Buy/Sell Arrows:
-- Blue
-- Dark red
-- Light red

Arrows hot, increased volume compared to 30 bars

Hope that answers everything

Look thru this thread from beginning for more explanation
 

Trader_Rich

Member
@RedToGreen regarding the Orange squeeze dots...on /CL the squeeze dots (I'm assuming that's what these are) the dots are along the midline, however on other indexes such as NQ and ES, the dots are way above where the histogram is at. For example, right now on NQ the dots are around 15,000. Any ideas?
 

Similar threads

Top