Open Legacy Bot — Strategy by Dan-Dynasty

By Dan-Dynasty

Performance Metrics

Description

OPEN LEGACY BOTOpen Legacy Bot is a trading strategy that finds entries with one of two classic methods, filters them with one shared trend check, and manages the whole trade: sessions, news blackouts, take profit and stop loss. It can also send orders to MetaTrader 5 through PineConnector, so what you see in the Strategy Tester is what the alerts send.HOW IT FINDS ENTRIES (Entry Method)• FVG Pullback: a fair value gap is the space left when a candle's low is above the high from two candles earlier (or the reverse for a bearish gap). Gaps smaller than a share of ATR(14) are ignored. A buy fires when price pulls back into a bullish gap and a candle closes bullish back above the gap's bottom, while the gap is still recent (the reverse for sells).• EMA Trend: a buy fires on the first candle where the fast EMA is above the slow EMA, price closes above the fast EMA and RSI(14) is above 50. It fires once per trend leg, not on every candle (the reverse for sells).HOW THE FILTER WORKS (Sensitivity)One setting controls both methods:• Aggressive: every valid setup, with faster lengths (EMA 8/21, short gap lifetime).• Balanced: the setup must also agree with the 50 EMA (EMA 13/34).• Conservative: also needs price on the same side of the 50 EMA on a timeframe 4x the chart, and ADX(14) of 20 or more (EMA 21/55, longer gap lifetime, larger minimum gap).The higher-timeframe check reads the previous completed higher-timeframe candle, so it doesn't repaint.WHY THE PIECES WORK TOGETHERThe entries find the moment to get in. The shared filter decides whether the market is trending enough to act on it. One dial moves both from more trades to fewer, higher-quality trades, so you don't need to tune many separate inputs.TRADE MANAGEMENT• One position at a time. An opposite signal closes the open trade and reverses it.• Take profit and stop loss are fixed distances in pips from the entry.• Up to two trading sessions, each with its own days (Mon-Fri, Tue-Fri, single days, weekends and more), in your timezone. New entries need at least one candle left in the session.• Optional: close open trades at session end.• News blackouts: enter up to three event times. No new trades within the set minutes either side, and an open trade closes when a blackout starts.SCOREBOARDA table shows each closed trade by day and session: TP hit, SL hit, or closed early in profit or loss. It also shows a win %. You can choose This Week, Last Week, a past week, the last 2/4/8/12 weeks, or All Time.AUTOMATION (optional)Fill in your PineConnector License ID, MT5 symbol and lot size. Then create two alerts on the strategy:1. Condition "alert() function calls only", with the webhook on and pointing to your PineConnector URL. This sends buy, sell and close orders, with TP and SL in pips. It also pauses the EA outside your sessions.2. Condition "Order fills only", with the message {{ticker}} {{strategy.order.comment}}, for readable phone notifications such as "XAUUSD BUY" or "XAUUSD TP".Set the alerts to the same timeframe as the chart, and run one timeframe per symbol.DEFAULT PROPERTIES AND WHY• Script execution is on bar close: signals are only confirmed when a candle closes, and orders fill at that candle's close. The strategy doesn't recalculate on every tick or after order fills.• Pyramiding is 1, because the strategy holds one position at a time.• Order size is 1 unit per trade, a fixed quantity, so results don't compound. Your real broker size is set separately by the Lot Size input.• Commission is 0 because this was built for CFD brokers that charge through the spread, not a commission. Spread isn't included in TradingView's backtest. Add your own broker's commission and slippage in Properties to make the results more conservative.EXAMPLE SETTINGS (starting points, not recommendations)These were tested on about three months of 1-minute broker data (Jul-Oct 2026) with real spreads. The samples are small (roughly 30-55 trades each), so treat them as starting points to test yourself, not as expected results.All session times below are Irish time (Europe/Dublin). To use them as written, set the Timezone input to Europe/Dublin wherever you are, and the bot converts them to your chart for you. For example, 07:00-12:00 Dublin is 11:30-16:30 in India while Ireland is on summer time (12:30-17:30 in winter).• XAUUSD, 15m: FVG Pullback, Balanced. Mon-Fri 07:00-12:00 (Europe/Dublin). SL 165 / TP 495 pips.• NAS100, 15m: FVG Pullback, Aggressive. Mon-Fri 18:00-20:30 (Europe/Dublin). SL 550 / TP 1100 pips.• SP500, 15m: EMA Trend, Conservative. Mon-Fri 14:00-18:00 (Europe/Dublin). SL 58 / TP 116 pips.All examples use Points Per Pip 10, Session 2 off and Close Trades At Session End on. Pip values depend on your broker's symbol specification, so check the TP and SL lines on the chart before trading.LIMITATIONS• Backtest fills are at the candle's close, without spread or slippage, so live broker fills will differ.• No method works in every market. Results change a lot by symbol, timeframe, session and settings, so test your own setup.• Points Per Pip must match your symbol (10 suits gold, indices, BTC and 5-decimal FX), or the TP and SL distances on the chart will be wrong.• News blackout times are entered manually.• Automation depends on TradingView alerts, PineConnector and your MT5 terminal all running.This script is for education and testing. It is not financial advice. Past results don't guarantee future results. Test on a demo account first.Release NotesBug fixes...

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView