CSA Trading Dashboard for ThinkorSwim

@pk1729 The study that you have referenced above was completed successfully...The issue that I felt made it overwhelming was that certain studies required the change of color and not the traditional color code that MACD or Stochastic FULL Diff follow...that was the case with FREMA PPO and EUO...Its a good indicator once you figure out how you want to trade it.

I don't think I would want to touch this particular indicator anymore...HOWEVER...I might have something for you to take a look at that I have recently put together if you are interested. I just need someone that codes for a living to review what my very limited knowledge in coding allows...Let me just see how everything in that particular thread plays out and I can link you there. My go to coder that has always been willing to help me out no matter the request seems to be MIA since Thankgiving...I hope he's OK @netarchitech BUT I'd love to work with ANYONE whose willing to work with me and do the requests as I see them no matter how silly they maybe. There is a reason and a method to my madness. So let me know...and maybe we can work together on some projects...

@HighBredCloud I am happy to review the code and contribute. I won't be able to ping you on this forum. Not sure how to connect.

Also, looking forward to the write up about CSA indicator. Please tell us how and when to use it.
 
@diazlaz and @pk1729 as promised a quick write up on the CSA Trading Dashboard indicator.

LINE 1: = Mobius MACD not your standard MACD
LINE 2: = Stochastic FULL Diff
LINE 3: = Forward Reverse EMA
LINE 4: = PPO
LINE 5: = Ehlers Universal Oscillator


Please change LINE 3 and LINE 4 to the following colors...leave LINES 1 and 2 default color


Change LINE 5 to the following color below:


My suggestion is to run the upper study with Heiken Ashi Trend...as I am that @diazlaz posted in another thread found here: https://usethinkscript.com/threads/heikin-ashi-which-is-correct.1252/#post-11422

For a secondary confirmation I am also running a CCI ATR SuperTrend set to bolean and not numerical as dots on the candlesticks.

The rest of the other indicators are optional: Tillson T3 and Heiken Ashi Moving Average.

NOW...I set FREMA as triangles instead of dots just so that I know what is what. I consider FREMA as a longer trend type indicator...while the Universal Oscillator as basically an EXIT indicator as it is VERY sensitive

I really like the Stochastics FULL DIFF and I would consider that the basis of the trend along with FREMA...MACD and PPO seem to do the same but still good confirmation. PPO has the additional option to change to different moving average types that will alter color of the dots...hence why I wanted it there just for that option.

EVERYTHING is set to default settings...but you can change the settings accordingly.

Think of this as a "majority rule" when you use this indicator AND trade based on TWO colors GREEN and RED...I realize that MACD and Stochastic FULL have a 4 color code...but that is essentially to tell you if the value is above or below ZERO...which is important for MACD and for Stochastics the Dark GREEN signifies that the trend is heading downward while the Dark RED signifies the trend is heading towards the upside but is not yet quite positive...

With all this in mind...if at least 3 out of the 5 indicators are showing GREEN for example...you can safely assume that the trend is to the upside...and vice versa...Simple as that...

The short comings of this indicator is that at times the colors on the dots changes mid way through the candle that can cause a false signal...HENCE why I suggest that you use either Heiken Ashi or some sort of a SuperTrend along with this indicator on the upper study to make sure you avoid the fake outs...The fake outs are not as bad...I suggest looking at FREMA and Stochastics as they tends to change colors the least...while Universal Oscillator will change them the most.

This should work very good on all timeframes...I personally tested this on 3-15 min...I will add that Universal Oscillator because it changes colors the most and is the most sensitive...It does seem to also give the signal first on higher timeframes 15m+.

ENTER the trade when majority of the dots are the same color and EXIT the trade the same way...Very Simple...This indicator is fully customizable so you can change colors to your specific likings and or get rid of certain types of indicators IF you don't want to display all 5...I personally were using Stochastics...FREMA and Universal Oscillator...but to each their own.
Code:
# CSA Trading Dashboard
# tomsk
# 11.15.2019

# V1.0 - 11.14.2019 - tomsk - Initial release of CSA Trading Dashboard
# V1.1 - 11.14.2019 - tomsk - Added bubbles to identify study being displayed
# V1.2 - 11.14.2019 - tomsk - Synthesized similar internal variables and minor edits
# V2.0 - 11.15.2019 - tomsk - Revamped coloring scheme to enable UI color customization

# This is a lower study represented by 5 dotted lines. Each line represents
# the “price performance” of the following five indicators
#
# Line 1: MACD with a more Normal Distribution
# Line 2: Stochastic Full Diff
# Line 3: FREMA
# Line 4: PPO MMA
# Line 5: Universal Oscillator
#
# Please note that each study was normalized to a standard form and uses a
# standardized coloring scheme defined separatelky under each sub indiocator
# that reflects the following states
#
# Positive and Up
# Positive and Down
# Negative and Down
# Negative and Up
#
# MACD FREMA already includes Ehlers Forward/Reverse EMA as that indicator
# is already represented in Line3. Since all we want to represent is the
# histogram, removed the Multi Moving Average Component from the MACD FREMA.
# Hence we are really left with the MACD with a more Normal Distribution
# study. Therefore, replaced Line 1 with MACD with a more Normal Distribution
# which is the basis of MACD FREMA

# Global Defs

input DotSize = 3;
input n = 3;

def n1 = n + 1;
def PosUp = 1; # Positive and Up
def PosDn = 2; # Positive and Down
def NegDn = 3; # Negative and Down
def NegUp = 4; # Negative and Up

# MACD with a more Normal Distribution
# Mobius
# V01.09.2015
#
# Plots a Gaussian distribution. If Normal Distribution is met, then at
# minimum, 68.2% of the close values should be inside a One Standard Deviation
# Envelope and 95.4% of the close values should be inside a 2 Standard
# Deviation Envelope.

declare lower;

input MACDFastLength = 12;
input MACDSlowLength = 26;
input MACDLength = 9;

# Four Pole Filter
script g{
input length = 4;
input betaDev = 2;
input price = OHLC4;
def c;
def w;
def beta;
def alpha;
def G;
c = price;
w = (2 * Double.Pi / length);
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];
plot Line = G;
}
# Modified MACD
def MACD_Value = g(length = MACDFastLength) - g(length = MACDSlowLength);
def MACD_Avg = g(price = MACD_Value, length = MACDLength);
def MACD_Diff = MACD_Value - MACD_Avg;
def MACD_State = if MACD_Diff >= 0
then if MACD_Diff > MACD_Diff[1]
then PosUp
else PosDn
else if MACD_Diff < MACD_Diff[1]
then NegDn
else NegUp;
plot MACD_Dot = if IsNaN(close) then Double.NaN else 1;
MACD_Dot.SetPaintingStrategy(PaintingStrategy.POINTS);
MACD_Dot.SetLineWeight(DotSize);
MACD_Dot.DefineColor("Positive and Up", Color.GREEN);
MACD_Dot.DefineColor("Positive and Down", Color.DARK_GREEN);
MACD_Dot.DefineColor("Negative and Down", Color.RED);
MACD_Dot.DefineColor("Negative and Up", Color.DARK_RED);
MACD_Dot.AssignValueColor(if MACD_State == PosUp then MACD_Dot.Color("Positive and Up")
else if MACD_State == PosDn then MACD_Dot.Color("Positive and Down")
else if MACD_State == NegDn then MACD_Dot.Color("Negative and Down")
else MACD_Dot.Color("Negative and Up"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), 1, "MACD", Color.Yellow, yes);
# End Code Modified MACD - Gaussian



# Stochastic Full Diff
# Extracted from Standard TOS Release

input priceH = high;
input priceL = low;
input priceC = close;
input kPeriod = 10;
input kSlowingPeriod = 3;
input dPeriod = 10;
input STOAverageType = AverageType.SIMPLE;

def Stochastic_Diff = reference StochasticFull(0, 0, kPeriod, dPeriod, priceH, priceL, priceC, kSlowingPeriod, STOAverageType).FullK -
reference StochasticFull(0, 0, kPeriod, dPeriod, priceH, priceL, priceC, kSlowingPeriod, STOAverageType).FullD;
def Stochastic_State = if Stochastic_Diff >= 0
then if Stochastic_Diff > Stochastic_Diff[1]
then PosUp
else PosDn
else if Stochastic_Diff < Stochastic_Diff[1]
then NegDn
else NegUp;
plot Stochastic_Dot = if IsNaN(close) then Double.NaN else 2;
Stochastic_Dot.SetPaintingStrategy(PaintingStrategy.POINTS);
Stochastic_Dot.SetLineWeight(DotSize);
Stochastic_Dot.DefineColor("Positive and Up", Color.GREEN);
Stochastic_Dot.DefineColor("Positive and Down", Color.DARK_GREEN);
Stochastic_Dot.DefineColor("Negative and Down", Color.RED);
Stochastic_Dot.DefineColor("Negative and Up", Color.DARK_RED);
Stochastic_Dot.AssignValueColor(if Stochastic_State == PosUp then Stochastic_Dot.Color("Positive and Up")
else if Stochastic_State == PosDn then Stochastic_Dot.Color("Positive and Down")
else if Stochastic_State == NegDn then Stochastic_Dot.Color("Negative and Down")
else Stochastic_Dot.Color("Negative and Up"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), 2, "Stoch", Color.Yellow, yes);
# End Code Modified Stochastic Full Diff



# Forward / Reverse EMA
# (c) 2017 John F. Ehlers
# Ported to TOS 07.16.2017
# Mobius

# Inputs:
input AA = .1;

# Vars:
def CC;
def RE1;
def RE2;
def RE3;
def RE4;
def RE5;
def RE6;
def RE7;
def RE8;
def EMA;

CC = if CC[1] == 0 then .9 else 1 – AA;
EMA = AA * Close + CC * EMA[1];
RE1 = CC * EMA + EMA[1];
RE2 = Power(CC, 2) * RE1 + RE1[1];
RE3 = Power(CC, 4) * RE2 + RE2[1];
RE4 = Power(CC, 8) * RE3 + RE3[1];
RE5 = Power(CC, 16) * RE4 + RE4[1];
RE6 = Power(CC, 32) * RE5 + RE5[1];
RE7 = Power(CC, 64) * RE6 + RE6[1];
RE8 = Power(CC, 128) * RE7 + RE7[1];

def FREMA_Diff = EMA – AA * RE8;
def FREMA_State = if FREMA_Diff >= 0
then if FREMA_Diff > FREMA_Diff[1]
then PosUp
else PosDn
else if FREMA_Diff < FREMA_Diff[1]
then NegDn
else NegUp;
plot FREMA_Dot = if IsNaN(close) then Double.NaN else 3;
FREMA_Dot.SetPaintingStrategy(PaintingStrategy.POINTS);
FREMA_Dot.SetLineWeight(DotSize);
FREMA_Dot.DefineColor("Positive and Up", Color.GREEN);
FREMA_Dot.DefineColor("Positive and Down", Color.DARK_GREEN);
FREMA_Dot.DefineColor("Negative and Down", Color.RED);
FREMA_Dot.DefineColor("Negative and Up", Color.DARK_RED);
FREMA_Dot.AssignValueColor(if FREMA_State == PosUp then FREMA_Dot.Color("Positive and Up")
else if FREMA_State == PosDn then FREMA_Dot.Color("Positive and Down")
else if FREMA_State == NegDn then FREMA_Dot.Color("Negative and Down")
else FREMA_Dot.Color("Negative and Up"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), 3, "FREMA", Color.Yellow, yes);
# End Code Ehlers Forward / Reverse EMA



# PPO Multiple Moving Averages
# Based on earlier PPO FREMAS code from netarchitect
# Revamped by tomsk
# 11.13.2019

# V11.11.2019 - tomsk - revamped netarchitect's base PPO code
# V11.13.2019 - tomsk - enhanced code structure, collapsed computation into a single switch

input PPOFastLength = 12;
input PPOSlowLength = 26;
input PPOSignalPeriod = 9;
input price = close;
input PPOMovingAverageType = {"Simple MA", default "Exponential MA", "Wilders Smoothing", "Weighted MA",
"Hull MA", "Adaptive MA", "Triangular MA", "Variable MA", "Dema MA", "Tema MA", "EHMA", "THMA"};

def periodOK = PPOFastLength < PPOSlowLength;
AddLabel(!periodOK, "ERROR: PPOFastLength MUST be less than PPOSlowLength");

def fast;
def slow;
def _ppo;
def _signal;

switch (PPOMovingAverageType) {
case "Simple MA":
fast = Average(price, PPOFastLength);
slow = Average(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = Average(_ppo, PPOSignalPeriod);

case "Exponential MA":
fast = ExpAverage(price, PPOFastLength);
slow = ExpAverage(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = ExpAverage(_ppo, PPOSignalPeriod);

case "Wilders Smoothing":
fast = WildersAverage(price, PPOFastLength);
slow = WildersAverage(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = WildersAverage(_ppo, PPOSignalPeriod);

case "Weighted MA":
fast = wma(price, PPOFastLength);
slow = wma(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = wma(_ppo, PPOSignalPeriod);

case "Hull MA":
fast = HullMovingAvg(price, PPOFastLength);
slow = HullMovingAvg(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = HullMovingAvg(_ppo, PPOSignalPeriod);

case "Adaptive MA":
fast = MovAvgAdaptive(price, PPOFastLength);
slow = MovAvgAdaptive(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = MovAvgAdaptive(_ppo, PPOSignalPeriod);

case "Triangular MA":
fast = MovAvgTriangular(price, PPOFastLength);
slow = MovAvgTriangular(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = MovAvgTriangular(_ppo, PPOSignalPeriod);

case "Variable MA":
fast = variableMA(price, PPOFastLength);
slow = variableMA(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = variableMA(_ppo, PPOSignalPeriod);

case "Dema MA":
fast = DEMA(price, PPOFastLength);
slow = DEMA(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = DEMA(_ppo, PPOSignalPeriod);

case "Tema MA":
fast = TEMA(price, PPOFastLength);
slow = TEMA(price, PPOSlowLength);
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = TEMA(_ppo, PPOSignalPeriod);

case EHMA:
fast = ExpAverage(2 * ExpAverage(price, PPOFastLength / 2) -
ExpAverage(price, PPOFastLength), Round(Sqrt(PPOFastLength)));
slow = ExpAverage(2 * ExpAverage(price, PPOSlowLength / 2) -
ExpAverage(price, PPOSlowLength), Round(Sqrt(PPOSlowLength)));
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = ExpAverage(2 * ExpAverage(_ppo, PPOSignalPeriod / 2) -
ExpAverage(_ppo, PPOSignalPeriod), Round(Sqrt(PPOSignalPeriod)));

case THMA:
fast = WMA(WMA(price, (PPOFastLength / 2) / 3) * 3 - WMA(price, (PPOFastLength / 2) / 2) -
WMA(price, (PPOFastLength / 2)), (PPOFastLength / 2));
slow = WMA(WMA(price, (PPOSlowLength / 2) / 3) * 3 - WMA(price, (PPOSlowLength / 2) / 2) -
WMA(price, (PPOSlowLength / 2)), (PPOSlowLength / 2));
_ppo = if periodOK then ((fast - slow) / slow) * 100 else 0;
_signal = WMA(WMA(_ppo, (PPOSignalPeriod / 2) / 3) * 3 - WMA(_ppo, (PPOSignalPeriod / 2) / 2) -
WMA(_ppo, (PPOSignalPeriod / 2)), (PPOSignalPeriod / 2));
}

def Ppo = _ppo;
def PpoEma = _signal;
def PPO_Diff = 2 * (_ppo - _signal);
def PPO_State = if PPO_Diff >= 0
then if PPO_Diff > PPO_Diff[1]
then PosUp
else PosDn
else if PPO_Diff < PPO_Diff[1]
then NegDn
else NegUp;
plot PPO_Dot = if IsNaN(close) then Double.NaN else 4;
PPO_Dot.SetPaintingStrategy(PaintingStrategy.POINTS);
PPO_Dot.SetLineWeight(DotSize);
PPO_Dot.DefineColor("Positive and Up", Color.GREEN);
PPO_Dot.DefineColor("Positive and Down", Color.DARK_GREEN);
PPO_Dot.DefineColor("Negative and Down", Color.RED);
PPO_Dot.DefineColor("Negative and Up", Color.DARK_RED);
PPO_Dot.AssignValueColor(if PPO_State == PosUp then PPO_Dot.Color("Positive and Up")
else if PPO_State == PosDn then PPO_Dot.Color("Positive and Down")
else if PPO_State == NegDn then PPO_Dot.Color("Negative and Down")
else PPO_Dot.Color("Negative and Up"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), 4, "PPO", Color.Yellow, yes);
# End Code PPO Multiple Moving Averages



# Ehlers Universal Oscillator
# LazyBear
# initial port by netarchitech
# 2019.11.05
# source: https://www.tradingview.com/script/ieFYbVdC-Ehlers-Universal-Oscillator-LazyBear/

input bandedge = 20;
input EUOLengthMA = 9;

def whitenoise = (close - close[2])/2;
def a1 = ExpAverage(-1.414 * 3.14159 / bandedge);
def b1 = 2.0 * a1 * cos(1.414 * 180 /bandedge);
def c2 = b1;
def c3 = -a1 * a1;
def c1 = 1 - c2 - c3;

def filt = c1 * (whitenoise + (whitenoise[1]))/2 + c2 * (filt[1]) + c3 * (filt[2]);
def filt1 = if totalsum(1) == 0 then 0
else if totalsum(1) == 2 then c2 * filt1[1]
else if totalsum(1) == 3 then c2 * filt1[1] + c3 * (filt1[2])
else filt;

def pk = if totalsum(1) == 2 then .0000001
else if absvalue(filt1) > pk[1] then absvalue(filt1)
else 0.991 * pk[1];
def denom = if pk == 0 then -1 else pk;
def euo = if denom == -1 then euo[1] else filt1/pk;
def euoMA = ExpAverage(euo, EUOLengthMA);
def Universal_Diff = euo;
def Universal_State = if Universal_Diff >= 0
then if Universal_Diff > Universal_Diff[1]
then PosUp
else PosDn
else if Universal_Diff < Universal_Diff[1]
then NegDn
else NegUp;
plot Universal_Dot = if IsNaN(close) then Double.NaN else 5;
Universal_Dot.SetPaintingStrategy(PaintingStrategy.POINTS);
Universal_Dot.SetLineWeight(DotSize);
Universal_Dot.DefineColor("Positive and Up", Color.GREEN);
Universal_Dot.DefineColor("Positive and Down", Color.DARK_GREEN);
Universal_Dot.DefineColor("Negative and Down", Color.RED);
Universal_Dot.DefineColor("Negative and Up", Color.DARK_RED);
Universal_Dot.AssignValueColor(if Universal_State == PosUp then Universal_Dot.Color("Positive and Up")
else if Universal_State == PosDn then Universal_Dot.Color("Positive and Down")
else if Universal_State == NegDn then Universal_Dot.Color("Negative and Down")
else Universal_Dot.Color("Negative and Up"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), 5, "Univ Osc", Color.Yellow, yes);
# End Code Ehlers Universal Oscillator
# End CSA Trading Dashboard
 
Last edited:
@pk1729 Here is the link to the new indicator that I am currently testing with VERY good results...

https://usethinkscript.com/threads/...or-mtf-for-thinkorswim.1128/page-5#post-11833
Perhaps you and @diazlaz should check this one out as well as the dots and triangles don't change the color as often as on the CSA study here because they are part of a longer SuperTrend vs an individual study...Plus its MTF and its centered around the MTF True Momentum Oscillator as well...

You will find the code in post #93...and my concerns in post #82...skip the rest of the drama in that post...Difference of opinion and inability to work together for the benefit of the community contributed to additional unnecessary posts. We can further discuss things in that section of the forum not to distort what is going on here with the CSA study...I too don't know how to send a Private Message on here...I don't know if there is a way or not... @BenTen so just post what you need to publicly. Probably the best way IMO...That's how I have always done it unless you have a better suggestion.

I will also post the original scripts there for you to take a look at...
 
@diazlaz @pk1729 or anyone that is willing to help out...I found a Mobius version of PPO in my archives...I would like to replace the PPO in post #102 with the script below? Seems less volatile and might work better. Thanks.

Code:
# PPO
# Mobius
# V01.03.2014

declare lower;

input c = close;
input AvgType = AverageType.Simple;
input nFast = 8;
input nSlow = 13;
input nSmooth = 5;

plot PPO = ((MovingAverage(AverageType = AvgType, c, nFast) -
             MovingAverage(AverageType = AvgType, c, nSlow)) /
             MovingAverage(AverageType = AvgType, c, nSlow));
PPO.SetPaintingStrategy(PaintingStrategy.Histogram);
PPO.AssignValueColor(if PPO > 0
                     then color.green
                     else color.red);

plot smooth = MovingAverage(AverageType = AvgType, PPO, nSmooth);
smooth.SetPaintingStrategy(PaintingStrategy.Line);
smooth.SetDefaultColor(Color.Cyan);
# End Code PPO
 
@horserider I tried all of the MA's but none resemble the Mobius version. His allows you to stay in the trade longer without getting fake outs on the lower timeframes as compared to the PPO that's currently there. Its much harder ONLY looking at dots vs looking at actual histogram with moving averages to make an informed decision...
 
Here you go.

ppocomp.jpg
 
@horserider They are very different...I don't know how you got your results but post them as histograms...I am using the PPO (bottom) code from original CSA study and the Mobius version being the top one...with the same settings as there are clear differences...I went through all the MA settings and I can't get any of them to resemble Mobius version.

 
The display is different because one plots a histogram of the difference of PPO and PPO average and one the histogram of the PPO average. Crosses will be the same.
 
@horserider The CSA study was based on the histogram plots and not the actual crosses...perhaps that's why the confusion on your end. Here is another pic of PPO from the CSA study set to 8 13 5 same as the Histograms above...Notice how the CSA dots resemble the CSA PPO Histogram...and how both of them differ from the Mobius version...I am looking for something that defines the trend better hence I the Mobius version...yet still be able to change to other MA's incase looking for more of a scalp...I just don't understand how Mobius got his Histogram to show like it does with a Simple MA...

 
Makes perfect sense. Mobius version is a histogram of the PPO average. As I told you above. So you want to get your dot from the PPO average.
Need something like this.

def PpoEma = _signal;
def PPO_State = if _signal >= 0
then if _signal> _signal[1]
then PosUp
else PosDn
else if _signal < _signal[1]
then NegDn
else NegUp;

Not tested at all so have fun playing with it.
 
@horserider Maybe I am just not understanding the concept...so can you please tell me what settings and MA I need to input into the CSA study to resemble Mobius Histogram? Because I fail to see a way...
 
@horserider I don't know what the hell I am doing...this is where I got stuck...I see what you mean now...about the average...What do I need to change from this code alone...I will try to figure out the rest.


Code:
#declare lower;

input c = close;
input AvgType = AverageType.SIMPLE;
input nFast = 8;
input nSlow = 13;
input nSmooth = 5;

plot PPO = ((MovingAverage(AverageType = AvgType, c, nFast) -
             MovingAverage(AverageType = AvgType, c, nSlow)) /
             MovingAverage(AverageType = AvgType, c, nSlow));
#PPO.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
#PPO.AssignValueColor(if PPO > 0
                     #then Color.GREEN
                     #else Color.RED);

#plot smooth = MovingAverage(AverageType = AvgType, PPO, nSmooth);
#smooth.SetPaintingStrategy(PaintingStrategy.LINE);
#smooth.SetDefaultColor(Color.CYAN);

#
#input PPOFastLength = 12;
#input PPOSlowLength = 26;
#input PPOSignalPeriod = 9;
#input price = close;
#input PPOMovingAverageType = {"Simple MA", default "Exponential MA", "Wilders Smoothing", "Weighted MA",
#"Hull MA", "Adaptive MA", "Triangular MA", "Variable MA", "Dema MA", "Tema MA", "EHMA", "THMA"};

#def periodOK = PPOFastLength < PPOSlowLength;
#AddLabel(!periodOK, "ERROR: PPOFastLength MUST be less than PPOSlowLength");



#def fast;
#def slow;
#def _ppo;
#def _signal;



def Ppo = _ppo;
def PpoEma = _signal;
def PPO_Diff = 2 * (_ppo - _signal);
def PPO_State = if PPO_Diff >= 0
then if PPO_Diff > PPO_Diff[1]
then PosUp
else PosDn
else if PPO_Diff < PPO_Diff[1]
then NegDn
else NegUp;
plot PPO_Dot = if IsNaN(close) then Double.NaN else -20;
PPO_Dot.SetPaintingStrategy(PaintingStrategy.POINTS);
PPO_Dot.SetLineWeight(DotSize);
PPO_Dot.DefineColor("Positive and Up", Color.GREEN);
PPO_Dot.DefineColor("Positive and Down", Color.DARK_GREEN);
PPO_Dot.DefineColor("Negative and Down", Color.RED);
PPO_Dot.DefineColor("Negative and Up", Color.DARK_RED);
PPO_Dot.AssignValueColor(if PPO_State == PosUp then PPO_Dot.Color("Positive and Up")
else if PPO_State == PosDn then PPO_Dot.Color("Positive and Down")
else if PPO_State == NegDn then PPO_Dot.Color("Negative and Down")
else PPO_Dot.Color("Negative and Up"));
AddChartBubble(!IsNaN(close[n1]) and IsNaN(close[n]), -20, "PPO", Color.YELLOW, yes);
# End Code PPO Multiple Moving Averages
 
@horserider IF I even knew what you were talking about I would't be here posting...Anyways...Before even posting this last night I attempted to do this myself...IF any coder wants to help me out with this I'd appreciate this...This is as far as my skills allow me to go...
 

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