I’ve been working a little with the PPS study and since I can’t always pay attention to the chart, I added some alerts to it.
Feedback is always welcome.
input ppsAlerts = no;
input todayOnly = yes;
input useSpace = no;
input offset = 0;
input price = close;
input rsiLength = 14;
input rsiOverBought = 70;
input rsiOverSold = 30;
input rsiAvgType = AverageType.Simple;
input macdFastLength = 12;
input macdSlowLength = 26;
input macdLength = 9;
input macdAvgType = AverageType.Simple;
def Today = if !todayOnly then 1 else if getday() == getLastDay() then 1 else 0;
# add a space to the chart between the bar and the arrows
def space = if useSpace then average(high-low)/3 else 0;
# pps buy signal
plot ppsBuy = If !Today then Double.NaN else pps().buySignal[offset]-space;
ppsBuy.SetPaintingStrategy(PaintingStrategy.arrow_up);
ppsBuy.AssignValueColor(color.GREEN);
alert(ppsAlerts && ppsBuy, “PPS Buy”,alert.BAR, sound.Ring);
# pps sell signal
plot ppsSell = If !Today then Double.NaN else pps().sellSignal[offset]+space;
ppsSell.SetPaintingStrategy(PaintingStrategy.arrow_down);
ppsSell.AssignValueColor(color.RED);
alert(ppsAlerts && ppsSell, “PPS Sell”,alert.BAR, Sound.Ring);
plot slowAvg = pps().slowAvg[offset];
plot fastAvg = pps().fastAvg[offset];
def macdDiff = MACD(macdFastLength, macdSlowLength, macdLength, macdAvgType).Diff[offset];
AddLabel(yes, "MACD:" + macdDiff, If macdDiff < 0 then Color.RED else Color.Green);
def rsiV = RSI(rsiLength, rsiOverBought, rsiOverSold, price, rsiAvgType).RSI[offset];
AddLabel(yes, "RSI:" + rsiV, if rsiV > rsiOverBought then Color.RED else if rsiV < rsiOverSold then color.Green else color.White);
TOS Links
- v1 http://tos.mx/gZvsJfw
- v2 http://tos.mx/JwfzkG6
- Now more configurable.
- rsi label uses colors.