Exit from specific entries
Pine Script strategy by Zer3192.
Pine ScriptOther
The original spec has no written description. Read the source below.
Source Pine Script
//@version=4
strategy(title="Exit from specific entries", overlay=true,
pyramiding=2, close_entries_rule="ANY")
// Determine trading conditions
newDay = (dayofmonth != dayofmonth[1])
firstEntry = newDay and (dayofweek == dayofweek.monday)
secondEntry = newDay and (dayofweek == dayofweek.tuesday)
firstExit = newDay and (dayofweek == dayofweek.thursday)
secondExit = newDay and (dayofweek == dayofweek.friday)
// Submit entry orders
if (firstEntry)
strategy.entry(id="EL 1", long=true)
if (secondEntry)
strategy.entry(id="EL 2", long=true)
// Generate exit orders
if (firstExit)
strategy.close(id="EL 2")
if (secondExit)
strategy.close(id="EL 1")Published by Zer3192 on the FMZ strategy square · last modified 2023-01-07. 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/Exit-from-specific-entries.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.