Strategy vault / Trend following
Fixed Time Breakback Testing Strategy
The main idea of this strategy is to judge whether the closing price of the 5-minute K-line after the market opens at a fixed time point (08:35 UTC+5 time zone here) is higher or lower than the opening price. If the…

Overview
The main idea of this strategy is to judge whether the closing price of the 5-minute K-line after the market opens at a fixed time point (08:35 UTC+5 time zone here) is higher or lower than the opening price. If the closing price is higher than the opening price, go long. If the closing price is lower than the opening price, go short. And set profit targets for long and short positions.
Strategy Principle
The specific principle of this strategy is:
Set the desired trading time, which is 08:35 UTC+5 time zone here.
At this time point, judge whether the closing price of the current 5-minute K-line is higher than the opening price. If the closing price is higher than the opening price, it means that the 5-minute K-line closed with a yang line, go long.
If the closing price is lower than the opening price, it means the 5-minute K-line closed with a yin line, go short.
After going long, set the profit target to exit the long position at $1000. After going short, set the profit target to exit the short position at $500.
Advantage Analysis
The main advantages of this strategy are:
The strategy idea is simple and clear, easy to understand and implement.
The fixed trading time can avoid overnight risk.
Using 5-minute levels to judge trends accurately.
Setting profit targets can lock in profits.
Risk Analysis
There are also some risks to this strategy:
Fixed trading times may miss trading opportunities at other market times. Multiple trading times can be set.
5-minute judgments may not be accurate enough, judgments can be made in combination with multiple timeframes.
The fluctuation between closing price and opening price is too large. Setting a stop loss can reduce risks.
Profit target settings may be too aggressive. More optimized profit points can be set based on historical data testing.
Optimization Directions
The strategy can be optimized in the following aspects:
Set multiple trading times to cover more trading opportunities.
Add stop loss logic to reduce loss risk.
Combine more cycle indicators to improve judgment accuracy.
Use historical data backtesting to test the optimal profit points.
Dynamically adjust position size to manage risks based on specific situations.
Summary
In general, the idea of this fixed time breakback testing strategy is simple and clear. By judging the trend direction at fixed time points and setting profit targets and stop losses to lock in profits and control risks, it is a basic and practical quantitative trading strategy. With more parameter optimization and risk control measures, it can become a reliable quantitative trading system.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_int_1 | 8 | Desired Hour |
| v_input_int_2 | 35 | Desired Minute |
| v_input_1 | 1000 | Long Profit Target (USD) |
| v_input_2 | 500 | Short Profit Target (USD) |
Source Pine Script
/*backtest
start: 2023-12-29 00:00:00
end: 2024-01-28 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Wajahat2
//@version=5
strategy("Buy Sell at 08:35 GMT+5 with Profit Targets", overlay=true)
// Set the desired trading time (08:35 GMT+5)
desiredHour = input.int(8, title="Desired Hour")
desiredMinute = input.int(35, title="Desired Minute")
// Convert trading time to Unix timestamp
desiredTime = timestamp(year, month, dayofmonth, desiredHour, desiredMinute)
// Check if the current bar's timestamp matches the desired time
isDesiredTime = time == desiredTime
// Plot vertical lines for visual confirmation
bgcolor(isDesiredTime ? color.new(color.green, 90) : na)
// Check if the current 5-minute candle closed bullish
isBullish = close[1] < open[1]
// Check if the current 5-minute candle closed bearish
isBearish = close[1] > open[1]
// Define profit targets in USD
longProfitTargetUSD = input(1000, title="Long Profit Target (USD)")
shortProfitTargetUSD = input(500, title="Short Profit Target (USD)")
// Execute strategy at the desired time with profit targets
strategy.entry("Buy", strategy.long, when= isBullish)
strategy.entry("Sell", strategy.short, when= isBearish)
// Set profit targets for the long and short positions
strategy.exit("Profit Target", from_entry="Buy", profit=longProfitTargetUSD)
strategy.exit("Profit Target", from_entry="Sell", profit=shortProfitTargetUSD)
Published by ChaoZhang on the FMZ strategy square · last modified 2024-01-29. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Fixed-Time-Breakback-Testing-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- 200 EMA VWAP MFI Trend Following StrategyPine Script · Trend following · 1d
- 4 EMA Trend StrategyPine Script · Trend following · 1d
- ADX MA and EMA Long Only Trend Tracking StrategyPine Script · Trend following · 1d
- ATR Dynamic Profit Target and Stop Loss StrategyPine Script · Trend following · 1d
- ATR Dynamic Trend Following and EMA Crossover Trading StrategyPine Script · Trend following · 1d
- ATR and Moving Average Crossover Hybrid StrategyPine Script · Trend following · 1h