How to code a 3-bar play with VWAP on 5-minute candles
Strategy1,622 views
Ross Dmello
Symbol : Will manually add the symbols of 1 or max 2 stocks every morning
Criteria 1 : First 5 min candle opens below Vwap(5 Min) & Closes above the Vwap(5 Min)
Criteria 2 : Second 5 min candle open and close(candle Body) is less than high of First 5 min candle and the 5 Min Vwap
Criteria 3 : Calculate Qty “2000/ First 5 min candle high - 2nd 5 min candle Low”
Criteria 4: Entry on the Third bar when price crosses a few ticks above the first candle high
Criteria 5 : Exit at Market price if ‘Third 5 Min entry candle’ closes below the First 5 Min candle high
Criteria 6 : Exit at Market Price if Third 5 min entry candle volume is less than Second 5 min candle Volume
Criteria 7 : Stoploss will be the Entry Candle Low
P.S will manage the trade for the rest of the day Manually
Example : https://prnt.sc/vlinrh
Learn
@superkid - Were you able to code this? Let me know if you are stuck on any of the points. I may be able to help out
Tradetron TeamTradetron team
This setup can be built in the Strategy builder, but it has several parts. Here are the keywords for each one.
Candle values at a fixed time:Indicator Value (Time) returns a series value at a clock time today, e.g. Indicator Value (Time)(HIGH(<stock>, '5m'), '09:20') for the first candle’s high. OPEN, CLOSE, HIGH, LOW with Position read the last closed candles.
VWAP comparison: the VWAP keyword (current value) on the same stock.
Store levels for later: save the first-candle high and second-candle low as runtime variables and read them back with Get Runtime Number.
Quantity formula (2000 / range): in the leg’s Qty, use Fx with Math Operation (/) and the stored values. Remember Qty for F&O is in lots.
Entry on the third bar:LTP > Get Runtime Number(first_high) + a few ticks, gated with Time so it only checks from the third candle.
Exits: a set exit with Position(CLOSE(<stock>, '5m'), -1) < Get Runtime Number(first_high).
Your own symbols each morning: use a list, or use one-click instrument change on the deployment.
Note that VWAP is not supported in backtests, so test this in Live Offline. If you’d like it built for you, the paid Strategy Creation service is at https://questionnaire.tradetron.tech/. You can also connect your AI to Tradetron via MCP and build it together.
Answer written with AI from Tradetron docs (Oct 2026). Original replies are kept above. Spot something wrong? Reply below.