# Reverse Relative Strength using Donchian Channels For ThinkOrSwim

#### Pensar

##### Expert
VIP
@Pensar- I think this is pretty close, but I have a couple more questions/requests if I may. I watched another playing of the webinar and caught this slide that shows the setting he is using for the Swing Energy indicator. You can See chart here
The settings show ("b", 10, 50, 75, Green, Yellow, Red). He said there are 2 versions of this indicator- a "Buy" and a "Sell" version. I'm sure that is what the "b" is in the setting. I think the 10 is the Doncian channel length, and 50, 75 are the plotting limits to change colors.

According to the author, You should have a high fully charged value, meaning high green bars for a fully charged buy. This would require running only the "buy" version. You would also have a high fully charged value, meaning high green bars for a fully charged sell also. Is this something you can help me with? Thanks in advance.

@hockeycoachdoug Now that's a great clue. Of course, this code will not be an exact match, given that they very likely use a modified version of the donchian channel.
Code:
``````declare lower;

input direction = {default "buy", "sell"};
input short_donchian = 10;
input long_donchian = 50;
input high_value = 75;
input low_value = 25;
input averagelength = 2;
input averagetype = averagetype.SIMPLE;

def hh = highest(high,long_donchian);
def ll = lowest(low,short_donchian);
def strength;
switch (direction) {
case sell: strength = movingaverage(averagetype,100*(close-ll)/(hh-ll),averagelength);
default: strength = movingaverage(averagetype,100*(hh-close)/(hh-ll),averagelength); }

plot RS = strength;
RS.setpaintingstrategy(paintingstrategy.histogram);
RS.assignvaluecolor(if rs > 75 then color.uptick else if rs > 25 then color.yellow else color.downtick);
RS.setlineweight(3);

plot high_strength = high_value;
high_strength.setdefaultcolor(color.gray);
high_strength.setpaintingstrategy(paintingstrategy.horizontal);
high_strength.setstyle(curve.short_dash);
plot low_strength = low_value;
low_strength.setdefaultcolor(color.gray);
low_strength.setpaintingstrategy(paintingstrategy.horizontal);
low_strength.setstyle(curve.short_dash);``````
I think this is the the closest I can reverse-engineer it without actually seeing the other indicator's code. In all honesty, though, if their little code differences are the only key to profitable v.s. unprofitable, there's bigger problems to worry about. A quote I read once, "Those who can trade do and those who can't trade sell indicators", or something like that. Really makes one think about another saying, "there's a market for everything".

Eye-Candy of both directions -

Merry Christmas to you!

Last edited by a moderator:
curious question, what does the red/yellow/green indicate, could not interpret it right, also is this mainly for daily chart and above timeframe?

@Pensar- I don't think we have this quite right yet. I watched the webinar again to ask question about the settings shown in the above picture. This was my question-

### Can you discuss what the settings are for your TOP Swing Energy indicator. Is it a function of distance from your TOP Breakout Levels (Similar to Donchian Channel). I am trying to recreate a similar indicator. Thanks.​

Here was their response-
Mark tend to use 10 bars lookback for TOP Swing Energy. The indicator focuses on movement over the lookback period but not like Donchian Channel. More from recent extremes.
We are currently working on identifying indicators to release in 2022, and it has not been decided if the TOP Swing Energy will be one of them

They don't use the actual Donchian - they retitled a similar indicator and called it TOP Trend Breakout Levels - They typically use a 25 bar high and 25 bar low and it is basically a 25 bar Donchian channel.

I assume the settings shown are "buy"/"sell", look back period 10 days, 25 is the TOP Trend Breakout length, and the 25 and 75 I think are the plot boundaries to be either red or bars. They said there is a separate Buy and Sell versions. I now think they are tracking how close the last 10 bars are to the upper or lower channel. Any thoughts on how to code something like that?

Last edited:
Does anyone here have the buy and sell signals for the upper chart?

The Buy/sell signals are from their proprietary indicator known as HedgeFundTrender or also called HedgeFundTrader or HFT. It is a proprietary indicator, but I'm sure you will find many versions of it available on the web

Do their signals look like Trend reversals signals? I suspected it as when he shows his active signals that those not repainted yet?

I don't think I understand your question. The signals they are trading come from TOP Hedge Fund Trender. They made a scan to scan for the buy/sell HFT signals of which there often are many. They then use their TOP Swing Energy indicator as a filter to hopefully filter out the weak, unenergized trades. I don't think their actual indicators repaint if that is your question.

@Pensar not sure if you are still watching this thread after it was moved. Attached is a screen shot showing the variables inputs. They said they use both a buy and a sell version so that is the "b" for buy. According to TOPTradeTools, 10 is the look back period, I think the 50 is the length of their doncian channel. They actually use something called TOP Trend Breakout Levels which is a Doncian channel. I think the 75 and 25 are the limits on the histogram for green and red. Obviously the toggle need to be part of the buy/sell. I assume it has to do with ATR proximity to the Doncian Channel. Any additional thoughts or ideas are appreciated. This could be a good filter for any number of methodologies that generate actual buy/sell signals.

@hockeycoachdoug I just tried creating an version using ATR and the results are nowhere near to the sample pics . . . the best match seems to be what I've posted earlier. I'm going to try some other things yet, but currently you have the closest match I can get.

Many Thanks @Pensar. I appreciate your help. I will keep an eye on this thread. Hopefully someone else might chime in with some ideas also.

Last edited:
@hockeycoachdoug Now that's a great clue. Of course, this code will not be an exact match, given that they very likely use a modified version of the donchian channel.

I think this is the the closest I can reverse-engineer it without actually seeing the other indicator's code. In all honesty, though, if their little code differences are the only key to profitable v.s. unprofitable, there's bigger problems to worry about. A quote I read once, "Those who can trade do and those who can't trade sell indicators", or something like that. Really makes one think about another saying, "there's a market for everything".

Eye-Candy of both directions -

Merry Christmas to you!
Can you post the code for the one on the bottom? Thanks,

### Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
682 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• 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?