Sunday, March 16, 2014

thinkscript included: sdi_lastpps - return last pps signal - useful for multiple time-frame scans

the lastpps script returns the last buy/sell signal of the proprietary pps indicator. it returns +1 if the last pps signal was a buysignal and -1 if the last pps signal was a sellsignal. this script is intended to be used in a custom-study scan although it could be added to a watchlist as a custom column.

i find the pps indicator to be very good at getting one into a good trade early. after reading brian shannon's technical analysis using multiple timeframes (see brane fud page), though, i want to scan for stocks that are exhibiting a pps signal concurrently in multiple timeframes and the thinkorswim implementation of pps does not facilitate this because it only delivers a signal on the bar when the trigger occurs. that's good for charts but lousy for multiple timeframe scans where the signal almost never develops in the current bar on all timescales.

here's how i use sdi_lastpps in a multiple timeframe scan for bullish stocks:

just swap the greater relationship operator with less and you have a bearish scan. (note: you will need to have a funded thinkorswim account to implement a custom scan.)

here's the code, not much to it really:

################################
# sdi_lastpps: returns the last buy/sell signal of the proprietary pps indicator. it returns +1 if the last pps signal was a buysignal and -1 if the last pps signal was a sellsignal. this script is intended to be used in a custom-study scan.
#hint: returns the last buy/sell signal of the proprietary pps indicator. it returns +1 if the last pps signal was a buysignal and -1 if the last pps signal was a sellsignal. this script is intended to be used in a custom-study scan. rev: 1.0
http://www.smallDogInvestor.com
# author: allen everhart
# date: 16mar2014
# copylefts reserved. This is free software. That means you are free
# to use or modify it for your own usage but not for resale.
# Help me get the word out about my blog by keeping this header
# in place.

def sig=
    if(!isnan(PPS().buySignal)) then 1
    else if( !isnan(PPS().sellSignal)) then -1
    else sig[1];
plot lastSignal=sig;

################################

11 comments:

  1. Can you confirm that the link you provided for "brane fud" relates to Brian Shannon...and PPS?

    Thank you for all the code you provide(free!)

    David

    ReplyDelete
    Replies
    1. brian has nothing to do with the pps indicator which was created by john person. i was referring to brian's use of multiple timeframes which he elaborates in his book on my scrolling display in the brane fud page. while brian uses moving averages in multiple timeframes, i was seeking to use the pps in multiple timeframes.
      best.
      -allen

      Delete
  2. Nice indicator for a scan. And thank you. Am I supposed to see a 1 0r -1 posted on my results. I get 362 stocks some have up arrow on all time frames and some don't. Some even have down arrows . I'm a little confused. Can you help. Thank you.

    ReplyDelete
  3. Sorry for being so dumb. I have it figured out now. Thank you for all your work.

    ReplyDelete
  4. I'm back. Entered your code, did a scan came up with 362 stocks. Some have three time frames the same some don't. Some are bullish and some bearish. What am I doing wrong? I noticed my code window says +1 or -1 and not 0 like your does. Perplexed.

    ReplyDelete
    Replies
    1. hi augie. sdi_lastpps returns +1 or -1. if your code window is using EQUAL TO as the relational operator then +1/-1 is likely correct, i am using GREATER/LESS than zero in my example. i have noticed that TOS gives inconsistent results on the DAY timeframe and i suspect that some other aggregation period is used erroneously. the script gives correct results and i have verified this by placing it on a chart where i can see the +1/-1 transitions. if you are using the DAY timeframe then see if you get consistent results substituting the 4Hour time frame (which is what I am using for now.)

      Delete
  5. Thanks Allen. Appreciate all your work. Augie, aka A Fan.

    ReplyDelete
  6. How do you replace the script with greater or less then?

    ReplyDelete
    Replies
    1. click on the pencil icon located to the right.

      Delete
  7. Hi Allen I like using the PPS signal in scans above the 50 linear regchannel upper line for shorts was wondering if you are familiar with the TTM_SCALPER ALERT when the arrow appears is there a way to SCAN for when the TTM_SCALPER ALERT when the arrow is triggered .I dont know if this is possible I know the arrow is delayed I think 3 bars ? I notice when there is ttm arrow and pps arrow there is high success THANKS FOR ANY HELP in weather this is possible.

    ReplyDelete
    Replies
    1. TTM_SCALPER_ALERT is essentially a consecutive bar signal with a 'min_swing' filter (which defaults to zero.) The fact that the indicator is offset three bars into the past from the triggering bar is probably why the TOS developers do not include it as a study that is eligible for custom scanning. However, such custom scans are possible and an example is the sdi_altbuy study which is very nearly what you would want to scan for the equivalent of pivotLow's. Contact me at support@smalldoginvestor.com if you want me to develop a custom pivotHigh scanner or similar consecutive-bar scan-friendly study.

      Delete