Upper Gaussian Mean crossovers with lower macd/gacd


Well-known member
2019 Donor

Original study includes pl
Last edited by a moderator:
The first of the lower two indicators above is a gaussian mean cross with arrows and so I paired it with the WT_LB Short Name TV and I'm getting good signals both short and long where I take confirmation if present from the WT_LB Short Name TV.. today I ran a 1min and a 512t I like what I'm seeing with the indicator minus the labels.

  # GaussianMeanCrossWithProfitability_JQ

declare lower;
#plot Data = close;
input GaussianLength = 5;
input GaussianLengthLong = 20;
input betaDev = 7.0; #hint betaDev: adjust this value till the label indicates a minimum of 68.2% of closes

# Trying to achieve Normal Distribution
# Mobius
# V01.09.2015
def c;
def w;
def beta;
def alpha;
def G;
plot GaussianMean;
c = close;
w = (2 * Double.Pi / GaussianLength);
beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
alpha = (-beta + Sqrt(beta * beta + 2 * beta));
G = Power(alpha, 4) * c +
4 * (1 – alpha) * G[1] – 6 * Power( 1 - alpha, 2 ) * G[2] +
                 4 * Power( 1 - alpha, 3 ) * G[3] - Power( 1 - alpha, 4 ) * G[4];
GaussianMean = G;

# Trying to achieve Normal Distribution
# Mobius
# V01.09.2015
def c2;
def w2;
def beta2;
def alpha2;
def G2;
plot GaussianMeanLong;
c2 = close;
w2 = (2 * Double.Pi / GaussianLengthLong);
beta2 = (1 - Cos(w2)) / (Power(1.414, 2.0 / betaDev) - 1 );
alpha2 = (-beta2 + Sqrt(beta2 * beta2 + 2 * beta2));
G2 = Power(alpha2, 4) * c2 +
4 * (1 – alpha2) * G2[1] – 6 * Power( 1 - alpha2, 2 ) * G2[2] +
                 4 * Power( 1 - alpha2, 3 ) * G2[3] - Power( 1 - alpha2, 4 ) * G2[4];
GaussianMeanLong = G2;
## End Gaussian Codes
#    ---------------------------------------------------
    ## Begin Plots
plot BullishCross = GaussianMean crosses above GaussianMeanLong;
plot BearishCross = GaussianMean crosses below GaussianMeanLong;

# Total Cross Count in Bubbles
# TsL for fredw
# Nube 9.24.18
    # universals
def bn = BarNumber();
#def c = close;
def na = Double.NaN;
# variables
def upCross = GaussianMean crosses above GaussianMeanLong;
def upCrossCt = CompoundValue(1,
if upCross
then upCrossCt[1] + 1
else upCrossCt[1], 0);
def currentUpCrossCount = HighestAll(if !IsNaN(c) && IsNaN(c[-1])
then upCrossCt else na);
def upCrossBar = if upCross
then bn else upCrossBar[1];
# plots
#AddChartBubble(bn == highestall(upCrossBar), low,""+currentUpCrossCount, Color.Gray,0);
    # alternative version for those who prefer to also use GetValue()
#def currentBar = HighestAll(if !IsNaN(c) && IsNaN(c[-1])
# then bn else na);
#def getUpCount = GetValue(upCrossCt, bn - currentBar);
#AddChartBubble(bn == upCrossBar, high,""+getUpCount, Color.Light_Gray);

## ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
## ProfitLossSnippet_v04_JQ
## Profit Loss Code Snippet
## This snippet should be appendable to most studies will little effort
## Signal COde portion should be adjusted to capture buy/sell open/close signals
## v04    Splitting into Long only and short only sections
## V03 - 10.20.2018 - JQ - Correct calculation of Profit Loss yet again
## V02.1 - 071715 - Dilbert - Correct calculation of profitLoss again
## V02 - 071515 - Dilbert - Correct calculation of profitLoss
## Profit/Loss label and bubbles, added by linus (2014-07-31)
## Note: Insert at the bottom of Mobius' RSI in Laguerre Time V02.07.2014 study.

## Signal Code
    ## Signal Code needs to be adjusted to the script to which this snippet is appended
# End Profit/Loss Code
Last edited by a moderator:
Can we improve the result if we long with an additional condition (when price is above VWAP) and short (when price is below VWAP)
I do think this has potential Ive been trading the indicator. I can envision a vwap crossover with alerts. And somehow normalizing the study with an added WT_LB Short Name TV. Along with this I am also using the

# Leavitt, Jay A., PhD [2017]. “Beyond The Hull With Leavitt Projections,” Technical Analysis of StockS & commoditieS, Volume 35: February.
script LeavittProjection indicator.

input y = close;
input n = 20;
rec x = x[1] + 1;
def a = (n * sum(x * y, n) - sum(x, n) * sum(y, n) ) / ( n *sum(Sqr(x), n) - Sqr(sum(x, n)));
def b = (sum(Sqr(x), n) * sum(y, n) - sum(x, n) * sum(x *y, n) ) / ( n * sum(Sqr(x), n) - Sqr(sum(x, n)));
plot LeavittProjection= a*x+ b;
script LeavittConvolution
{ input price = close;
input n = 20;
def intLength = Floor(Sqrt(n));
plot LeavittConvolution = LeavittProjection (LeavittProjection (price, n), intLength);
def price = Close;
input length = 9;
def intLength = Floor(Sqrt(length));
plot LeavittConvolution = LeavittProjection (LeavittProjection (price, length), intLength);
LeavittConvolution.AssignValueColor(if LeavittConvolution > LeavittConvolution [1] then Color.GREEN else Color.RED);
Last edited:
The LeavittProjection moving avg and Im sure we have something like this here just cannot find it
but the hull not sure about the difference between the two averages.
Last edited by a moderator:
This ToS script has been beyond useful .for me during intraday five minute skills. It really helps me get in to a position earlier than even Mac D or TTM squeeze does. Let me know what you think about it, TradingView has nothing like this available. If you like this script please let me know if you think it would be interesting to see it on TradingView. I will attach a link of the shared item for thinkorswim and also a link for the thinkscript author/script thread. This is just the GA CD lower indicator.


Last edited by a moderator:

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
405 Online
Create Post

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.