PVT Price Volume Trend indicator For ThinkOrSwim

chewie76

Well-known member
VIP
VIP Enthusiast
The Price and Volume Trend (PVT) is a momentum indicator similar to the On Balance Volume (OBV) indicator but with a key difference. Unlike the OBV, which adds or subtracts total volume based on daily price changes, the PVT adjusts volume based on the percentage change in price, making it more sensitive to money flow.
hso3Hzr.png



@samer800 Is it possible to convert this PVT indicator and have the 21 EMA set to PVT like in this video in upper chart, or even a lower chart? This looks interesting.
 
Last edited by a moderator:

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

My take at it. There are too many arrows on smaller time frames. Try lowering the EMA within the code. Maybe add a filter to detect tight range squeezes?

Code:
#chatgpt created and @chewie76 cleaned up
# Define the PVT (Price Volume Trend) Indicator
declare lower;

def PVT = CompoundValue(1, if (IsNaN(close[1])) then 0 else PVT[1] + (close - close[1]) / close[1] * volume, 0);

# Define the 21-period EMA of the PVT
def EMA_21 = ExpAverage(PVT, 21);

# Plot the PVT and EMA on the lower chart
plot PVTLine = PVT;
plot EMA21Line = EMA_21;
PVTLine.SetDefaultColor(Color.CYAN);
EMA21Line.SetDefaultColor(Color.YELLOW);

# Define the crossover conditions
def crossoverUp = PVT crosses above EMA_21;
def crossoverDown = PVT crosses below EMA_21;

# Plot arrows on the upper chart when crossover conditions are met
plot UpArrow = if crossoverUp then pvt else Double.NaN;
UpArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpArrow.SetDefaultColor(Color.GREEN);

plot DownArrow = if crossoverDown then pvt else Double.NaN;
DownArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownArrow.SetDefaultColor(Color.RED);

# Set the arrow size for better visibility
UpArrow.SetLineWeight(3);
DownArrow.SetLineWeight(3);
 
Last edited by a moderator:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
379 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