scalping against trapped countertrend

This script attempts to find the end of countertrend.
This script uses oscillators to measure long term and short period trends. When the long term trend keeps positive and clear short term period is over, this script provides a buy signal.
This script does not contain pullback, cut loss and re-enter. You need to add it manually.

Many traders want to buy when long term trend is bullish and short term pullback is over.
This is because we can take advantage to the emotion of countertrend traders.
Countertrend traders realizes their profit is finite and therefore want to protect their profit well and limit their loss.
This script is inspired by a searchable trading strategy video.
The video mentioned 4 points.
(1) long term trend. The video did not spend much ink on this point. You can use any method to observe.
(2) clear pullback bar (at least 50% body)
(3) weak bar after clear pullback
(4) entry trigger buy stop
This script attempts to quantize these points to determine trading direction.
This script is originally designed for timeframes lower than examples in the video but you can apply it on any timeframe.

Computing and Adjusting
(1) long term trend
This script uses smoothed stochastic.
(2) clear pullback bar
Since this script is originally designed for timeframes lower than examples in the video, so the condition becomes:
RSI is low enough
(3) weak bar after clear pullback
RSI goes back from low level.
(4) entry trigger buy stop
This script does not include this condition.
You can decide enter when buy stop or pullback.

x_src : the value for computing oscillators
x_len_a : how many bars for measuring short term trend
x_len_b : how many bars for measuring long term trend
x_k_b : smooth long term trend, the average value of stochastic values
x_changk = check if clear short term pullback appears recently. 1 means do not use, larger numbers means how long of periods to check.
x_rsi_ct : threshold of short term pullback clear
x_rsi_ft : threshold of short term pullback end

Reading numbers in Strategy Tester
Most possible loss :
(1) to find rational pullback. Generally 1/3 to 2/3 atr.
(2) to find cut loss distance. Generally 1 to 2 atr.
Most possible profit :
to find if trading the opposite direction against this script is profitable.

This script can suggest us trading direction.
Waiting for pullback can reduce risk, compared to buy stop.
This script does not provide good signals in sideways markets.

A searchable trading strategy video
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?