FT Strategy Engine - Template by FuturesTeller
By FuturesTeller
Performance Metrics
- Author: FuturesTeller
- Symbol: CME_MINI:MNQ1!
- Timeframe: 2 hours
Description
This script is a strategy template: the execution engine, sizing, risk management, session logic, alerts, and visuals are already implemented. You only need to customize the two user-selectable “switch” blocks that define (1) when to trade and (2) where to place stop/limit entries.Inside the code itself, you will find additional information on how to use and edit the code.1) What you must edit (the only required code edits)TRADE CONDITIONS → Add your condition names to the dropdowns and implement the matching cases in the two switches:Long Condition selector → returns true/falseShort Condition selector → returns true/falseDIRECTIONS AND ORDERS → Add your entry level names to the dropdowns and implement the matching cases in the two level switches:Buy Order Level selector → returns a price (float) for stop/limit longsSell Order Level selector → returns a price (float) for stop/limit shortsCritical rule (compile safety)Every label you add inside the input options=[...] must exist as a corresponding case inside the related switch. If an option exists but the switch has no matching case, the script will not compile.2) Directions & order types (no code required)In DIRECTIONS AND ORDERS you can control both trade direction and order style:Strategy can Trade: Both sides, only one side, or “one side used to close the opposite side”.Long/Short Order Type: market, stop, or limit.If you select market, entry levels are ignored automatically (levels can remain “None”).If you select stop or limit, you must choose a valid entry level (not “None”).Ignore entry conditions for closing orders: if you are using the opposite side as a “close engine”, this option can allow closes to bypass time window / pause / weekday / max daily trades constraints (as implemented in the template logic).3) Risk management & position sizing POSITION SIZING provides multiple sizing modes:Fixed quantity (shares/contracts)Capital-based sizing (with optional leverage factor)Sizing based on strategy net profit (with or without initial capital)A minimum quantity clamp is available.STRATEGY MONEY MANAGEMENT controls exits:Stop Loss, Take Profit, Break Even can be set as points, percentage, or ATR-multiple (set value to 0 to disable).Optional SMA trailing exit closes trades on a profit retrace through the chosen SMA.A Max Trade Duration feature can force-close trades after a specified number of sessions, with a configurable closing time.4) Time, sessions, daily limits, and weekdays (inputs only)SESSION TIMES + Timezone: define the session boundaries and how time is interpreted.STRATEGY PARAMETERS: operational window, optional intraday pause, max trades per day, max trade duration, and “do not trade” weekday filters (separately for long/short).5) LONG & SHORT FILTERS — OHLC Pattern filters (library-based)This template includes an OHLC-pattern filter layer (computed from session/day OHLC) that can gate trades:Global filters for both directions (“Operate IF” / “Operate if NOT”)Side-specific filters (“Go Long IF (all)” / “Go Short IF (all)” + side-specific NOT filters)Optional OHLC Pattern Panel and bar/background highlights for quick visual validation.You can find the pattern list inside FT_TV_template_lib library under ZPattern_MostUsed function.These filters are applied in the execution logic as additional requirements before placing orders.6) Alerts (order-fill ready)The strategy embeds structured alert messages via Pine Script®@strategy_alert_message and per-order Pine Script®alert_message. Create a TradingView alert on this strategy using the order fills / strategy execution trigger so each entry/exit carries:Strategy nameActivity (Entry / Exit / Inversion)Side opened/closedOrder type and level (or N/A)Reason tag (Signal / Cover / Risk Management / Max Days Limit / SMA Cover)7) LONG - SHORT TABLE (Debug table)Enable Show Long/Short status table to display a compact, bar-by-bar debug panel (updates on bar close) showing whether each prerequisite is currently satisfied for Long and Short, including time window, pause state, max daily trades, weekday filter, pattern filters, and the selected entry condition result.8) PLOTTED TRADES (Visual execution)In PLOTTED TRADES you can display dynamic SL/TP/Entry(BE) levels on chart, with colored trade's areas.NotesCFD commissions: the strategy properties include default commissions. For CFD use, consider removing the commission in the Properties panel, or alternatively adjust sizing via Fixed Amount to Trade to better reflect your CFD sizing model.Recalculation mode: some visual/risk-management elements may benefit from enabling On every tick. However, trade logic is executed only on confirmed bars using Pine Script®if barstate.isconfirmed, so orders are generated at bar close, helping avoid intrabar “repainting-style” effects (your custom conditions should also be stable at bar close).DISCLAIMERThis script and its description are provided for educational and informational purposes only. They do not constitute investment advice, portfolio management, legal or tax advice, or a recommendation to buy, sell or hold any financial instrument.By using this script, you acknowledge that: You are solely responsible for any trades you place, any configuration changes you make, and any financial decisions you take based on this or other tools. Futures and derivative instruments can be highly leveraged and involve a high level of risk. You should carefully assess whether such trading is appropriate for your circumstances and, if necessary, consult a qualified and regulated financial professional. Neither FuturesTeller, nor the author of the script, nor any associated party can be held liable for losses, damages or issues arising from the use, misuse or inability to use this script, including but not limited to technical errors, data problems, misconfigurations or market events. Any backtests, performance summaries or examples you may obtain using this script are hypothetical] or historical and cannot guarantee future results. Market conditions can change at any time and past behaviour may not repeat.Using this script implies that you accept these limitations and understand that past performance is not indicative of future results.