Simple adjustable half back tool

inthefutures

Active member
Here is a simple code for swing high to swing low 50% retrace.

Code:
input back = 60;

def stop = Highest(high, back);

def slow = Lowest(low, back);

def half = (stop - slow) * .5;

plot halfback = slow + half;

halfback.setlineWeight(3);
 
Last edited by a moderator:
How can one code this script to relect the .5 plus a .33 and .66 just a script to reflect all 3 percentages and be able to change the color for each?
 
How can one code this script to relect the .5 plus a .33 and .66 just a script to reflect all 3 percentages and be able to change the color for each?

I added in 4 adjustable values with there own color, i set the defaults at standard Fib levels, but you can adjust them or turn off the ones you do not want

Code:
# created by Alleytrader
input back = 60;
input one = .5;
input two = .382;
input three = .618;
input four = .786;
def stop = Highest(high, back);
def slow = Lowest(low, back);
def half = (stop - slow) * one;
plot halfback = slow + half;
halfback.setlineWeight(3);
halfback.setdefaultColor(color.GREEN);

def twobck = (stop - slow) * two;
plot twoback = slow + twobck;
twoback.setlineWeight(3);
twoback.setdefaultColor(color.RED);

def threebck = (stop - slow) * three;
plot threeback = slow + threebck;
threeback.setlineWeight(3);
threeback.setdefaultColor(color.BLUE);

def fourbck = (stop - slow) * four;
plot fourback = slow + fourbck;
fourback.setlineWeight(3);
fourback.setdefaultColor(color.YELLOW);
 
Make sure you adjust time scale or chart time to make sure the look back is picking up last swing high and low, I might work on connecting it to a zigzag for a auto barsback
 
Make sure you adjust time scale or chart time to make sure the look back is picking up last swing high and low, I might work on connecting it to a zigzag for a auto barsback
Do you have any suggestions for use on a 3m chart....Thanks
 
most of the time I am 60 lookback and right down to 1 minute, the time to adjust is let say you are on a 3min chart and we drop for swings lasting 75 bars then this code will be missing the exact high or low by 15 bars. so i would in big swing days add a few bars to the lookback.
 
The problem with looking back to far in a tight choppy day is this code will not be looking at the most current swings if they move inside 60 bars.

Hoping this all makes sense
 
I found this interesting how price has respected the levels both up and down. I did add extensions so I'm working with .382-.618-1.382-1.618
Very nice, I like the .38 set at 0 and the .766 set at 1 so I can see the swing highs and lows the tool is using and then can adjust time of chart or lookback to pick up the highs and lows I want to plot against.
 
@mini
This is the info for the adjustable. The candle colors are related to a different study if you want that I can post separately.
Code:
# created by Alleytrader
input back = 60;
input one = .382;
input two = .618;
input three = 1.382;
input four = 1.618;

def stop = Highest(high, back);
def slow = Lowest(low, back);
def half = (stop - slow) * one;
plot halfback = slow + half;
halfback.setlineWeight(3);
halfback.setdefaultColor(color.GREEN);
def twobck = (stop - slow) * two;
plot twoback = slow + twobck;
twoback.setlineWeight(3);
twoback.setdefaultColor(color.RED);
def threebck = (stop - slow) * three;
plot threeback = slow + threebck;
threeback.setlineWeight(3);
threeback.setdefaultColor(color.BLUE);
def fourbck = (stop - slow) * four;
plot fourback = slow + fourbck;
fourback.setlineWeight(3);
fourback.setdefaultColor(color.YELLOW);
 
@mini
This is the info for the adjustable. The candle colors are related to a different study if you want that I can post separately.
Code:
# created by Alleytrader
input back = 60;
input one = .382;
input two = .618;
input three = 1.382;
input four = 1.618;

def stop = Highest(high, back);
def slow = Lowest(low, back);
def half = (stop - slow) * one;
plot halfback = slow + half;
halfback.setlineWeight(3);
halfback.setdefaultColor(color.GREEN);
def twobck = (stop - slow) * two;
plot twoback = slow + twobck;
twoback.setlineWeight(3);
twoback.setdefaultColor(color.RED);
def threebck = (stop - slow) * three;
plot threeback = slow + threebck;
threeback.setlineWeight(3);
threeback.setdefaultColor(color.BLUE);
def fourbck = (stop - slow) * four;
plot fourback = slow + fourbck;
fourback.setlineWeight(3);
fourback.setdefaultColor(color.YELLOW);
Yes, may I also have the candle colors study? Thank you!
 
@mini NOTE on this study I turned off the 10 levels(the original was 5 levels and I added 5 more) for support and resistance leaving the colored candles only. Also note that should price take out highs or lows the candles will lose the color and return to normal colors. I like to see the candles confirm and the tmo to be ob(10 or greater or os(-10 or greater).

https://usethinkscript.com/threads/...upply-demand-zones-for-thinkorswim.172/page-2
 
Last edited by a moderator:

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