PGO Indicator for ThinkorSwim

diazlaz

Well-known member
2019 Donor
VIP
Hi Everyone,

I took a pass at the port of this indicator, looks interesting. the source behaves slightly different from the TC2000 and Trade view. I attempted to reconcile the code base in this thinkscript port.

I also enhanced it with an optional visual of the Ergodic Indicator that can help further spot and validate the wave in the trend.

Please review and backtest and let us know if you all find a good pattern or trading strategy leveraging this indicator or pairing it up with others.

PGO Indicator (colorPGO = yes, colorErgodic = no)

IS2Ql5W.png


PGO Indicator + Ergodic (colorPGO = yes, colorErgodic = yes)

qI9IvLR.png


Ergodic (colorPGO = no, colorErgodic = yes)

7bOMGlg.png


Ruby:
#PGO Indicator
#Ported from TC2000 Code from Richard Moglen
#https://www.youtube.com/watch?v=_XNwgIQEhe4
#
#The PGO Indicator is a combination of my Purple and Orange Dot indicators and
#Dr. Wish's Green Dot Indicator.
#It represents a stock moving out of consolidation on volume.
#It provides an excellent entry point for swing and #momentum trades in growth stocks.
#
#
#Ported from TC2000 and Tradeview Source
# 2019.10.12 - diazlaz - Initial Port +
#                      - Integrated the Ergodic Indicator

declare upper;

input longLength = 25;
input shortLength = 13;
input signalLength = 8;
input averageType = AverageType.Exponential;

input period = 10;
input KPeriod = 4;
input colorPGO = yes;
input colorErgodic = no;


#Ergodic Indicator
def ErgodiIndicator = TrueStrengthIndex(longLength, shortLength, signalLength, averageType).TSI - TrueStrengthIndex(longLength, shortLength, signalLength, averageType).Signal;

# Green Dot Indicator
def lowest_k = Lowest(low, KPeriod);
def c1 = close - lowest_k;
def c2 = Highest(high, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

def stoc = MovingAverage(AverageType.SIMPLE, FastK, period);
def isGreenDot = stoc[1] / average(stoc[1],4) < 1 and stoc[1] < 60 and stoc / average(stoc,4) > 1;

# Purple Dot Indicator
def isPurpleDot = ( (ExpAverage(close, 2) /  ExpAverage(close, 8) > 1) and
(ExpAverage(close, 3) /  ExpAverage(close, 5) < 1.5) and
(ExpAverage(close, 4) /  ExpAverage(close, 8) > .7) and
(ExpAverage(close, 5) /  ExpAverage(close, 30) > .95) ) and
close > close[1] and close > close[2] and close > close[3];

# Orange Dot Indicator
def MACD = MovingAverage(AverageType, close, 12) -
MovingAverage(AverageType, close, 26);

def isOrangeDot = (MACD - ExpAverage(MACD, 9)) > (MACD[1] - ExpAverage(MACD[1], 9)) > 0
and (volume > (0.90 * Average(volume,50)) > 0);

# PGO
def PGO = isGreenDot and isPurpleDot and isOrangeDot;

AssignPriceColor (
    if colorPGO and PGO then COLOR.GREEN else
    if colorPGO and isPurpleDot then COLOR.MAGENTA else
    if colorPGO and isOrangeDot then COLOR.ORANGE else
    if colorPGO and isGreenDot then COLOR.DARK_GREEN else

    if colorErgodic and ErgodiIndicator >= 0 then Color.UPTICK else
    if colorErgodic and ErgodiIndicator <= 0 then Color.DOWNTICK else
COLOR.GRAY);

#End OF PGO Indicator
 
Last edited:

redaresg

New member
Hi Everyone,

I took a pass at the port of this indicator, looks interesting. the source behaves slightly different from the TC2000 and Trade view. I attempted to reconcile the code base in this thinkscript port.

I also enhanced it with an optional visual of the Ergodic Indicator that can help further spot and validate the wave in the trend.

Please review and backtest and let us know if you all find a good pattern or trading strategy leveraging this indicator or pairing it up with others.

PGO Indicator (colorPGO = yes, colorErgodic = no)

IS2Ql5W.png


PGO Indicator + Ergodic (colorPGO = yes, colorErgodic = yes)

qI9IvLR.png


Ergodic (colorPGO = no, colorErgodic = yes)

7bOMGlg.png


Ruby:
#PGO Indicator
#Ported from TC2000 Code from Richard Moglen
#https://www.youtube.com/watch?v=_XNwgIQEhe4
#
#The PGO Indicator is a combination of my Purple and Orange Dot indicators and
#Dr. Wish's Green Dot Indicator.
#It represents a stock moving out of consolidation on volume.
#It provides an excellent entry point for swing and #momentum trades in growth stocks.
#
#
#Ported from TC2000 and Tradeview Source
# 2019.10.12 - diazlaz - Initial Port +
#                      - Integrated the Ergodic Indicator

declare upper;

input longLength = 25;
input shortLength = 13;
input signalLength = 8;
input averageType = AverageType.Exponential;

input period = 10;
input KPeriod = 4;
input colorPGO = yes;
input colorErgodic = no;


#Ergodic Indicator
def ErgodiIndicator = TrueStrengthIndex(longLength, shortLength, signalLength, averageType).TSI - TrueStrengthIndex(longLength, shortLength, signalLength, averageType).Signal;

# Green Dot Indicator
def lowest_k = Lowest(low, KPeriod);
def c1 = close - lowest_k;
def c2 = Highest(high, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

def stoc = MovingAverage(AverageType.SIMPLE, FastK, period);
def isGreenDot = stoc[1] / average(stoc[1],4) < 1 and stoc[1] < 60 and stoc / average(stoc,4) > 1;

# Purple Dot Indicator
def isPurpleDot = ( (ExpAverage(close, 2) /  ExpAverage(close, 8) > 1) and
(ExpAverage(close, 3) /  ExpAverage(close, 5) < 1.5) and
(ExpAverage(close, 4) /  ExpAverage(close, 8) > .7) and
(ExpAverage(close, 5) /  ExpAverage(close, 30) > .95) ) and
close > close[1] and close > close[2] and close > close[3];

# Orange Dot Indicator
def MACD = MovingAverage(AverageType, close, 12) -
MovingAverage(AverageType, close, 26);

def isOrangeDot = (MACD - ExpAverage(MACD, 9)) > (MACD[1] - ExpAverage(MACD[1], 9)) > 0
and (volume > (0.90 * Average(volume,50)) > 0);

# PGO
def PGO = isGreenDot and isPurpleDot and isOrangeDot;

AssignPriceColor (
    if colorPGO and PGO then COLOR.GREEN else
    if colorPGO and isPurpleDot then COLOR.MAGENTA else
    if colorPGO and isOrangeDot then COLOR.ORANGE else
    if colorPGO and isGreenDot then COLOR.DARK_GREEN else

    if colorErgodic and ErgodiIndicator >= 0 then Color.UPTICK else
    if colorErgodic and ErgodiIndicator <= 0 then Color.DOWNTICK else
COLOR.GRAY);

#End OF PGO Indicator
Good job!
How can I use this study in a scanner?
I know how to add it as a filter but cannot figure out how to set the condition, I guess it should be the color change?
 
Last edited:

hellocucen

New member
Thanks @diazlaz for your great help in posting some good indicators. I am fairly new to the thinkscript and looking to learn understanding the scripts. I tried pulling up this indicator on TOS but fail to understand when should be the entry for calls or puts. Can someone shed some light on how to use this indicator for trading.. Thanks in advance.
 

Trader Raider

Well-known member
VIP
Have been playing around with this but am having some trouble understanding what causes a candle to plot dark blue or yellow. My (limited!) understanding of the code was that I should be looking for dark green entry candles but they seem to be plotting blue, at least for longs. Nothing is plotting dark green except shorts. What am I missing in the code to explain blue and yellow candles?
 

hellocucen

New member
Hi @diazlaz can you help us understand more on this. We are assuming or deriving lot due to lack of info. It would be great if you could share more info on this. Thanks in advance
 

Trader Raider

Well-known member
VIP
@hellocucen, are you still playing around with this? I've had success with what I believe is the orange dot portion of the indicator. My win rate with it on stocks is 100% (4 of 4 trades) and 87% on futures (6 of 7 trades) trading off a daily chart. That's not a lot of trades but the results make it worth watching. I'm still trying to get it to plot as dots but can't figure out my coding error. If you haven't seen it, here's a more recent video than the one posted above. Happy trading!

 
Last edited:

Moose

Member
@hellocucen, are you still playing around with this? I've had success with what I believe is the orange dot portion of the indicator. My win rate with it on stocks is 100% (4 of 4 trades) and 87% on futures (6 of 7 trades) trading off a daily chart. That's not a lot of trades but the results make it worth watching. I'm still trying to get it to plot as dots but can't figure out my coding error. If you haven't seen it, here's a more recent video than the one posted above. Happy trading!

Can you share the code for the orange dot? Thank you.
 

FOTM_8888

Member
VIP
good job, thanks for share with us.. do you have the indicator with the dot? will be nice. thank you once again
 

ext99k

Member
Backtesting this, it doesn't look too good on several time frames... no where close to 70% trade efficiency as he mentions in his YouTube video
 
Last edited:

Similar threads

Top