Is it possible to create custom watch list columns

3AMBH

Member
2019 Donor
VIP
to show the red and green signal arrows?

Code:
#converted from mobisu macd to ppo
# this is actually macd and sqz indicator in one
# added pivots

declare lower;

input fastPeriod   = 12; #9/18/6 for 5m
input slowPeriod   = 26;
input signalPeriod = 9;
input price        = close;
input show = yes;


def fastEma   = ExpAverage( price, fastPeriod );
def slowEma   = ExpAverage( price, slowPeriod );
def periodOK  = fastPeriod < slowPeriod;
AddLabel( !periodOK, "ERROR: fastPeriod MUST be less than slowPeriod" );
def _ppo      = if periodOK then ((fastEma - slowEma) / slowEma) * 100 else 0;
def _signal   = ExpAverage( _ppo, signalPeriod );

# generic plots wiht colors
plot pmain   = _ppo;
pmain.SetDefaultColor( Color.BLUE );
pmain.SetLineWeight(2);
pmain.AssignValueColor(if pmain < 0 and pmain < pmain[1]  then Color.RED
                       else if pmain < 0 and  pmain > pmain[1] then Color.DARK_GREEN
                       else if pmain > 0 and pmain > pmain[1] then Color.GREEN
                       else Color.DARK_RED);
pmain.HideBubble();

plot mainEma   = _signal;
mainEma.SetDefaultColor( Color.RED );
mainEma.HideBubble();
AddCloud(pmain, mainEma, Color.GREEN, Color.RED);

#diff as histogram
plot diff    = _ppo - _signal;
diff.SetDefaultColor(GetColor(5));
diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
diff.SetLineWeight(3);
diff.DefineColor("Positive and Up", Color.GREEN);
diff.DefineColor("Positive and Down", Color.DARK_GREEN);
diff.DefineColor("Negative and Down", Color.RED);
diff.DefineColor("Negative and Up", Color.DARK_RED);
diff.AssignValueColor(if diff >= 0 then if diff > diff[1] then diff.Color("Positive and Up") else diff.Color("Positive and Down") else if diff < diff[1] then diff.Color("Negative and Down") else diff.Color("Negative and Up"));


#mobius divergence calc
def pmainh = CompoundValue(1,
            if pmain < 0 then Double.NaN
            else if pmain crosses above 0  then pmain
            else if pmain > 0 and  pmain > pmainh[1]
            then pmain else pmainh[1], 0);

def Valueh = CompoundValue(1,
             if pmain < 0 then Double.NaN
             else if pmain crosses above 0  then high
             else if pmain > 0 and high > Valueh[1] then high
             else Valueh[1], 0);

plot divLowSignal = if pmain > 0 and  high > Valueh[1] and pmain < pmainh[1] then 0
                 else Double.NaN;
divLowSignal.SetPaintingStrategy(PaintingStrategy.SQUARES);
divLowSignal.SetLineWeight(5);
divLowSignal.SetDefaultColor(Color.dark_orange);

def pmainL = CompoundValue(1, if pmain > 0 then Double.NaN
                             else if pmain crosses below 0  then pmain
                             else if pmain < 0 and pmain < pmainl[1] then pmain
                             else pmainl[1], 0);

def ValueL = CompoundValue(1, if pmain > 0  then Double.NaN
                              else if pmain crosses below 0 then low
                              else if pmain < 0 and low < Valuel[1] then low
                              else Valuel[1], 0);

plot divUpSignall = if pmain < 0 and   low < Valuel[1] and pmain > pmainl[1] then 0
                 else Double.NaN;
divupSignall.SetPaintingStrategy(PaintingStrategy.SQUARES);
divUpSignall.SetLineWeight(5);
divUPSignall.SetDefaultColor(Color.blue);



#zeroline
plot zeroLine = 0;
zeroLine.SetPaintingStrategy(PaintingStrategy.LINE);
zeroLine.SetLineWeight(1);
zeroLine.SetDefaultColor(Color.BLACK);


#pivots

def ptrend = pmain;
def prange = 2;
def pivotHigh = if IsNaN(ptrend[-1]) then 0  else Lowest(ptrend, prange)[1] > ptrend and Lowest(ptrend, prange)[-prange] > ptrend ;
def pivotLow =  if  IsNaN(ptrend[-1]) then 0  else Highest(ptrend, prange)[1] < ptrend and Highest(ptrend, prange)[-prange] < ptrend ;
#study
plot plotPH = if pivotHigh and show then ptrend else Double.NaN;
plotPH.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
plotPH.SetDefaultColor(Color.GREEN);

plot phline = if pivotHigh then pmain else Double.NaN;
phline.SetDefaultColor(Color.DARK_GREEN);
phline.EnableApproximation();phline.Hide();
#
plot plotPL = if pivotLow and show then ptrend else Double.NaN;
plotPL.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
plotPL.SetDefaultColor(Color.RED);

plot plline = if pivotLow then pmain else Double.NaN;
plline.SetDefaultColor(Color.RED);
plline.EnableApproximation(); plline.hide();

R3tf8yX.png
 

Geisman

New member
I came across a PPO type indicator script (I think written by Mobius or a variation of one of his) while looking at dual time frame type momentum play threads. I can't seem to find it but the indicator header is this;

#converted from mobius macd to ppo
# this is actually macd and sqz indicator in one
# added pivots

Can anyone point me to the correct thread? I'm trying to find out how to setup a scanner to populate a watchlist when the buy or sell signal is displayed. Thanks.
 

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
I found a Shared Link: https://tos.mx/VmatfLU in the PPO (Price Percent Oscillator) thread post#2
Scan for plotPH for up arrow and plotPL for down arrow
Ruby:
#converted from mobisu macd to ppo
# this is actually macd and sqz indicator in one
# added pivots

declare lower;

input fastPeriod   = 12; #9/18/6 for 5m
input slowPeriod   = 26;
input signalPeriod = 9;
input price        = close;
input show = yes;


def fastEma   = ExpAverage( price, fastPeriod );
def slowEma   = ExpAverage( price, slowPeriod );
def periodOK  = fastPeriod < slowPeriod;
AddLabel( !periodOK, "ERROR: fastPeriod MUST be less than slowPeriod" );
def _ppo      = if periodOK then ((fastEma - slowEma) / slowEma) * 100 else 0;
def _signal   = ExpAverage( _ppo, signalPeriod );

# generic plots wiht colors
plot pmain   = _ppo;
pmain.SetDefaultColor( Color.BLUE );
pmain.SetLineWeight(2);
pmain.AssignValueColor(if pmain < 0 and pmain < pmain[1]  then Color.RED
                       else if pmain < 0 and  pmain > pmain[1] then Color.DARK_GREEN
                       else if pmain > 0 and pmain > pmain[1] then Color.GREEN
                       else Color.DARK_RED);
pmain.HideBubble();

plot mainEma   = _signal;
mainEma.SetDefaultColor( Color.RED );
mainEma.HideBubble();
AddCloud(pmain, mainEma, Color.GREEN, Color.RED);

#diff as histogram
plot diff    = _ppo - _signal;
diff.SetDefaultColor(GetColor(5));
diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
diff.SetLineWeight(3);
diff.DefineColor("Positive and Up", Color.GREEN);
diff.DefineColor("Positive and Down", Color.DARK_GREEN);
diff.DefineColor("Negative and Down", Color.RED);
diff.DefineColor("Negative and Up", Color.DARK_RED);
diff.AssignValueColor(if diff >= 0 then if diff > diff[1] then diff.Color("Positive and Up") else diff.Color("Positive and Down") else if diff < diff[1] then diff.Color("Negative and Down") else diff.Color("Negative and Up"));


#mobius divergence calc
def pmainh = CompoundValue(1,
            if pmain < 0 then Double.NaN
            else if pmain crosses above 0  then pmain
            else if pmain > 0 and  pmain > pmainh[1]
            then pmain else pmainh[1], 0);

def Valueh = CompoundValue(1,
             if pmain < 0 then Double.NaN
             else if pmain crosses above 0  then high
             else if pmain > 0 and high > Valueh[1] then high
             else Valueh[1], 0);

plot divLowSignal = if pmain > 0 and  high > Valueh[1] and pmain < pmainh[1] then 0
                 else Double.NaN;
divLowSignal.SetPaintingStrategy(PaintingStrategy.SQUARES);
divLowSignal.SetLineWeight(5);
divLowSignal.SetDefaultColor(Color.dark_orange);

def pmainL = CompoundValue(1, if pmain > 0 then Double.NaN
                             else if pmain crosses below 0  then pmain
                             else if pmain < 0 and pmain < pmainl[1] then pmain
                             else pmainl[1], 0);

def ValueL = CompoundValue(1, if pmain > 0  then Double.NaN
                              else if pmain crosses below 0 then low
                              else if pmain < 0 and low < Valuel[1] then low
                              else Valuel[1], 0);

plot divUpSignall = if pmain < 0 and   low < Valuel[1] and pmain > pmainl[1] then 0
                 else Double.NaN;
divupSignall.SetPaintingStrategy(PaintingStrategy.SQUARES);
divUpSignall.SetLineWeight(5);
divUPSignall.SetDefaultColor(Color.blue);



#zeroline
plot zeroLine = 0;
zeroLine.SetPaintingStrategy(PaintingStrategy.LINE);
zeroLine.SetLineWeight(1);
zeroLine.SetDefaultColor(Color.BLACK);


#pivots

def ptrend = pmain;
def prange = 2;
def pivotHigh = if IsNaN(ptrend[-1]) then 0  else Lowest(ptrend, prange)[1] > ptrend and Lowest(ptrend, prange)[-prange] > ptrend ;
def pivotLow =  if  IsNaN(ptrend[-1]) then 0  else Highest(ptrend, prange)[1] < ptrend and Highest(ptrend, prange)[-prange] < ptrend ;
#study
plot plotPH = if pivotHigh and show then ptrend else Double.NaN;
plotPH.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
plotPH.SetDefaultColor(Color.GREEN);

plot phline = if pivotHigh then pmain else Double.NaN;
phline.SetDefaultColor(Color.DARK_GREEN);
phline.EnableApproximation();phline.Hide();
#
plot plotPL = if pivotLow and show then ptrend else Double.NaN;
plotPL.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
plotPL.SetDefaultColor(Color.RED);

plot plline = if pivotLow then pmain else Double.NaN;
plline.SetDefaultColor(Color.RED);
plline.EnableApproximation(); plline.hide();
HTH
 

Geisman

New member
Thanks for the reply. The indicator does display the arrows. I'm trying to find the original thread so I can see more of the discussion on it then setup a scan for it.
 

homeplate

Member
VIP
to show the red and green signal arrows?

Code:
#converted from mobisu macd to ppo
# this is actually macd and sqz indicator in one
# added pivots

declare lower;

input fastPeriod   = 12; #9/18/6 for 5m
input slowPeriod   = 26;
input signalPeriod = 9;
input price        = close;
input show = yes;


def fastEma   = ExpAverage( price, fastPeriod );
def slowEma   = ExpAverage( price, slowPeriod );
def periodOK  = fastPeriod < slowPeriod;
AddLabel( !periodOK, "ERROR: fastPeriod MUST be less than slowPeriod" );
def _ppo      = if periodOK then ((fastEma - slowEma) / slowEma) * 100 else 0;
def _signal   = ExpAverage( _ppo, signalPeriod );

# generic plots wiht colors
plot pmain   = _ppo;
pmain.SetDefaultColor( Color.BLUE );
pmain.SetLineWeight(2);
pmain.AssignValueColor(if pmain < 0 and pmain < pmain[1]  then Color.RED
                       else if pmain < 0 and  pmain > pmain[1] then Color.DARK_GREEN
                       else if pmain > 0 and pmain > pmain[1] then Color.GREEN
                       else Color.DARK_RED);
pmain.HideBubble();

plot mainEma   = _signal;
mainEma.SetDefaultColor( Color.RED );
mainEma.HideBubble();
AddCloud(pmain, mainEma, Color.GREEN, Color.RED);

#diff as histogram
plot diff    = _ppo - _signal;
diff.SetDefaultColor(GetColor(5));
diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
diff.SetLineWeight(3);
diff.DefineColor("Positive and Up", Color.GREEN);
diff.DefineColor("Positive and Down", Color.DARK_GREEN);
diff.DefineColor("Negative and Down", Color.RED);
diff.DefineColor("Negative and Up", Color.DARK_RED);
diff.AssignValueColor(if diff >= 0 then if diff > diff[1] then diff.Color("Positive and Up") else diff.Color("Positive and Down") else if diff < diff[1] then diff.Color("Negative and Down") else diff.Color("Negative and Up"));


#mobius divergence calc
def pmainh = CompoundValue(1,
            if pmain < 0 then Double.NaN
            else if pmain crosses above 0  then pmain
            else if pmain > 0 and  pmain > pmainh[1]
            then pmain else pmainh[1], 0);

def Valueh = CompoundValue(1,
             if pmain < 0 then Double.NaN
             else if pmain crosses above 0  then high
             else if pmain > 0 and high > Valueh[1] then high
             else Valueh[1], 0);

plot divLowSignal = if pmain > 0 and  high > Valueh[1] and pmain < pmainh[1] then 0
                 else Double.NaN;
divLowSignal.SetPaintingStrategy(PaintingStrategy.SQUARES);
divLowSignal.SetLineWeight(5);
divLowSignal.SetDefaultColor(Color.dark_orange);

def pmainL = CompoundValue(1, if pmain > 0 then Double.NaN
                             else if pmain crosses below 0  then pmain
                             else if pmain < 0 and pmain < pmainl[1] then pmain
                             else pmainl[1], 0);

def ValueL = CompoundValue(1, if pmain > 0  then Double.NaN
                              else if pmain crosses below 0 then low
                              else if pmain < 0 and low < Valuel[1] then low
                              else Valuel[1], 0);

plot divUpSignall = if pmain < 0 and   low < Valuel[1] and pmain > pmainl[1] then 0
                 else Double.NaN;
divupSignall.SetPaintingStrategy(PaintingStrategy.SQUARES);
divUpSignall.SetLineWeight(5);
divUPSignall.SetDefaultColor(Color.blue);



#zeroline
plot zeroLine = 0;
zeroLine.SetPaintingStrategy(PaintingStrategy.LINE);
zeroLine.SetLineWeight(1);
zeroLine.SetDefaultColor(Color.BLACK);


#pivots

def ptrend = pmain;
def prange = 2;
def pivotHigh = if IsNaN(ptrend[-1]) then 0  else Lowest(ptrend, prange)[1] > ptrend and Lowest(ptrend, prange)[-prange] > ptrend ;
def pivotLow =  if  IsNaN(ptrend[-1]) then 0  else Highest(ptrend, prange)[1] < ptrend and Highest(ptrend, prange)[-prange] < ptrend ;
#study
plot plotPH = if pivotHigh and show then ptrend else Double.NaN;
plotPH.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
plotPH.SetDefaultColor(Color.GREEN);

plot phline = if pivotHigh then pmain else Double.NaN;
phline.SetDefaultColor(Color.DARK_GREEN);
phline.EnableApproximation();phline.Hide();
#
plot plotPL = if pivotLow and show then ptrend else Double.NaN;
plotPL.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
plotPL.SetDefaultColor(Color.RED);

plot plline = if pivotLow then pmain else Double.NaN;
plline.SetDefaultColor(Color.RED);
plline.EnableApproximation(); plline.hide();

R3tf8yX.png
Hello! I'm homeplate2. I'm 15 years old and from Central Pennsylvania. I've been doing this for a few months. It's part of my freshman project work in high school. My goal is to make some money so I can buy some new spikes and glove and maybe some extra baseballs. There's nothing like the smell of a new glove and baseballs to make you smile!
 

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.
Top