AlgoFLow [Tradytics] For ThinkOrSwim

John Thanos

New member
Hi everyone,

I stumbled upon this on IG. Attached is a video describing the functions. I searched around TOS and found VolumeFlowIndicator. I adjusted the settings using (22, 2.5) from the default (130, 2.5) and I dragged it up to "Price" in the Edit Studies pop up. I'm using the 1 or 5min and it looks like it's close to Tradytics AlgoFlow. I'm not a coder at all and have no clue to make any adjustments. I was wondering if anyone could clean this up to make similar to Tradytics. Thanks.

ToS VolumeFlowIndicator:
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

declare lower;

input length = 130;
input maxVolumeCutOff = 2.5;

assert(maxVolumeCutOff > 0, "'max volume cut off' must be positive: " + maxVolumeCutOff);

def cutOff = 0.2 * stdev(log(hlc3) - log(hlc3[1]), 30) * close;
def hlcChange = hlc3 - hlc3[1];
def avgVolume = Average(volume, 50)[1];
def minVolume = Min(volume, avgVolume * maxVolumeCutOff);
def dirVolume = if hlcChange > cutOff
    then minVolume
    else if hlcChange < -cutOff
        then -minVolume
        else 0;

plot VFI = ExpAverage(sum(dirVolume, length) / avgVolume, 3);
plot ZeroLine = 0;

VFI.setDefaultColor(getColor(8));
ZeroLine.setDefaultColor(getColor(8));
 
Last edited by a moderator:
Hi everyone,

I stumbled upon this on IG. Attached is a video describing the functions. I searched around TOS and found VolumeFlowIndicator. I adjusted the settings using (22, 2.5) from the default (130, 2.5) and I dragged it up to "Price" in the Edit Studies pop up. I'm using the 1 or 5min and it looks like it's close to Tradytics AlgoFlow. I'm not a coder at all and have no clue to make any adjustments. I was wondering if anyone could clean this up to make similar to Tradytics. Thanks.

ToS VolumeFlowIndicator:
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

declare lower;

input length = 130;
input maxVolumeCutOff = 2.5;

assert(maxVolumeCutOff > 0, "'max volume cut off' must be positive: " + maxVolumeCutOff);

def cutOff = 0.2 * stdev(log(hlc3) - log(hlc3[1]), 30) * close;
def hlcChange = hlc3 - hlc3[1];
def avgVolume = Average(volume, 50)[1];
def minVolume = Min(volume, avgVolume * maxVolumeCutOff);
def dirVolume = if hlcChange > cutOff
    then minVolume
    else if hlcChange < -cutOff
        then -minVolume
        else 0;

plot VFI = ExpAverage(sum(dirVolume, length) / avgVolume, 3);
plot ZeroLine = 0;

VFI.setDefaultColor(getColor(8));
ZeroLine.setDefaultColor(getColor(8));
I changed it to plot as a histogram and redefined the colors, also I added Bollinger
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

declare lower;

input length = 130;
input maxVolumeCutOff = 2.5;

assert(maxVolumeCutOff > 0, "'max volume cut off' must be positive: " + maxVolumeCutOff);

def cutOff = 0.2 * stdev(log(hlc3) - log(hlc3[1]), 30) * close;
def hlcChange = hlc3 - hlc3[1];
def avgVolume = Average(volume, 50)[1];
def minVolume = Min(volume, avgVolume * maxVolumeCutOff);
def dirVolume = if hlcChange > cutOff
    then minVolume
    else if hlcChange < -cutOff
        then -minVolume
        else 0;

plot VFI = ExpAverage(sum(dirVolume, length) / avgVolume, 3);
def Up = VFI > 0;
def Dn = VFI < 0;
def Increase = VFI > VFI[1];
def Decrease = VFI < VFI[1];
VFI.setPaintingStrategy(PaintingStrategy.HISTOGRAM);
VFI.AssignValueColor( if up and increase then Color.Cyan else if Up and Decrease then color.blue else if Dn and Increase then Color.Magenta else if Dn and Decrease then Color.Red else color.Dark_Gray);
VFI.SetLineWeight(2);
AddCloud(VFI,0,Color.Cyan,Color.Magenta);
plot ZeroLine = 0;
ZeroLine.setDefaultColor(getColor(8));

input displace = 0;
input BBlength = 20;
input Num_Dev = 2;
input averageType = AverageType.Simple;

def sDev = stdev(data = VFI[-displace], length = BBlength);

def MidLine = MovingAverage(averageType, data = VFI[-displace], length = BBlength);
def LowerBand = MidLine - num_Dev * sDev;
def UpperBand = MidLine + num_Dev * sDev;
Plot UB = if IsNaN(VFI < 0) then Double.NaN else UpperBand;
Plot LB = if IsNaN(VFI < 0) then Double.NaN else LowerBand;

LB.SetDefaultColor(Color.Yellow);
UB.SetDefaultColor(Color.Yellow);
bands
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
368 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top