Float Rotation Indicator for ThinkorSwim

zeek

Active member
2019 Donor
I am wondering if anyone here could help code a float rotation indicator that basically shows on the chart when the float have rotated. I am aware of the fact that TOS does not have float data available so my idea is that the user inputs this number himself from whatever source they want. All i need is that the script has a float number input field in the settings and then preferrably draws vertical dotted lines over the chart at the rotation points.

There is currently a paid script avaliable doing exactly this from another coder i found on Twitter so my hope is that someone here could help code something similar for the users here.

This tool is very useful when trading low float names to see potential shifts in supply/demand during the day.

To give you a better idea of what i am looking for, see the pic below which i borrowed from another trader/thinkscript coder on Twitter. Basically, i want to see when the float has rotated and i want this to be displayed just like in the pic, small dotted vertical lines shown only in the volume graph and if possible, a label for the float number just like in the pic.

And of course, an input field in the settings where the user can import their float number themself.

 

ankbhard

New member
@zeek I am looking into this as well... I know that he is referencing "Shares" for his Float and then dividing the Volume with Shares (V/S) to get the Float Rotation. But don't know how can we refer "Shares" in the script...

Code:
# Float As Cumulative Volume Pivots
# Mobius
# Chat Room Request 10.04.2015
# V.02
# Added a condition to start cumulative count at the first peak or trough on a chart.

input FloatFor = "SPY"; #hint FloatFor: ETF's do not have a float. Total shares outstanding are adjusted to control NAV (Net Asset Value). Check them often for available shares.
input Float = 877632000; #hint Float: Share Float or for ETF's available shares
input n = 21; #hint n: length used for average volume.

AddLabel(GetSymbol() == FloatFor, "Float Value For: " + FloatFor, color.white);
def h = high;
def l = low;
def c = close;
def V = volume;
def AvgFloatP = Float / Average(V, n);
def HighestHigh = HighestAll(h);
def HighBar = if H == HighestHigh
              then BarNumber()
              else HighBar[1];
def LowestLow = LowestAll(l);
def LowBar = if L == LowestLow
             then BarNumber()
             else LowBar[1];
def FirstBar = if HighBar < LowBar
               then HighBar
               else LowBar;
def CumVolume = if barNumber() > FirstBar
                then CompoundValue(1, if CumVolume[1] < Float
                                 then CumVolume[1] + v
                                 else if CumVolume[1] crosses Float
                                      then 0
                                      else CumVolume[1], v)
                else 0;
plot CVpoint = if GetSymbol() == FloatFor and
                  CumVolume crosses above Float
               then c
               else double.nan;
CVpoint.SetPaintingStrategy(PaintingStrategy.Points);
CVpoint.SetLineWeight(4);
CVpoint.SetDefaultColor(Color.Yellow);
plot CVline = if GetSymbol() == FloatFor and
                 CumVolume crosses above Float
              then c
              else double.nan;
CVline.SetPaintingStrategy(PaintingStrategy.Line);
CVline.EnableApproximation();
CVLine.SetDefaultColor(Color.Yellow);

addLabel(GetSymbol() == FloatFor, "Float = " + Float + "  Float/Avg Bars = " + Round(AvgFloatP, 0) + "  Cumulative Volume = " + CumVolume, color.white);
 

zeek

Active member
2019 Donor
The float number can be from any source like finviz, yahoo etc. and then you can simply input that number into the script settings and it will draw the rotation lines based on that number.
 

ankbhard

New member
Okay, that was easy... Here you go.

You will need to input the Float from one of the sources; however, you will get all three labels. :)
Code:
#######################################################
input Float = 100000000;

def V = volume(GetSymbol(), AggregationPeriod.DAY);

def MktCP = Float * Close(GetSymbol(), AggregationPeriod.DAY);

plot x = (V/100/Float)*100;

AddLabel (yes, ("Float: ")+ Round(Float * .000001, 1) + "M", Color.CYAN);

Addlabel (yes, ("Float RT: ") + Round(x, 2), color.DARK_ORANGE);

AddLabel (yes, ("MCap: $")+ Round(MKtCP * .000001, 1) + "M", Color.CYAN);

##############################################################
 
Last edited by a moderator:

zeek

Active member
2019 Donor
Thanks for trying @ankbhard I did try your script but not sure how to interpret the data shown. As you can see in the chart below, i used a float number of 12,3 million for symbol GNPX which traded almost 84 million shares on friday so there should have been at least six rotations on friday alone (which your label show) but i can only see one vertical line at the beginning of friday. Any idea why it`s not showing all the other rotations?

And is there a way to only plot the rotation lines on the lower volume graph only instead of on the chart?

 

ankbhard

New member
That is a stupid bug in the code as it shouldn't show any lines...

Try this:

Code:
#######################################################
input Float = 100000000;

def V = volume(GetSymbol(), AggregationPeriod.DAY);

def MktCP = Float * Close(GetSymbol(), AggregationPeriod.DAY);

plot x = (V/100/Float)*100;

AddLabel (yes, ("Float: ")+ Round(Float * .000001, 1) + "M", Color.CYAN);

Addlabel (yes, ("Float RT: ") + Round(x, 2), color.DARK_ORANGE);

AddLabel (yes, ("MCap: $")+ Round(MKtCP * .000001, 1) + "M", Color.CYAN);

x.Hide();

##############################################################
 

zeek

Active member
2019 Donor
Yes, the new code removes the lines shown earlier. But do you think it`s possible to have some sort of visual indicator on the chart too as soon as a rotation happens? It just makes it more simple to see where a shift in supply/demand may happen.

And if there is a possibility to also add audio alerts when a rotation happens, that would also be very useful.

Thanks:)
 

zeek

Active member
2019 Donor
@mansor Nope, sorry. The script from @ankbhard above does work but it`s only the labels. I hope someone here can figure out how to add vertical lines in the volume graph to visually show where the rotations happens.
 

SD_Snitch

New member
@zeek I came across this code the other month somewhere on another form. I add the labels similar to the ones. The code plots vertical lines once the float rotates similar to the photo you posted.

Maybe @ankbhard can help clean the code up?

Code:
######################################################
def Today = volume(period = "DAY");
input Float = 10000000;
def V =  if Today then volume(period = aggregationPeriod.MIN) else 0;
def TVol = TVol[1]  + V;
def nodes = (TVol) % Float;

AddVerticalLine(nodes < nodes[1],  CONCAT("Float Rotated: ", CONCAT(round(TVol / float, 0), "")) ,  Color.WHITE, Curve.SHORT_DASH);

AddLabel (yes, ("Float: ")+ Round(Float * .000001, 1) + "M", Color.White);

AddLabel (yes, ("T.Vol: ")+ Round(Today * .000001, 2) + "M", Color.White);

Addlabel (yes, ("Float RT: x")+ Round(Today/float, 0), if nodes < 0 then color.WHITE else Color.RED);
 
Last edited:

zeek

Active member
2019 Donor
Thanks for the code @SD_Snitch , tried it today but i can`t see anything added on the volume graph, neither labels or lines. Does it work for you?
 

SmallCap

New member
@zeek Try this one, it's basically the same as what @SD_Snitch posted it just needed an extra line to be closed out. Let me know if it works?

Code:
def Today = volume(period = "DAY");
input Float = 10000000;
def V = if Today then volume(period = aggregationPeriod.MIN) else 0;
def TVol = TVol[1] + V;
def nodes = (TVol) % Float;

AddVerticalLine(nodes < nodes[1], CONCAT("Float Rotated: ", CONCAT(round(TVol / float, 0), "")) , Color.WHITE, Curve.SHORT_DASH);

AddLabel (yes, ("Float: ")+ Round(Float * .000001, 1) + "M", Color.White);

AddLabel (yes, ("T.Vol: ")+ Round(Today * .000001, 2) + "M", Color.White);

Addlabel (yes, ("Float RT: x")+ Round(Today/float, 0), if nodes < 0 then color.WHITE else Color.RED);

plot Data = close;
 

zeek

Active member
2019 Donor
Thanks a lot! It works and i just realised why it didn`t show when i tried @SD_Snitch version earlier. I applied it on a 2 min chart and the aggregation period for the script was MIN so after changing to TWO_MIN, it now works as well with his version.

Appreciate it(y)
 

zeek

Active member
2019 Donor
hey @zeek can you explain how this can be used as edge

I use it to find potential areas for a shift in trend on strong moves to the upside. When the float has rotated, many times you will see a shift in trend to the downside so its always good to keep an eye on this and confirm with other indicators.
 

Nick

Active member
2019 Donor
VIP
@zeek Hi, is there something I need to change as I am unable to get any results using on daily timeframe? Thank
 

Co-Re-Cr-TaC

New member
@zeek did you figure out how to adapt automatically the float size to the ticker on which you use the float rotation indicator? Did you code any other new features to this script?

Thanks so much for this code!
 

SuryaKiranC

Active member
@zeek Here is as far as I could go. Still need to manually put in the float, but instead of as an input parameter, which will kind of become useless, if you want to use this as a scanner, you can edit the source and key in the float for each ticker you care about and save the script. look at the piece of code in the bottom, "Float = ", followed by each ticker that you care about and the respective float values.

Code:
#Float_RotationSTUDY.ts
#Author SuryaKiranC
#Draws a White Horizontal Line every time the entire float of a stock is sold on your chart timeFrame.

declare on_volume;

def Float;
def aP = GetAggregationPeriod();
def Today = volume(period = "DAY");
def V = if Today then volume(period = aP) else 0;
def TVol = TVol[1] + V;
def nodes = (TVol) % Float;

AddVerticalLine(nodes < nodes[1], Concat("Float Rotated: ", Concat(Round(TVol / float, 0), "")) , Color.WHITE, Curve.SHORT_DASH);
AddLabel (Float, ("Float: ") + Round(Float * .000001, 2) + " M ", Color.WHITE);
AddLabel (Float, ("Float RT: x") + Round(Today / float, 2), if nodes < 0 then Color.WHITE else Color.RED);

#Float Values need to be provided in the below format Source for Float data is Stockbot (Discord Bot)

Float=
if GetSymbol() == "JNCE" then 16429449 else
if GetSymbol() == "DIT" then 143160 else
if GetSymbol() == "DJCO" then 1005609 else
if GetSymbol() == "VRTA" then 1006025 else
if GetSymbol() == "AXR" then 3654459 else
if GetSymbol() == "TSLA" then 741015516 else
if GetSymbol() == "NVDA" then 590646696 else
if GetSymbol() == "TWTR" then 760550457 else
if GetSymbol() == "FB" then 2378308967 else
if GetSymbol() == "AAPL" then 17086047395 else
if GetSymbol() == "AMZN" then 425760507 else
if GetSymbol() == "NFLX" then 432269673 else
if GetSymbol() == "GOOG" then 289106942 else
if GetSymbol() == "SHOP" then 107624688 else
if GetSymbol() == "SPOT" then 123634771 else
if GetSymbol() == "ROKU" then 105527159 else
if GetSymbol() == "DIS" then 1803978963 else
if GetSymbol() == "WMT" then 1389926724 else
if GetSymbol() == "TGT" then 499011517 else
if GetSymbol() == "HD" then 1075371699 else
if GetSymbol() == "ENPH" then 116202773 else
if GetSymbol() == "MSFT" then 7455013097 else
if GetSymbol() == "AAL" then 502456205 else
if GetSymbol() == "BA" then 563481534 else
if GetSymbol() == "DAL" then 635627690 else
if GetSymbol() == "UAL" then 290085732 else
if GetSymbol() == "LVU" then 587623408 else
if GetSymbol() == "VMW" then 78838275 else
if GetSymbol() == "DELL" then 245785769 else
if GetSymbol() == "ADBE" then 477079606 else
if GetSymbol() == "CRM" then 875784910 else
if GetSymbol() == "NOW" then 190024891 else
if GetSymbol() == "CMG" then 27575019 else
if GetSymbol() == "BYND" then 35438304 else
if GetSymbol() == "KO" then 4266334099 else
if GetSymbol() == "PEP" then 1379751949 else
if GetSymbol() == "SBUX" then 1166559128 else
if GetSymbol() == "CPB" then 201349701 else
if GetSymbol() == "TSN" then 286732593 else
if GetSymbol() == "UNH" then 944699557 else
if GetSymbol() == "ATVI" then 759515101 else
if GetSymbol() == "TTWO" then 113110542 else
if GetSymbol() == "EA" then 287300743 else
if GetSymbol() == "GME" then 485134183 else
if GetSymbol() == "TWLO" then 134379827 else
if GetSymbol() == "AMD" then 1112803420 else
if GetSymbol() == "INTC" then 4251413631 else
if GetSymbol() == "AVGO" then 392589268 else
if GetSymbol() == "TXN" then 914419869 else
if GetSymbol() == "TSM" then 5185493973 else
if GetSymbol() == "QCOM" then 1127103369 else
if GetSymbol() == "AMAT" then 909457258 else
if GetSymbol() == "MU" then 1109043529 else
if GetSymbol() == "NTAP" then 221383608 else
if GetSymbol() == "RNG" then 76205145 else
if GetSymbol() == "ZM" then 173994270 else
Double.NaN;

**PS: I got these ticker names from https://www.lowfloat.com/ and the float values from stockbot (discord bot)

@zeek if you want to see how it looks like head back to https://usethinkscript.com/threads/...e-stats-for-thinkorswim.970/page-6#post-34054
 
Last edited:

jngy2k

Member
VIP
@SmallCap @zeek the script is broken for the vertical lines. even though the label says a certain float rotation the vertical line is delayed on volume.

@BenTen is there a simple fix I'm not seeing?

Code:
input Float = 10000000;
def Today = volume(period = "Day");
def V = if Today then volume(period = aggregationPeriod.MIN) else 0;
def DVol = DVol[1] + V;
def nodes = (DVol) % Float;
AddLabel (yes, "FloatRT: " + Round(Today/Float, 1), if Today < Float then Color.YELLOW else Color.WHITE);
AddVerticalLine(nodes < nodes[1], Concat(Round(DVol / Float, 0),"") , Color.WHITE, Curve.SHORT_DASH);
plot Data = close;
 

Similar threads

Top