G-Channels For ThinkOrSwim

autoloader

Member
VIP
The author states:
Channels indicators are widely used in technical analysis, they provide a lot of information.
To use this indicator:
When both extremities follow the same direction, the average will also do the same, when both follow an opposite direction then the average will be equal to its precedent value,
tobWcWK.png


An interesting take on channels:
https://www.tradingview.com/script/...cient-Calculation-Of-Upper-Lower-Extremities/
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

check the below:

CSS:
#https://www.tradingview.com/v/fIvlS64B/
#/@alexgrover
#study("G-Channels",overlay=true)
# Converted by Sam4Cok@Samer800    - 03/2024
input src = close;
input length = 100;

def na = Double.NaN;
DefineGlobalColor("band", CreateColor(33,150,243));
DefineGlobalColor("avg", CreateColor(255,152,0));
script nz {
    input src = close;
    input rep = 0;
    def nz = if (isNaN(src) or src==0) then rep else src;
    plot out = nz;
}
def b;
def a = Max(src, nz(a[1])) - nz(a[1] - b[1]) / length;
    b = Min(src, nz(b[1], src)) + nz(a[1] - b[1]) / length;
def avg = (a + b) / 2;

#//----
plot upper = if a then a else na ; #,"Upper",color=color.blue,linewidth=2,transp=0)
plot Average = if avg then avg else na; #,"Average",color=color.orange,linewidth=2,transp=0)
plot Lower = if b then b else na; #,"Lower",color=color.blue,linewidth=2,transp=0)
upper.SetLineWeight(2);
Lower.SetLineWeight(2);
upper.SetDefaultColor(GlobalColor("band"));
Average.SetDefaultColor(GlobalColor("avg"));
Lower.SetDefaultColor(GlobalColor("band"));


#-- END of CODE

and the below with additional options:

CSS:
# https://www.tradingview.com/v/smADlDdP/
#//@jaggedsoft
#//Full credit to AlexGrover:
#study("G-Channel Trend Detection",shorttitle="G-Trend",overlay=true)
# Converted by Sam4Cok@Samer800    - 03/2024
input showCross = yes;
input src = close;
input length = 100;
input useMovAvgFilter = yes;
input movAvgType = AverageType.EXPONENTIAL;
input movAvgLength = 200;
input showMovAvgLine = yes;

def na = Double.NaN;
def ma = MovingAverage(movAvgType, src, movAvgLength);

def a; def b;
def a1 = if a[1] then a[1] else src;
def b1 = if b[1] then b[1] else src;
    a = max(src, a1) - (a1 - b1)/length;
    b = min(src, b1) + (a1 - b1)/length;
def avg = (a + b)/2;

def crossUp = b[1] <= close[1] and b > close;
def crossDn = a[1] <= close[1] and a > close;
def cdnUp = if crossUp then 0 else cdnUp[1] + 1;
def cdnDn = if crossDn then 0 else cdnDn[1] + 1;

def SigUp = if useMovAvgFilter then avg < ma else yes;
def SigDn = if useMovAvgFilter then avg > ma else yes;
def bullish = cdnDn <= cdnUp;
def bearish = cdnDn > cdnUp;

def p1 = avg;
def p2 = ohlc4;

plot MovAvg = if showMovAvgLine then ma else na;
MovAvg.SetDefaultColor(Color.CYAN);

AddCloud(if Bullish or Bullish[-1] then p1 else na, p2, Color.DARK_GREEN, Color.DARK_GREEN, yes);
AddCloud(if bearish or bearish[-1] then p1 else na, p2, Color.DARK_RED, Color.DARK_RED, yes);

AddChartBubble(showcross and bullish and !bullish[1] and SigUp, p1, "Buy", Color.GREEN, no);
AddChartBubble(showcross and bearish and !bearish[1] and SigDn , p1, "Sell", Color.RED);

#-- END of CODE
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
301 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