protect a position I’ve been holding

VR555

Member
VIP
Incredibly fine work here! Do you have any recommendations on how to adapt this for one who wants to swing trade, and even more importantly, protect a position I’ve been holding onto since August 2017 in QQQ?
 
Solution
Incredibly fine work here! Do you have any recommendations on how to adapt this for one who wants to swing trade, and even more importantly, protect a position I’ve been holding onto since August 2017 in QQQ?
As far as how I would use the write up (and @JK1 please add your ideas), is understand the core process is Context → Structure → Momentum → Probability → Execution. It also separates setup vs trigger, and specifically says EXHAUSTION = exit/avoid and HIGH IV + RANGE = premium selling. This is a trading system and kinda philosophy.

For QQQ protection, the better adaptation is:

Swing trade layer:
Use the dashboards to classify QQQ as COIL / IGNITING / RUNNING / EXHAUSTION...
Incredibly fine work here! Do you have any recommendations on how to adapt this for one who wants to swing trade, and even more importantly, protect a position I’ve been holding onto since August 2017 in QQQ?
As far as how I would use the write up (and @JK1 please add your ideas), is understand the core process is Context → Structure → Momentum → Probability → Execution. It also separates setup vs trigger, and specifically says EXHAUSTION = exit/avoid and HIGH IV + RANGE = premium selling. This is a trading system and kinda philosophy.

For QQQ protection, the better adaptation is:

Swing trade layer:
Use the dashboards to classify QQQ as COIL / IGNITING / RUNNING / EXHAUSTION, then only add exposure during COIL → IGNITING or controlled pullbacks in RUNNING.

Core-position protection layer:
Do not sell because one signal turns red. Reduce or hedge only when multiple independent factors align:

Daily/Weekly trend weakening
QQQ below key value/MA level
Momentum state shifts to EXHAUSTION
Sell pressure/risk score rises
Market alignment weakens

That matches the document’s rule: a scenario defines when you are allowed to execute, while the strategy defines how you execute.

For the QQQ holding, the protection actions should be staged: (new script I gave you)

GREEN: Hold core
YELLOW: Stop adding / trim covered call risk
ORANGE: Hedge 25%-50% with puts or collars
RED: Reduce major exposure

The sharper truth: protecting a 2017 QQQ position is not a trading problem. It is a capital preservation policy problem. The framework should tell you when the asset has changed character, not when a short-term indicator flickers.

I hope that helps.
 
Solution
This is an interesting problem. You don't own a trade. You own a wealth asset. QQQ from August 2017 has likely appreciated several hundred percent. The biggest danger isn't missing upside. The biggest danger is giving back years of gains during a secular bear market.

What and How I Would Track Instead is that I would create a separate label: QQQ CAPITAL PRESERVATION MODE based on: 1) Monthly TMO. If Monthly TMO turns down: RISK = ELEVATED. 2) Weekly TMO, If Weekly turns down while Monthly is weakening: RISK = HIGH.

40 Week Moving Average (roughly 200-day MA). If QQQ closes below 40-week MA: DEFENSE ALERT.
30 Week MA Slope, borrowing from Stan Weinstein:

If:
  • Price below 30-week MA
  • 30-week MA rolling over
then: EXIT LONG-TERM HOLD. This catches most secular bear markets.

What History Says is if you had you used:
  • Weekly TMO
  • 30 Week MA
  • Monthly TMO
you would have avoided most of:
  • 2000 crash
  • 2008 crash
  • 2022 bear market
while staying invested through almost all major bull runs. No system catches the exact top, (or the bottom), but preserving capital matters more than selling the exact high or buying at the exact low.

What I Would Use is a dedicated QQQ Wealth Protection Dashboard with labels like:

MONTHLY TREND: UP
WEEKLY TREND: UP
30W MA: RISING
PRICE: ABOVE 30W
RISK LEVEL: LOW

ACTION: HOLD CORE POSITION

Then when conditions deteriorate labels would indicate:

MONTHLY TREND: DOWN
WEEKLY TREND: DOWN
30W MA: FALLING
PRICE: BELOW 30W

RISK LEVEL: CRITICAL

ACTION:
REDUCE 25%-50%
SELL COVERED CALLS
ADD PROTECTIVE PUTS

Notice that's very different from daily ES and NVDA trading tools.
Thsi is a dedicated QQQ Capital Preservation / Wealth Protection Engine for ThinkOrSwim that grades the position:
  • GREEN = Hold Aggressively
  • YELLOW = Tighten Risk
  • ORANGE = Hedge
  • RED = Exit / Major Reduction
using Monthly TMO, Weekly TMO, 30-Week MA, Relative Strength, and a market regime filter. That would be closer to how institutions manage decade-long winners than a normal trading indicator. Add this to your QQQ chart. Not advice - just something I would do. YOU CAN HIDE THE PLOTTED LINES IF YOU WANT. this is not advice nor recommendations on trades; these labels are just to get your attention so you can do your own research and planning and executions.

Code:
# ==========================================================
# QQQ CAPITAL PRESERVATION / WEALTH PROTECTION ENGINE
# Built for long-term core holdings protection
# antwerks framework adaptation
# ==========================================================

declare upper;

# ==========================================================
# INPUTS
# ==========================================================
input showLabels = yes;
input showMAs = yes;

input weeklyTMOLength = 14;
input weeklyTMOCalcLength = 5;
input weeklyTMOSmoothLength = 3;

input monthlyTMOLength = 14;
input monthlyTMOCalcLength = 5;
input monthlyTMOSmoothLength = 3;

input shortWeekMA = 30;
input longWeekMA = 40;

input defensiveScoreTrigger = 4;
input hedgeScoreTrigger = 6;
input exitScoreTrigger = 8;

# ==========================================================
# WEEKLY / MONTHLY PRICE
# ==========================================================
def wClose = close(period = AggregationPeriod.WEEK);
def mClose = close(period = AggregationPeriod.MONTH);

# ==========================================================
# TMO FUNCTION
# ==========================================================
script TMO {
    input price = close;
    input length = 14;
    input calcLength = 5;
    input smoothLength = 3;

    def ema1 = ExpAverage(price - price[1], length);
    def ema2 = ExpAverage(ema1, calcLength);
    plot out = ExpAverage(ema2, smoothLength);
}

# ==========================================================
# WEEKLY / MONTHLY TMO
# ==========================================================
def weeklyTMO =
    TMO(
        wClose,
        weeklyTMOLength,
        weeklyTMOCalcLength,
        weeklyTMOSmoothLength
    );

def monthlyTMO =
    TMO(
        mClose,
        monthlyTMOLength,
        monthlyTMOCalcLength,
        monthlyTMOSmoothLength
    );

def weeklyTMORising = weeklyTMO > weeklyTMO[1];
def weeklyTMOFalling = weeklyTMO < weeklyTMO[1];

def monthlyTMORising = monthlyTMO > monthlyTMO[1];
def monthlyTMOFalling = monthlyTMO < monthlyTMO[1];

# ==========================================================
# WEEKLY MOVING AVERAGES
# ==========================================================
def MA30W = Average(wClose, shortWeekMA);
def MA40W = Average(wClose, longWeekMA);

def MA30WRising = MA30W > MA30W[1];
def MA30WFalling = MA30W < MA30W[1];

def MA40WRising = MA40W > MA40W[1];
def MA40WFalling = MA40W < MA40W[1];

def priceAbove30W = close > MA30W;
def priceBelow30W = close < MA30W;

def priceAbove40W = close > MA40W;
def priceBelow40W = close < MA40W;

# ==========================================================
# RISK FLAGS
# ==========================================================
def riskWeeklyTMO =
    weeklyTMOFalling;

def riskMonthlyTMO =
    monthlyTMOFalling;

def riskPriceBelow30W =
    priceBelow30W;

def riskPriceBelow40W =
    priceBelow40W;

def risk30WFalling =
    MA30WFalling;

def risk40WFalling =
    MA40WFalling;

def riskWeeklyBelowZero =
    weeklyTMO < 0;

def riskMonthlyBelowZero =
    monthlyTMO < 0;

# ==========================================================
# CAPITAL PRESERVATION RISK SCORE
# ==========================================================
def RiskScore =
    (if riskWeeklyTMO then 1 else 0) +
    (if riskMonthlyTMO then 2 else 0) +
    (if riskPriceBelow30W then 2 else 0) +
    (if riskPriceBelow40W then 2 else 0) +
    (if risk30WFalling then 1 else 0) +
    (if risk40WFalling then 1 else 0) +
    (if riskWeeklyBelowZero then 1 else 0) +
    (if riskMonthlyBelowZero then 2 else 0);

# ==========================================================
# RISK STATE
# ==========================================================
def HoldAggressive =
    RiskScore < defensiveScoreTrigger;

def TightenRisk =
    RiskScore >= defensiveScoreTrigger and
    RiskScore < hedgeScoreTrigger;

def HedgeMode =
    RiskScore >= hedgeScoreTrigger and
    RiskScore < exitScoreTrigger;

def ExitMode =
    RiskScore >= exitScoreTrigger;

# ==========================================================
# PLOTS
# ==========================================================
plot MA30WPlot =
    if showMAs then MA30W else Double.NaN;

MA30WPlot.SetDefaultColor(Color.CYAN);
MA30WPlot.SetLineWeight(2);

plot MA40WPlot =
    if showMAs then MA40W else Double.NaN;

MA40WPlot.SetDefaultColor(Color.YELLOW);
MA40WPlot.SetLineWeight(2);

# ==========================================================
# CLOUD
# ==========================================================
AddCloud(
    if showMAs then MA30W else Double.NaN,
    if showMAs then MA40W else Double.NaN,
    Color.DARK_GREEN,
    Color.DARK_RED
);

# ==========================================================
# LABELS
# ==========================================================
AddLabel(
    showLabels,
    "QQQ WEALTH PROTECTION",
    Color.WHITE
);

AddLabel(
    showLabels,
    "RISK SCORE: " + RiskScore,
    if HoldAggressive then Color.GREEN
    else if TightenRisk then Color.YELLOW
    else if HedgeMode then Color.ORANGE
    else Color.RED
);

AddLabel(
    showLabels,
    if HoldAggressive then "ACTION: HOLD CORE POSITION"
    else if TightenRisk then "ACTION: TIGHTEN RISK / STOP CHASING"
    else if HedgeMode then "ACTION: HEDGE / SELL CALLS / PROTECTIVE PUTS"
    else "ACTION: EXIT OR REDUCE MAJOR SIZE",
    if HoldAggressive then Color.GREEN
    else if TightenRisk then Color.YELLOW
    else if HedgeMode then Color.ORANGE
    else Color.RED
);

AddLabel(
    showLabels,
    if monthlyTMORising then
        "MONTHLY TMO: RISING"
    else
        "MONTHLY TMO: FALLING",
    if monthlyTMORising then Color.GREEN else Color.RED
);

AddLabel(
    showLabels,
    if weeklyTMORising then
        "WEEKLY TMO: RISING"
    else
        "WEEKLY TMO: FALLING",
    if weeklyTMORising then Color.GREEN else Color.RED
);

AddLabel(
    showLabels,
    if priceAbove30W then
        "PRICE > 30W MA"
    else
        "PRICE < 30W MA",
    if priceAbove30W then Color.GREEN else Color.RED
);

AddLabel(
    showLabels,
    if priceAbove40W then
        "PRICE > 40W MA"
    else
        "PRICE < 40W MA",
    if priceAbove40W then Color.GREEN else Color.RED
);

AddLabel(
    showLabels,
    if MA30WRising then
        "30W MA: RISING"
    else
        "30W MA: FALLING",
    if MA30WRising then Color.GREEN else Color.RED
);

AddLabel(
    showLabels,
    if MA40WRising then
        "40W MA: RISING"
    else
        "40W MA: FALLING",
    if MA40WRising then Color.GREEN else Color.RED
);

# ==========================================================
# WARNING BUBBLES
# ==========================================================
def newHedgeSignal =
    HedgeMode and !HedgeMode[1];

def newExitSignal =
    ExitMode and !ExitMode[1];

AddChartBubble(
    newHedgeSignal,
    high,
    "HEDGE MODE",
    Color.ORANGE,
    yes
);

AddChartBubble(
    newExitSignal,
    high,
    "EXIT / REDUCE",
    Color.RED,
    yes
);

# ==========================================================
# ALERTS
# ==========================================================
Alert(
    newHedgeSignal,
    "QQQ Wealth Protection: Hedge Mode Triggered",
    Alert.BAR,
    Sound.Ding
);

Alert(
    newExitSignal,
    "QQQ Wealth Protection: Exit / Major Reduction Triggered",
    Alert.BAR,
    Sound.Chimes
);

# ==========================================================
# END
# ==========================================================
WOWWWWWW! That is some truly incredible help. You’re right - I want to protect the big gains I’ve gotten in the past 8+ years from the Big, Bad Bear Monster. And you, my man, have given me another bunch of help in my journey. THANK YOU SO MUCH!!!
 
antwerks, you are a true gem. I don’t know how to thank you… I feel like I hit the jackpot. Thank you so very, very much!!!
You are welcome!!!! Remember these are just like the timer bells on your oven, you still needed to put allthe right ingredients in the "cake" and perfect timing and know when its "done". The bell like these suggestions and scripts are just triggers to get your attention to go make sure!!!! Good luck!!!
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
761 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top