Volume Pressure Expert Advisor

dap711

Well-known member
VIP

What this strategy does​


This strategy is a trend-and-volume-pressure confirmation system. It tries to enter trades only when your chart symbol, plus the broader market filters you chose, are aligned in the same direction.

At the chart-symbol level, it measures:
  • Buying pressure versus selling pressure
  • A moving average trend filter
A long setup happens when:
  • smoothed buying pressure is greater than smoothed selling pressure, and
  • price is above the moving average
A short setup happens when:
  • smoothed selling pressure is greater than smoothed buying pressure, and
  • price is below the moving average
In the strategy version, those conditions become simulated orders through AddOrder(). In thinkScript, AddOrder() places the simulated order on the next bar when the condition is true, and open[-1] is the standard next-bar fill price unless you override it.

How the market filters work​

The script also calculates volume pressure for:
  • the Magnificent 7 as a group
  • QQQ
  • SPY
These are used as optional directional filters.
For a long trade:
  • your symbol must be bullish
  • and, if enabled, Mag 7 must be bullish
  • and, if enabled, QQQ must be bullish
  • and, if enabled, SPY must be bullish
For a short trade:
  • your symbol must be bearish
  • and the enabled filters must also be bearish
This makes the strategy more selective. It is trying to avoid taking a long when your symbol looks good but the broader market is weak, or taking a short when the market backdrop is strong.

How entries happen​

The strategy does not enter every bar that stays bullish or bearish.
It only enters when the condition turns true on this bar after being false on the prior bar:
  • longEntry = longFilterOK and !longFilterOK[1]
  • shortEntry = shortFilterOK and !shortFilterOK[1]
That means it is looking for a fresh signal, not repeated signals every bar.

Inputs you can control​


Main display input​

  • PaintBars
    • colors price bars cyan when bullish
    • colors price bars red when bearish
    • otherwise gray
Filter toggles
  • Use_Mag7_Filter
  • Use_QQQ_Filter
  • Use_SPY_Filter
Turning filters on makes the strategy stricter.
Turning them off makes it trade based more on the chart symbol alone.

Volume-pressure settings​

  • Volume_AvgType
  • Volume_Length
These control how fast or slow the buy/sell pressure averages respond.

Smaller length:
  • faster signals
  • more trades
  • more noise
Larger length:
  • slower signals
  • fewer trades
  • more smoothing

Moving-average settings​

  • MovAvg_AvgType
  • MovAvg_Price
  • MovAvg_Length
These control the trend filter.

Smaller MA length:
  • faster trend changes
  • earlier entries
  • more whipsaws
Larger MA length:
  • slower trend changes
  • fewer but more filtered entries

Best way to use it​

This strategy is best used as:
  • a directional alignment tool
  • a backtesting idea generator
  • a confirmation system for intraday or swing entries
It is especially useful when you want to know:
  • is my symbol strong or weak?
  • is that strength or weakness confirmed by the broader market?
  • did a fresh alignment just appear?

How to add it in Thinkorswim​

Thinkorswim separates studies and strategies. Strategies are added from the Strategies tab in the “Edit Studies and Strategies” window, and custom strategies can be created in the thinkScript editor there.

Basic workflow:
  1. Open a chart.
  2. Go to Studies > Edit Studies and Strategies.
  3. Open the Strategies tab.
  4. Click Create.
  5. Paste the strategy code.
  6. Save it with a name.
  7. Add it to the chart.

How to backtest it​

Once added as a strategy, Thinkorswim will show simulated entries and exits on the chart. Strategies in thinkorswim are technical analysis tools that add historical trade signals so you can backtest the conditions.

When testing it:
  • try multiple timeframes
  • test with all filters on, then selectively turn some off
  • compare shorter versus longer moving-average lengths
  • compare shorter versus longer volume lengths
  • check whether the strategy fits trending symbols better than choppy symbols

Important limitations​

Right now it does not include:
  • stop loss
  • profit target
  • trailing stop
  • time-of-day filter
  • volume minimum
  • volatility filter
  • position sizing logic beyond the fixed strategy size
Also, because it uses next-bar simulated fills, actual live fills can differ from backtest fills. Thinkorswim’s strategy engine is for simulated order testing, not a guarantee of real execution.


Practical starting settings​

A good starting point is:
  • Volume_Length = 8
  • MovAvg_Length = 16
  • all three filters on
Then test:
  • aggressive mode: shorter lengths, fewer filters
  • conservative mode: longer lengths, all filters on

Simple summary​

In one sentence:
The strategy goes long when your symbol’s buying pressure and price trend turn bullish, goes short when they turn bearish, and can require Mag 7, QQQ, and SPY to agree before taking the trade.

1775016924297.png
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
833 Online
Create Post

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