Greer BuyZone tool For ThinkOrSwim

Ayaanali

New member
VIP
The Greer BuyZone Tool is designed to assist in identifying potential long-term investment opportunities.​
Not suitable for day trading

Author states: The Greer BuyZone Tool is designed to help identify potential long-term investment opportunities by marking BuyZones on the chart.

This tool utilizes the Aroon indicator in combination with Fibonacci numbers to define periods where the asset might be a good candidate for dollar-cost averaging.


FhE5YgX.png


Here is the original Tradingview code:
https://www.tradingview.com/script/hx3Zctia-Greer-BuyZone-tool/

The new ThinkOrSwim code can be found in the next post.
 
Last edited by a moderator:
Hey, I need help with this Aroon conversion if any one can help. @samer800 Any help, I know you do most of the conversions on the site. Thanks

https://www.tradingview.com/script/hx3Zctia-Greer-BuyZone-tool/
check the below:

CSS:
#// Indicator for TOS
#// Author: Sean Lee Greer
#indicator("Greer BuyZone", "Greer BuyZone", overlay = true)
# Converted by Sam4Cok@Samer800    - 10/2024

input length = 100; #, minval=1)
input ShowBuyZoneBox = yes; #(true, title = "Show BuyZone Box", group = "UI Options")
input showLabel = yes; #(true, title = "Show Text", group = "UI Options")

def na = Double.NaN;
def last = IsNaN(close);

#// Calculate the upper and lower bounds based on the Aroon indicator and Fibonacci numbers
def upper = 100 * (GetMaxValueOffset(high, length + 1) + length) / length;
def lower = 100 * (GetMinValueOffset(low, length + 1) + length) / length;
def ahigh = Highest(high, length + 1); # // Calculate the highest price over the lookback period + 1 bar
def alow = Lowest(low, length + 1); # // Calculate the lowest price over the lookback period + 1 bar
def amidpoint = (ahigh + alow) / 2; # // Calculate the midpoint between the highest and lowest prices

#// Logic to detect the beginning of the BuyZone
def newbox;
def bzs;
if upper == 100 {
    newbox = 1; #   // Mark the start of a new BuyZone
    bzs = 0; #      // Reset the BuyZone start flag
} else if newbox[1] == 1 {
    if lower == 100 {
        bzs = 1; #  // Confirm BuyZone start
        newbox = 0; #  // Reset the newbox flag
    } else {
        newbox = newbox[1];
        bzs = 0; #  // No BuyZone yet
    }
} else {
    newbox = newbox[1];
    bzs = 0; #  // Ensure BuyZone start flag is reset if not in a BuyZone
}
#// Logic to detect the end of the BuyZone
def endbox;
def bze;
if lower == 100 {
    endbox = 1;  #// Mark the end of a BuyZone
    bze = 0;     #// Reset the BuyZone end flag
} else if endbox[1] == 1 {
    if upper == 100 {
        bze = 1;      # // Confirm BuyZone end
        endbox = 0;   #// Reset the endbox flag
    } else {
        endbox = endbox[1];
        bze = 0; #  // No BuyZone end yet
    }
} else {
    endbox = endbox[1];
    bze = 0; #  // Ensure BuyZone end flag is reset if not ending a BuyZone
}

def in_buyzone = if ShowBuyZoneBox then  (newbox == 0 and endbox != 0) else no;

plot hh = if in_buyzone then ahigh else na;
def mid = if in_buyzone then amidpoint else na;
plot ll = if in_buyzone then alow else na;

hh.SetDefaultColor(Color.GREEN);
ll.SetDefaultColor(Color.RED);

AddCloud(hh, mid, Color.DARK_GREEN);
AddCloud(mid, ll, Color.DARK_RED);

AddChartBubble(showLabel and bzs == 1, low, "Start", Color.RED, no);
AddChartBubble(showLabel and bze == 1, high, "End", Color.GREEN);

#-- end of code
 
Is there any way to add an alert for when the buy zone starts or ends? @samer800
add the below at the end of the code:

CSS:
input alerts   = yes;
input alertType   = Alert.BAR;
input alertSound  = Sound.NoSound;

Alert(alerts and bzs == 1, "Start Buy Zone", alertType, alertSound);
Alert(alerts and bze == 1, "End Buy Zone", alertType, alertSound);
 

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