VWAP in EasyLanguage — TradeStation & MultiCharts

A session VWAP that resets each day

VWAP in EasyLanguage
VWAP in EasyLanguage

The essential mechanic for VWAP in EasyLanguage is detecting a new session and resetting the running sums. See the explainer for the concept; here’s a session VWAP for TradeStation and MultiCharts.

What you’ll need

  • TradeStation or MultiCharts
  • The EasyLanguage / PowerLanguage Editor, new Indicator
  • An intraday chart

The source

{ AlgoGen Session VWAP — TradeStation / MultiCharts }
variables:
    Typical( 0 ),
    CumPV( 0 ),
    CumV( 0 ),
    VWAPval( 0 );

{ Reset the running sums at the first bar of each session }
if Date <> Date[1] then begin
    CumPV = 0;
    CumV  = 0;
end;

Typical = ( High + Low + Close ) / 3;
CumPV = CumPV + Typical * Volume;
CumV  = CumV + Volume;

if CumV > 0 then
    VWAPval = CumPV / CumV
else
    VWAPval = Typical;

Plot1( VWAPval, "VWAP" );

Date <> Date[1] is true on the first bar of a new day, which is where we zero the accumulators. From there, each bar adds Typical × Volume and Volume to the running sums, and VWAP is their ratio — overlaid on price like the output chart.

A VWAP bias strategy

The classic institutional-flavored use is refusing to fight VWAP — only taking longs above it:

{ AlgoGen VWAP Bias — Strategy (add to the study's VWAP calc) }
if Close > VWAPval and Close crosses over VWAPval then
    Buy next bar at market;
if Close < VWAPval then
    Sell next bar at market;

Reclaiming VWAP from below is the entry; losing it is the exit. On its own it’s crude, but as a filter on another signal (“only take longs while above VWAP”) it often earns its keep — the Strategy Performance Report will tell you.

Gotchas

  • Date change = new session. In EasyLanguage Date returns the bar’s date; comparing it to Date[1] cleanly detects the session boundary for the reset. For markets with overnight sessions, use the session-aware boundary that matches your data.
  • Intraday only. Session VWAP needs intraday bars; on daily data each session is a single bar and the line is meaningless.
  • Volume vs Ticks. Make sure you’re feeding real volume (or knowingly using tick volume) — VWAP is only as good as the volume behind it.

Same indicator elsewhere: Python, MQL5, Pine Script, NinjaScript. Then backtest a VWAP rule in AlgoGen.


This post is educational, not financial advice. Indicators describe the past; they don’t predict the future. Backtest anything before you risk real money on it.

Sources and further reading

  1. The Total Cost of Transactions on the NYSE (The Journal of Finance)
  2. What is EasyLanguage? (TradeStation)

Historical research from the Algogen archive. Not investment advice.

Blog

Have a strategy idea?

Describe it in plain English, preview where your rules fire, then decide whether the evidence is worth a backtest.

Keep me postedHow it works