OPEN-SOURCE SCRIPT
LANZ Strategy 5.0 [Backtest]

๐ท LANZ Strategy 5.0 [Backtest] โ Rule-Based BUY Logic with Time Filter, Session Limits and Auto SL/TP Execution
This is the backtest version of LANZ Strategy 5.0, built as a strategy script to evaluate real performance under fixed intraday conditions. It automatically places BUY and SELL trades based on structured candle confirmation, EMA trend alignment, and session-based filters. The system simulates real-time execution with precise Stop Loss and Take Profit levels.
๐ Built for traders seeking to simulate clean intraday logic with fully automated entries and performance metrics.
๐ง Core Logic & Strategy Conditions
โ BUY Signal Conditions:
If all are true, a BUY order is executed at market, with SL and TP set immediately.
๐ป SELL Signal Conditions (Optional):
Exactly inverse to BUY (below EMA + 3 bearish candles). Disabled by default.
๐ Operational Time Filter (New York Time)
You can fully customize your intraday window:
The system evaluates signals only within this range, even across midnight if configured.
๐ Trade Management System
๐งช Backtest Accuracy
This version uses:
This ensures realistic behavior in the TradingView strategy tester.
โ๏ธ Flow Summary (Step-by-Step)
On every bar, check:
If conditions met โ A BUY trade is opened:
Trade closes:
๐ Settings Overview
๐จโ๐ป Credits:
๐ก Developed by: LANZ
๐ง Strategy logic & execution: LANZ
โ Designed for: Clean backtesting, clarity in execution, and intraday logic simulation
This is the backtest version of LANZ Strategy 5.0, built as a strategy script to evaluate real performance under fixed intraday conditions. It automatically places BUY and SELL trades based on structured candle confirmation, EMA trend alignment, and session-based filters. The system simulates real-time execution with precise Stop Loss and Take Profit levels.
๐ Built for traders seeking to simulate clean intraday logic with fully automated entries and performance metrics.
๐ง Core Logic & Strategy Conditions
โ BUY Signal Conditions:
- Price is above the EMA200
- The last 3 candles are bullish (close > open)
- The signal occurs within the defined session window (NY time)
- Daily trade limit has not been exceeded
If all are true, a BUY order is executed at market, with SL and TP set immediately.
๐ป SELL Signal Conditions (Optional):
Exactly inverse to BUY (below EMA + 3 bearish candles). Disabled by default.
๐ Operational Time Filter (New York Time)
You can fully customize your intraday window:
- Start Time: e.g., 01:15 NY
- End Time: e.g., 16:00 NY
The system evaluates signals only within this range, even across midnight if configured.
๐ Trade Management System
- One trade at a time per signal
- Trades include a Stop Loss (SL) and Take Profit (TP) based on pip distance
- Trade result is calculated automatically
- Each signal is shown with a triangle marker (BUY only, by default)
๐งช Backtest Accuracy
This version uses:
- strategy.order() for entries
- strategy.exit() for SL and TP
- strategy.close_all() at the configured manual closing time
This ensures realistic behavior in the TradingView strategy tester.
โ๏ธ Flow Summary (Step-by-Step)
On every bar, check:
- Is the time within the operational session?
- Is the price above the EMA?
- Are the last 3 candles bullish?
If conditions met โ A BUY trade is opened:
- SL = entry โ X pips
- TP = entry + Y pips
Trade closes:
- If SL or TP is hit
- Or at the configured manual close time (e.g., 16:00 NY)
๐ Settings Overview
- Timeframe: 1-hour (ideal)
- SL/TP: Configurable in pips
- Max trades/day: User-defined (default = 99 = unlimited)
- Manual close: Adjustable by time
- Entry type: Market (not limit)
- Visuals: Plotshape triangle for BUY entry
๐จโ๐ป Credits:
๐ก Developed by: LANZ
๐ง Strategy logic & execution: LANZ
โ Designed for: Clean backtesting, clarity in execution, and intraday logic simulation
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.