Tools · Behavioral

Buy Lock

A Chrome extension that stops the Buy button on TradingView from working until a timer runs out. Here is what it does, and why taking a button away from yourself is worth anything at all.

What it does

You click the toolbar icon, pick a duration, and Buy controls on TradingView stop responding. Sell and order management keep working, so you can still manage or close whatever you already have on.

Durations run from 15 minutes to the 3:00 pm Central close. Pick one of those and there is no unlock button until it expires. Pick “until I unlock it” and you have to type the word UNLOCK to get out. That is the whole product.

Why a button does anything

Accounts rarely die in one trade. They die across a long series of decisions that each looked reasonable on its own. Thirty reloads at $5,000 pass a sanity check that a single $150,000 loss never would.

The engine is a loop:

Loss a feeling you can’t sit with “this time I’ll do it right” reload loss

Money is not the subject of that sequence. It’s an emotion-regulation loop that happens to be denominated in dollars. Cognitive behavioral therapy is built for exactly this shape: a thought you never examine, a feeling you can’t tolerate, and a behavior that relieves the feeling while making the situation worse. Below are the pieces that apply to a screen and an order ticket.

1. The reload thought is a prediction, and it has a record

“This time I can do it. I’ve learned my lesson.” That is a testable claim about the next session. Run it thirty times and you have thirty results sitting there unread. It survives because each time it arrives feeling like fresh reasoning rather than a script you have already run.

Write the prediction down with a date and a number before you act on it. A prediction you can score stops being a mood.

2. The trade is doing a job, and the job is not profit

Putting money back repairs a belief. “I’m a good trader” is what the loss threatens, and reloading keeps the verdict open. It converts shame you can’t hold into hope you can. Sitting still would make the loss final, which is why sitting still is the expensive part.

3. The feared meaning is smaller than it feels

Underneath is usually something like “I’m not cut out for this.” Read plainly, that is a statement about one skill in one domain. Almost nobody is cut out for discretionary trading, about the way almost nobody is cut out for professional poker. Trading is one hypothesis about how to reach a financial goal. Dropping a method that failed is not failing at the goal.

4. Four problems, one mechanism

SituationThe failure
Green morningcan’t stop
Red morningcan’t accept
No setupcan’t sit out
Blown accountcan’t let it be final

All four are an inability to be done, to let a state stand and do nothing about it.

Flat is a position. It’s the one position that’s hard to hold.

Afternoon giveback is not a separate discipline problem. It’s the reload loop compressed into a single day, where a $500 loss you can’t accept turns into $5,000.

5. The urge shows up dressed as analysis

It rarely says “I want action.” It says volume is picking up, or that’s the same setup as this morning, or just a small one with no size.

A usable test: say the setup out loud in one sentence before you click. Real setups survive being spoken. Impulses fall apart halfway through.

6. Urges break by themselves

Restlessness rises, peaks, and passes, usually inside half an hour. You do not have to win the argument, only outlast it. Name it (“this is the wave, not a signal”), write down the time, get up and walk instead of white-knuckling it at the desk, then log how long it took to pass. Twenty entries will show you your trigger pattern and give you evidence that the thing breaks without a trade.

Do not take a small version of the trade. That is the door from one mistake into a spiral.

7. A mistake is a data point

The dangerous thought is not the first slip. It’s the one right behind it: well, I’ve already broken the rule, might as well. Stop at the slip and it stays a slip.

8. Friction beats willpower

A decision you make calm does not transfer to the version of you who is not calm. Planning around future-you’s judgment is how the loop keeps running. Use present-you’s judgment to remove future-you’s options.

That is all this extension is. Cool-state you, taking the button away from hot-state you.

One warning

Building the tool can quietly become a way to spend the day near the market. If you find yourself tuning the lock instead of being away from the screen, the loop found a new costume.

How it works

Manifest V3 content script, injected at document_start
Runs on *://*.tradingview.com/* in all frames, before the page scripts get going.
Events blocked at window capture phase
It listens on window with capture: true for pointerdown, pointerup, mousedown, mouseup, click, dblclick, and for Enter or Space on keydown and keyup. Capture phase runs before the page’s own handlers, so the click is dead on arrival and the chart’s constant re-rendering never gets a chance to detach anything.
Buy controls found by data attribute, not by class
The anchor is data-name="side-control-buy". TradingView’s class hashes rotate between builds, so class prefixes and label text are fallbacks only.
Submit is blocked conditionally
The order-submit button is blocked only while the ticket’s Buy side is active, so a ticket already toggled to Buy can’t be sent, and a Sell ticket goes through untouched.
Visible state
A MutationObserver on a 400 ms debounce greys out locked controls with a dashed red outline. A click on one throws a toast reading “Buy is locked, you locked it for a reason.” The toolbar badge shows ON while a lock is live.
Storage and permissions
Lock state lives in chrome.storage.local as two fields, locked and lockUntil. The only permission requested is storage. There is no account, no server, and no network call anywhere in the code.

What it can’t do

This is friction, not a vault. Every one of these gets around it:

That’s fine for what it’s for. A few seconds of friction at the moment of the urge is often enough, because the urge is on a clock and you are only trying to outlast it. If you need something that actually holds, the strong versions live outside your own hands:

One external constraint is worth about five self-administered ones.

Download

v1 the version this page describes
🔒 tv-buy-lock.zip
v1.0.0 · Manifest V3 · 8 KB · 397 lines

Manual lock only. Pick a duration, Buy stops working, no network calls, one permission. Everything above under “How it works” is this build.

v2 in progress, less tested
🔒 tv-buy-lock-v2.zip
v1.3.0 · Manifest V3 · 12 KB · 694 lines

Adds the locks you don’t have to remember to set:

PnL comes from the Daily PnL field in TradingView’s account manager header, read every two seconds from an open tab. No reading means no trigger, so the schedule is the piece that works unattended. Permissions are storage and alarms, on tradingview.com only. Still no network calls.

Treat this one as a work in progress. It reads a panel whose markup TradingView can change without telling anyone, and a lock that silently stops firing is worse than no lock, because you stop watching for it. Check the badge says ON when you expect it to.

Installing either one
  1. Unzip it somewhere you won’t delete by accident.
  2. Open chrome://extensions.
  3. Turn on Developer mode, top right.
  4. Click Load unpacked and select the tv-buy-lock folder.
  5. Pin the lock icon to your toolbar.
Read this before you install it

I take no responsibility for anything that happens to your account, your computer, or your money. Use it at your own risk.

This was vibe coded by a random milkman on the internet. Don’t take my word that it works and don’t take my word that it isn’t spyware. Either zip is a few hundred lines of readable JavaScript, CSS, and HTML. Open it, paste the files into Claude or ChatGPT, and ask whether it does what this page says and whether it sends anything anywhere. Then decide.

Nothing here is financial advice, and nothing here is a substitute for talking to an actual professional about compulsive behavior.