Platform locks and checklists against revenge trading
-
LondonScalper
- Posts: 965
- Joined: Sat Sep 05, 2026 7:54 am
Platform locks and checklists against revenge trading
I've tried willpower against revenge trading for twenty years. It works most of the time, and fails at the worst possible moments. So now I rely on things that don't need willpower.
The platform lock. I use a small script that watches my account. If I hit two losing trades within 30 minutes, it closes any open charts and blocks new orders for 20 minutes. If I hit my daily loss limit, it blocks new orders until the next day. I can override it, but only by restarting the terminal and typing a reason into a log file. In practice I almost never do, because by the time the terminal restarts I've cooled down.
A paper checklist. Before every trade after a loss, I tick five boxes on a printed sheet:
Is this setup in my playbook?
Would I take this trade if the last one had been a winner?
Is the size my normal size?
Is my stop at a structural level, not just a distance?
Have I waited at least five minutes since the last exit?
If any box is unticked, no trade. It takes about 20 seconds, and that pause is half the value.
Since adding the lock last year, my count of trades taken within ten minutes of a loss has gone from about 15 a month to three or four.
The platform lock. I use a small script that watches my account. If I hit two losing trades within 30 minutes, it closes any open charts and blocks new orders for 20 minutes. If I hit my daily loss limit, it blocks new orders until the next day. I can override it, but only by restarting the terminal and typing a reason into a log file. In practice I almost never do, because by the time the terminal restarts I've cooled down.
A paper checklist. Before every trade after a loss, I tick five boxes on a printed sheet:
Is this setup in my playbook?
Would I take this trade if the last one had been a winner?
Is the size my normal size?
Is my stop at a structural level, not just a distance?
Have I waited at least five minutes since the last exit?
If any box is unticked, no trade. It takes about 20 seconds, and that pause is half the value.
Since adding the lock last year, my count of trades taken within ten minutes of a loss has gone from about 15 a month to three or four.
Re: Platform locks and checklists against revenge trading
Hi LondonScalper,LondonScalper wrote: Sun Oct 04, 2026 8:00 pm I've tried willpower against revenge trading for twenty years. It works most of the time, and fails at the worst possible moments. So now I rely on things that don't need willpower.
The platform lock. I use a small script that watches my account. If I hit two losing trades within 30 minutes, it closes any open charts and blocks new orders for 20 minutes. If I hit my daily loss limit, it blocks new orders until the next day. I can override it, but only by restarting the terminal and typing a reason into a log file. In practice I almost never do, because by the time the terminal restarts I've cooled down.
A paper checklist. Before every trade after a loss, I tick five boxes on a printed sheet:
Is this setup in my playbook?
Would I take this trade if the last one had been a winner?
Is the size my normal size?
Is my stop at a structural level, not just a distance?
Have I waited at least five minutes since the last exit?
If any box is unticked, no trade. It takes about 20 seconds, and that pause is half the value.
Since adding the lock last year, my count of trades taken within ten minutes of a loss has gone from about 15 a month to three or four.
interesting topic in my point of view, thatnks for that.
Your systemic approach to this is a brilliant piece of engineering. By building a mechanical lock that forces a terminal restart and a manual log entry, you have introduced exactly the right amount of friction to break the circuit of a hijacked amygdala. The 20-second pause demanded by the paper checklist does the exact same thing: it shifts your brain from reactive execution back into executive function.
But your broader realization is the absolute truth of the matter: a mechanical lock is ultimately just a tourniquet.
If the underlying perspective hasn't shifted, human nature will eventually find a workaround. You will bypass the script, use a different broker, or trade a different asset class entirely. The permanent cure for revenge trading isn't just blocking the execution; it is achieving such a deep, structural understanding of the market that the desire to revenge trade simply vanishes.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Platform locks and checklists against revenge trading
When you transition from relying on willpower to relying on a profound understanding of market mechanics, your entire relationship with a loss changes. Here is why that deep understanding eventually makes the lock obsolete:
A loss becomes data, not an insult: When you deeply understand raw price action—how liquidity sweeps work, how spreads fluctuate, and how order books shift—you stop viewing a stop-out as the market "taking" your money. You recognize that the market was simply probing for liquidity at a structural level, or that the higher timeframe context shifted. It stops being personal.
Revenge trading loses its logical appeal: If you are scalping on a 1-minute or 5-minute chart and get stopped out, a deep understanding of the 15-minute or daily structure tells you what is actually happening. You realize that jumping right back in usually means entering the exact noisy consolidation or liquidity trap that just burned you. You don't need willpower to avoid the trade, because you can clearly see that the setup is garbage.
True edge removes the urgency: Revenge trading is driven by the panic of needing to "make it back now." When you intimately understand your playbook and the mathematics of your edge over 1,000 trades, that urgency disappears. You know the next structural setup will present itself when the market is ready, not when your ego demands it.
A loss becomes data, not an insult: When you deeply understand raw price action—how liquidity sweeps work, how spreads fluctuate, and how order books shift—you stop viewing a stop-out as the market "taking" your money. You recognize that the market was simply probing for liquidity at a structural level, or that the higher timeframe context shifted. It stops being personal.
Revenge trading loses its logical appeal: If you are scalping on a 1-minute or 5-minute chart and get stopped out, a deep understanding of the 15-minute or daily structure tells you what is actually happening. You realize that jumping right back in usually means entering the exact noisy consolidation or liquidity trap that just burned you. You don't need willpower to avoid the trade, because you can clearly see that the setup is garbage.
True edge removes the urgency: Revenge trading is driven by the panic of needing to "make it back now." When you intimately understand your playbook and the mathematics of your edge over 1,000 trades, that urgency disappears. You know the next structural setup will present itself when the market is ready, not when your ego demands it.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Platform locks and checklists against revenge trading
Your script is the perfect bridge. It buys you the 20 minutes of enforced clarity needed to let your deep understanding take the wheel. Over time, as your mastery of price action deepens, you will likely find that the script rarely even triggers anymore. You won't take those trades because you will look at the chart, see that the structural level hasn't formed yet, and simply walk away.
You have built the perfect guardrail, but it is your deepening mastery of the market's true architecture that is actually paving the road.
You have built the perfect guardrail, but it is your deepening mastery of the market's true architecture that is actually paving the road.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Platform locks and checklists against revenge trading
Because TradingView operates in a sandbox environment, Pine Script cannot physically force your browser to close or restart the terminal the way an MQL5 Expert Advisor or a cTrader cBot can.
However, we can build the exact same logic into a Pine Script Strategy wrapper. This script will act as your tourniquet by acting as a "circuit breaker." If you are automating via webhooks, it will block all orders. If you are trading manually, it turns the chart background a glaring red and displays a massive warning table—serving as that visual pattern interrupt before you click the buy/sell button.
However, we can build the exact same logic into a Pine Script Strategy wrapper. This script will act as your tourniquet by acting as a "circuit breaker." If you are automating via webhooks, it will block all orders. If you are trading manually, it turns the chart background a glaring red and displays a massive warning table—serving as that visual pattern interrupt before you click the buy/sell button.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Platform locks and checklists against revenge trading
Here is the Pine Script (v5) implementation of your mechanical lock:
Code: Select all
//@version=5
strategy("Revenge Trading Lock - Circuit Breaker", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=1)
// ==============================================================================
// USER INPUTS: THE LOCK PARAMETERS
// ==============================================================================
grpLock = "Risk & Lock Settings"
dailyLossLimit = input.float(500, title="Daily Loss Limit ($)", group=grpLock)
lossWindowMinutes = input.int(30, title="Rolling Window for 2 Losses (Minutes)", group=grpLock)
cooldownMinutes = input.int(20, title="Cooldown Lock Period (Minutes)", group=grpLock)
// ==============================================================================
// STATE VARIABLES
// ==============================================================================
var float startOfDayEquity = strategy.initial_capital
var int lastLossTime = 0
var int consecutiveLosses = 0
var int cooldownEndTime = 0
var bool isDailyLocked = false
var int lastTradeCount = 0
// ==============================================================================
// CORE LOGIC: TRACKING TIME & PNL
// ==============================================================================
// 1. Detect a New Day to reset the daily lock and equity tracker
isNewDay = ta.change(time("D")) != 0
if isNewDay
startOfDayEquity := strategy.equity
isDailyLocked := false
consecutiveLosses := 0
// 2. Track Closed Trades for the 30-Minute / 2-Loss Rule
if strategy.closedtrades > lastTradeCount
// A trade just closed. Get its profit and exit time.
lastTradeProfit = strategy.closedtrades.profit(strategy.closedtrades - 1)
tradeExitTime = strategy.closedtrades.exit_time(strategy.closedtrades - 1)
if lastTradeProfit < 0
// Check if the previous loss was within the 30-minute window (30 * 60 * 1000 ms)
if (tradeExitTime - lastLossTime) <= (lossWindowMinutes * 60 * 1000)
consecutiveLosses += 1
else
// Outside the window, reset to 1 recent loss
consecutiveLosses := 1
lastLossTime := tradeExitTime
// If 2 losses hit within the window, trigger the 20-minute cooldown
if consecutiveLosses >= 2
cooldownEndTime := time + (cooldownMinutes * 60 * 1000)
consecutiveLosses := 0 // Reset counter after lock triggers
lastTradeCount := strategy.closedtrades
// 3. Track Daily Equity for the Daily Loss Limit
currentDailyPnL = strategy.equity - startOfDayEquity
if currentDailyPnL <= -dailyLossLimit
isDailyLocked := true
// ==============================================================================
// LOCK EVALUATION & VISUAL FEEDBACK
// ==============================================================================
inCooldown = time < cooldownEndTime
isLocked = isDailyLocked or inCooldown
// Turn the screen aggressively red if daily limit hit, orange for a 20-min timeout
bgcolor(isDailyLocked ? color.new(color.red, 80) : inCooldown ? color.new(color.orange, 85) : na, title="Lock Background")
// Display a UI Table to show system status (replaces the terminal shutdown)
var table statusTable = table.new(position.top_right, 1, 1)
if barstate.islast
if isDailyLocked
table.cell(statusTable, 0, 0, "DAILY LOSS LIMIT HIT\nTrading Locked Until Tomorrow", bgcolor=color.red, text_color=color.white, text_size=size.large)
else if inCooldown
table.cell(statusTable, 0, 0, "AMYGDALA LOCK ACTIVE\nCool down for 20 Minutes", bgcolor=color.orange, text_color=color.white, text_size=size.large)
else
table.cell(statusTable, 0, 0, "SYSTEM READY\nCheck Your Paper Checklist", bgcolor=color.green, text_color=color.white, text_size=size.normal)
// ==============================================================================
// YOUR ENTRY LOGIC GOES HERE
// ==============================================================================
// Example: Basic Price Action or MA Cross
longSetup = ta.crossover(ta.sma(close, 10), ta.sma(close, 20)) // Replace with your actual setup
// The Lock is applied to the entry conditions
if longSetup and not isLocked
strategy.entry("Long", strategy.long)
// strategy.exit("Exit", "Long", stop=yourStop, limit=yourTarget)Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Platform locks and checklists against revenge trading
How to use this as your bridge:
The Webhook Guard: If you link this TradingView script to your broker (via tools like Capitalise or broker webhooks), it literally will not send the execution payload if isLocked is true. The orders will silently fail, forcing you to step away.
The Visual Guard: If you trade manually on the 1-minute or 5-minute chart, you cannot miss the background flipping orange or red. It triggers the exact same 20-second pause as your paper checklist.
Integration: You can drop your specific price action conditions directly into the bottom section where longSetup is defined.
It lacks the sheer brute force of closing your actual platform, but seeing a massive orange box that says "AMYGDALA LOCK ACTIVE" stare back at you is usually enough friction to let the rational part of your brain—the part that understands liquidity and higher timeframe structure—take the wheel again.
The Webhook Guard: If you link this TradingView script to your broker (via tools like Capitalise or broker webhooks), it literally will not send the execution payload if isLocked is true. The orders will silently fail, forcing you to step away.
The Visual Guard: If you trade manually on the 1-minute or 5-minute chart, you cannot miss the background flipping orange or red. It triggers the exact same 20-second pause as your paper checklist.
Integration: You can drop your specific price action conditions directly into the bottom section where longSetup is defined.
It lacks the sheer brute force of closing your actual platform, but seeing a massive orange box that says "AMYGDALA LOCK ACTIVE" stare back at you is usually enough friction to let the rational part of your brain—the part that understands liquidity and higher timeframe structure—take the wheel again.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Platform locks and checklists against revenge trading
Because you are moving out of TradingView's sandbox and into the native MetaTrader environment, we can build the exact brute-force mechanism you described. In MQL4 and MQL5, an Expert Advisor has OS-level access to the terminal interface—meaning we can literally command it to loop through all open window handles and kill the charts, removing the UI you need to trade.
To do this cleanly across your architecture, we build a Background Monitor EA. It runs on a single chart and does three things:
Monitors History: Sweeps your closed deals for the 30-minute/2-loss rule and daily PnL limit.
Global Mutex: If the lock triggers, it writes a MetaTrader GlobalVariable. If you use custom MQL execution scripts or EAs for your entries, they can read this variable and abort execution.
UI Blackout: It loops through ChartNext() and executes ChartClose() on everything except itself, blinding the terminal.
To do this cleanly across your architecture, we build a Background Monitor EA. It runs on a single chart and does three things:
Monitors History: Sweeps your closed deals for the 30-minute/2-loss rule and daily PnL limit.
Global Mutex: If the lock triggers, it writes a MetaTrader GlobalVariable. If you use custom MQL execution scripts or EAs for your entries, they can read this variable and abort execution.
UI Blackout: It loops through ChartNext() and executes ChartClose() on everything except itself, blinding the terminal.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Platform locks and checklists against revenge trading
Here is the implementation for both platforms.
MQL5 Version (MetaTrader 5)
MQL5 Version (MetaTrader 5)
Code: Select all
//+------------------------------------------------------------------+
//| AmygdalaLock_MT5.mq5|
//| Circuit Breaker Monitor|
//+------------------------------------------------------------------+
#property copyright "Custom MT5 Monitor"
#property version "1.00"
input double DailyLossLimit = 500.0; // Daily Loss Limit ($)
input int LossWindowMinutes = 30; // Rolling Window for 2 Losses (Min)
input int CooldownMinutes = 20; // Cooldown Lock Period (Min)
datetime lockReleaseTime = 0;
bool dailyLockActive = false;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Check if a lock survived a terminal restart via GlobalVariable
if(GlobalVariableCheck("AMYGDALA_LOCK"))
{
lockReleaseTime = (datetime)GlobalVariableGet("AMYGDALA_LOCK");
if(TimeCurrent() < lockReleaseTime)
{
// Terminal was restarted, but lock is still mathematically active.
// Require user to read/write log or acknowledge to clear it.
MessageBox("Terminal restarted during active cooldown.\nLog entry required to override, or wait.", "SYSTEM LOCK", MB_ICONWARNING);
}
else
{
GlobalVariableDel("AMYGDALA_LOCK");
}
}
EventSetTimer(1); // Check every second
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Timer function - Core Logic |
//+------------------------------------------------------------------+
void OnTimer()
{
if(TimeCurrent() < lockReleaseTime || dailyLockActive)
{
EnforceLockdown();
return;
}
datetime startOfDay = iTime(Symbol(), PERIOD_D1, 0);
HistorySelect(startOfDay, TimeCurrent());
int totalDeals = HistoryDealsTotal();
double dailyPnL = 0;
int recentLossCount = 0;
datetime lastLossTime = 0;
datetime prevLossTime = 0;
// Loop backwards through today's deals
for(int i = totalDeals - 1; i >= 0; i--)
{
ulong ticket = HistoryDealGetTicket(i);
if(HistoryDealGetInteger(ticket, DEAL_ENTRY) == DEAL_ENTRY_OUT)
{
double profit = HistoryDealGetDouble(ticket, DEAL_PROFIT) +
HistoryDealGetDouble(ticket, DEAL_COMMISSION) +
HistoryDealGetDouble(ticket, DEAL_SWAP);
dailyPnL += profit;
if(profit < 0 && recentLossCount < 2)
{
datetime dealTime = (datetime)HistoryDealGetInteger(ticket, DEAL_TIME);
if(recentLossCount == 0) lastLossTime = dealTime;
if(recentLossCount == 1) prevLossTime = dealTime;
recentLossCount++;
}
}
}
// 1. Check Daily Limit
if(dailyPnL <= -DailyLossLimit)
{
dailyLockActive = true;
Print("DAILY LOSS LIMIT HIT. Locking terminal.");
GlobalVariableSet("AMYGDALA_LOCK", startOfDay + 86400); // Lock until tomorrow
EnforceLockdown();
return;
}
// 2. Check 30-Minute / 2-Loss Rule
if(recentLossCount >= 2)
{
if((lastLossTime - prevLossTime) <= (LossWindowMinutes * 60))
{
lockReleaseTime = TimeCurrent() + (CooldownMinutes * 60);
GlobalVariableSet("AMYGDALA_LOCK", (double)lockReleaseTime);
Print("RAPID LOSSES DETECTED. Locking terminal for 20 minutes.");
EnforceLockdown();
}
}
}
//+------------------------------------------------------------------+
//| Closes all charts to prevent manual trading |
//+------------------------------------------------------------------+
void EnforceLockdown()
{
long currChart = ChartFirst();
int chartsClosed = 0;
while(currChart >= 0)
{
long nextChart = ChartNext(currChart);
// Close everything except the chart running this monitor
if(currChart != ChartID())
{
ChartClose(currChart);
chartsClosed++;
}
currChart = nextChart;
}
if(chartsClosed > 0)
{
PlaySound("timeout.wav");
Comment("\n\n >>> TERMINAL LOCKED <<<\n Check your paper checklist.");
}
}Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Platform locks and checklists against revenge trading
MQL4 Version (MetaTrader 4)
MT4 uses a slightly older history pool mechanic, but the chart manipulation works exactly the same way.
MT4 uses a slightly older history pool mechanic, but the chart manipulation works exactly the same way.
Code: Select all
//+------------------------------------------------------------------+
//| AmygdalaLock_MT4.mq4|
//| Circuit Breaker Monitor|
//+------------------------------------------------------------------+
#property copyright "Custom MT4 Monitor"
#property version "1.00"
#property strict
input double DailyLossLimit = 500.0;
input int LossWindowMinutes = 30;
input int CooldownMinutes = 20;
datetime lockReleaseTime = 0;
bool dailyLockActive = false;
int OnInit()
{
if(GlobalVariableCheck("AMYGDALA_LOCK"))
{
lockReleaseTime = (datetime)GlobalVariableGet("AMYGDALA_LOCK");
if(TimeCurrent() < lockReleaseTime)
{
MessageBox("Terminal restarted during active cooldown.\nLog entry required to override, or wait.", "SYSTEM LOCK", MB_ICONWARNING);
}
else
{
GlobalVariableDel("AMYGDALA_LOCK");
}
}
EventSetTimer(1);
return(INIT_SUCCEEDED);
}
void OnTimer()
{
if(TimeCurrent() < lockReleaseTime || dailyLockActive)
{
EnforceLockdown();
return;
}
datetime startOfDay = iTime(Symbol(), PERIOD_D1, 0);
double dailyPnL = 0;
int recentLossCount = 0;
datetime lastLossTime = 0;
datetime prevLossTime = 0;
int totalHistory = OrdersHistoryTotal();
// Loop backwards through MQL4 history pool
for(int i = totalHistory - 1; i >= 0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))
{
if(OrderCloseTime() >= startOfDay)
{
double profit = OrderProfit() + OrderCommission() + OrderSwap();
dailyPnL += profit;
if(profit < 0 && recentLossCount < 2)
{
if(recentLossCount == 0) lastLossTime = OrderCloseTime();
if(recentLossCount == 1) prevLossTime = OrderCloseTime();
recentLossCount++;
}
}
}
}
if(dailyPnL <= -DailyLossLimit)
{
dailyLockActive = true;
GlobalVariableSet("AMYGDALA_LOCK", startOfDay + 86400);
EnforceLockdown();
return;
}
if(recentLossCount >= 2)
{
if((lastLossTime - prevLossTime) <= (LossWindowMinutes * 60))
{
lockReleaseTime = TimeCurrent() + (CooldownMinutes * 60);
GlobalVariableSet("AMYGDALA_LOCK", (double)lockReleaseTime);
EnforceLockdown();
}
}
}
void EnforceLockdown()
{
long currChart = ChartFirst();
while(currChart >= 0)
{
long nextChart = ChartNext(currChart);
if(currChart != ChartID())
{
ChartClose(currChart);
}
currChart = nextChart;
}
Comment("\n\n >>> TERMINAL LOCKED <<<\n Check your paper checklist.");
}Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.