Momentum and Half Back Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Ever heard the theory that when you get a momentum move in price that it will always snap back halfway? Well, I wrote a thinkscript study that looks for two momentum bars up or down and then calculates what the half back value and prints it on the candle, giving you a suggestion for the upcoming target reversal. The purple arrows are NOT "buy/sell" trade indicators, they are painted when the script notices momentum bars moving up or down, telling you that the next bar will probably be a reversal bar and a bubble to give you a target. This is a simple script. Use other data and some common sense before trading with it.

YvKI9xA.png

6Rq7aU3.png


thinkScript Code

Code:
# This study will plot the half back target after two successive momentum candles up or down.
# ZackH 1.22.2016

input BubblesOn = yes;  #hint BubblesOn:  Turns the bubbles on or off.
input LabelsOn = yes;   #hint labelsOn:  Turns the labels on or off.
input length = 20;      #hint length: The number of bars back to evaluate the study.

# If two momentum candles down, print an arrow on the second.
def IsLongBlack = IsLongBlack(length);
plot TwoLongBlack = IsLongBlack[1] and
                    IsLongBlack;
TwoLongBlack.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
TwoLongBlack.SetDefaultColor(Color.plum);
TwoLongBlack.SetLineWeight(3);

#Calculate halfback using open, high, low, close divided by 4 for previous 2 bars, then divide that by 2.
def halfback = round((OHLC4[1] + OHLC4[2])/2,2);

# Add a label and chart bubble if enablde to show the halfback value for the current event.
addlabel(labelsOn && TwoLongBlack[1], "Halfback: " + halfback, color.YELLOW);
AddChartBubble(bubbleson && TwoLongBlack[1], low + ticksize(), "Halfback: " + halfback , Color.Yellow, no);

# If two momentum candles up, print an arrow on the second.
def IsLongWhite = IsLongWhite(length);
plot TwoLongWhite = IsLongWhite[1] and
                    IsLongWhite;
TwoLongWhite.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
TwoLongWhite.SetDefaultColor(Color.plum);
TwoLongWhite.SetLineWeight(3);

# Add a label and chart bubble if enablde to show the halfback value for the current event.
addlabel(LabelsOn && TwoLongWhite[1], "Halfback: " + halfback, color.YELLOW);
AddChartBubble(bubbleson && TwoLongWhite[1], high + ticksize(), "Halfback: " + halfback , Color.Yellow, yes);

Shareable Link

https://tos.mx/kCk2Je
Regarding backtesting of this indicator:
  • Question: How can you apply this study and backtest?
  • Answer: The best backtests are those that are done manually one signal at a time, especially if you are a chart reader.

Credit:
 

Attachments

  • YvKI9xA.png
    YvKI9xA.png
    99.1 KB · Views: 211
  • 6Rq7aU3.png
    6Rq7aU3.png
    88 KB · Views: 157

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
399 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