Strategy · Pine Script v6 · On the chart

Forven S01512 - Monday Drift

by judder659

Forven S01512 — Monday Drift is a calendar-based long trading strategy designed to exploit time-based recurring market patterns.

View on GitHub

GitHub stars361on the repository
Pine versionv6current
Lines of code98
Settings7inputs
LicenceAGPL-3.0
Last updatetoday28 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

98 lines of Pine Script v6 from forven/docs/pine/monday_drift.pine, published under AGPL-3.0. Keep the author's credit and licence lines when you reuse it.

monday_drift.pine
// ============================================================================
// Monday Drift — TradingView clone of Forven S01512
// ============================================================================
// Purpose: cross-validate a pure calendar strategy against TradingView, and
// give you a visual of WHEN it trades (once a week, 24-hour hold).
//
// Forven side
//   strategy_id : S01512  (monday_drift)
//   dataset     : BTC/USDT-1h  (binance)
//   window      : 2023-12-31 00:00 UTC  →  2026-04-19 23:00 UTC  (~2y 3m)
//   leverage    : 1x
//   fee model   : ~11 bps round-trip (5.5 bps per side)
//   entry       : Monday  00:00 UTC  (open a long)
//   exit        : Tuesday 00:00 UTC  (close the long — 24 bars held)
//
// Expected Forven numbers (BTC, long-only, single-side, ~2y 3m window)
//                   trades   win_rate    CAGR    sharpe   max_dd   profit_factor
//   Full run         118      0.542    +94.45%   1.41     44.33%      1.70
//   OOS segment       —        —       +58.39%   1.24       —           —
//
// Sanity-check 1-year slice (2025-04-20 → 2026-04-19, same Pine via input change)
//                   trades   win_rate    return    profit_factor
//   TradingView       53      0.491     +18.77%       1.60
//   Forven            50      0.460     +14.50%        —
//
// Robustness
//   OOS Sharpe 1.24 on a 70/30 split over ~118 trades is not a lucky streak.
//   The effect held across BTC and SOL. Still deploy with a WR kill-switch
//   (< 55% over 5 live trades).
//
// Math note
//   Pine's dayofweek constants are 1=Sunday, 2=Monday, 3=Tuesday, ...
//   pandas weekday is 0=Monday, so Forven entry `weekday==0` ≡ Pine
//   `dayofweek == dayofweek.monday` (both with `hour == 0`).
// ============================================================================

//@version=6
strategy(
     title              = "Forven S01512 — Monday Drift",
     shorttitle         = "S01512",
     overlay            = true,
     pyramiding         = 0,
     initial_capital    = 10000,
     default_qty_type   = strategy.percent_of_equity,
     default_qty_value  = 100,
     commission_type    = strategy.commission.percent,
     commission_value   = 0.055,
     slippage           = 0,
     calc_on_every_tick = false,
     process_orders_on_close = true)

// ---- Inputs ----------------------------------------------------------------
entry_dow  = input.int(2, "Entry day of week  (1=Sun..7=Sat)", minval = 1, maxval = 7, group = "Schedule")
entry_hour = input.int(0, "Entry hour (UTC, 0–23)",            minval = 0, maxval = 23, group = "Schedule")
exit_dow   = input.int(3, "Exit day of week   (1=Sun..7=Sat)", minval = 1, maxval = 7, group = "Schedule")
exit_hour  = input.int(0, "Exit hour (UTC, 0–23)",             minval = 0, maxval = 23, group = "Schedule")

use_window = input.bool(true, "Restrict to Forven window", group = "Date range")
// Hardcoded epoch ms:
//   1703980800000 = 2023-12-31 00:00:00 UTC
//   1776675600000 = 2026-04-19 23:00:00 UTC
start_ts   = input.time(1703980800000, "Window start (UTC)", group = "Date range")
end_ts     = input.time(1776675600000, "Window end (UTC)",   group = "Date range")

// ---- Time gate -------------------------------------------------------------
// Chart timezone for dayofweek/hour is UTC to match Forven's pd.to_datetime(utc=True).
dow  = dayofweek(time, "UTC")
hr   = hour(time, "UTC")
in_window = not use_window or (time >= start_ts and time <= end_ts)

// ---- Signals ---------------------------------------------------------------
is_entry_bar = (dow == entry_dow) and (hr == entry_hour)
is_exit_bar  = (dow == exit_dow)  and (hr == exit_hour)

if in_window and is_entry_bar
    strategy.entry("MondayLong", strategy.long)

if is_exit_bar
    strategy.close("MondayLong")

// Force-flat at window end so totals line up with Forven.
if use_window and (time > end_ts)
    strategy.close_all()

// ---- Visuals ---------------------------------------------------------------
plotshape(is_entry_bar and in_window, title = "Monday entry",
     style = shape.triangleup,   location = location.belowbar,
     color = color.new(color.green, 0), size = size.small)

plotshape(is_exit_bar, title = "Tuesday exit",
     style = shape.triangledown, location = location.abovebar,
     color = color.new(color.red, 0),   size = size.small)

bgcolor(in_window ? color.new(color.blue, 92) : na, title = "In-window shading")

// Subtle band highlighting "in a Monday trade" bars.
in_trade = strategy.position_size > 0
bgcolor(in_trade and in_window ? color.new(color.green, 90) : na, title = "In-trade shading")

Overview

Forven S01512 - Monday Drift tracks UTC calendar days and hours to enter a long position at a specified day and hour, holding it for a fixed duration until an exit day and hour are reached. Users can customize the entry and exit schedules and restrict backtesting to a specific start and end timestamp window. Executed directly on the main chart, the strategy operates purely on scheduling and contains no built-in stop loss or take profit mechanisms.

Details

Published by

judder659 on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Sessions & time

Markets

Crypto

Timeframes

M15-H1, H4 and above

Risk Notes

  • The strategy enters trades without a stop loss

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Entry day of week (1=Sun..7=Sat)int2entry_dow
Entry hour (UTC, 0–23)int0entry_hour
Exit day of week (1=Sun..7=Sat)int3exit_dow
Exit hour (UTC, 0–23)int0exit_hour
Restrict to Forven windowbooltrueuse_window
Window start (UTC)time1703980800000start_ts
Window end (UTC)time1776675600000end_ts
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This overlay strategy offers two selectable entry modes: a Bollinger squeeze on typical price and a simple moving-average cross. It filters trades by weekday, session, date range, and an optional news window, and can restrict direction or invert the side. Risk

Strategy v5 Volatility & bandsMoving averages
Updated today · None stated GitHub repository of Boilerplate Configurable Strategy [Yosiet]
257 stars

Donald - Test Logic Futures is an overlay strategy designed for intraday futures trading. It combines kernel regression functions with exponential moving averages to evaluate price retracements and entry timing. Trades are filtered by session execution windows

Strategy v5 TrendMoving averages Repaints
Updated 6 weeks ago · None stated GitHub repository of Donald - Test Logic Futures

Daily Bias + FVG Strategy

by TradersPost
218 stars

This overlay strategy plots previous-day high and low, the daily open, and fair value gap zones on the price chart. It takes entries on a selectable timeframe when the FVG requirement and an optional session window allow them, then uses an ATR or fixed pip sto

Strategy v6 SMC / ICT / price actionSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Daily Bias + FVG Strategy
106 stars

This script monitors opening gap conditions and breakout behavior relative to the first candle's range across up to twenty configurable stock tickers. It detects whether following bars remain inside the opening range before breaking out, displaying the status

Strategy v4 Screeners & dashboardsBreakout Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 1St Bar GAP+BkOut Screener v2 by RM
53 stars

This strategy enters long or short on the price chart when price is on the correct side of a 200-period EMA, MACD agrees, RSI is not at the opposing extreme, ADX exceeds a threshold, volume beats a 20-bar average, and close breaks the recent high or low. A tim

Strategy v6 TrendOscillators & momentum
Updated 2 months ago · MPL-2.0 GitHub repository of BTCUSD 5M Optimized Strategy

ATOM 1m scalp HK

by dearvn
43 stars

This overlay strategy targets one-minute ATOM scalps. It tracks pivot highs and lows as resistance and support, compares a three-period EMA with a multi-stage smoothed close, and flags long or short when price crosses that curve in the matching direction. Dail

Strategy v5 ScalpingSupport & resistance Repaints
Updated 2 years ago · None stated GitHub repository of ATOM 1m scalp HK

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers