Loading ...
Sorry, an error occurred while loading the content.

Re: [TOS_thinkscript] Re: Herrick Payoff Index

Expand Messages
  • Options Vic
    Hi Richard, Here s a cheesy attempt on your code to retrieve the open interest for stock using string concatenation. Assuming it s Apple with strike of 350 for
    Message 1 of 10 , Feb 7, 2011
    View Source
    • 0 Attachment
      Hi Richard,

      Here's a cheesy attempt on your code to retrieve the open interest for stock using string concatenation. Assuming it's Apple with strike of 350 for this month expiration. Would this be correct? Anyway to dynamically figure out the stock symbol, expiration and the nearest strike price?

      Regards,
      -Vic



      ## -- code starts here....
      declare lower;

      input C = 100;
      input S = 10;

      declare lower;
      input ticker = "AAPL";
      input expdate = "110219";
      input strike = "350";

      def OI_Today = open_interest (concat(concat(concat(".",ticker),concat(expdate,"c")),strike));
      def OI_Yesterday = open_interest(concat(concat(concat(".",ticker),concat(expdate,"c")),strike))[1];


      def M = ( high + low ) / 2; #average price
      def V = volume;
      def I = AbsValue( OI_Today - OI_Yesterday );
      def G = Min( OI_Today, OI_Yesterday );
      def K = ( ( M - M[1] ) * C * V ) * ( 1 + ( if( M > M[1], (1), (-1) ) * ( I * 2 ) / G ) );

      plot HPI = Average( K[1] + ( K - K[1] ), S );
      # def ZeroLine = 0;
      plot Zeroline = 0;




      On Sun, Feb 6, 2011 at 5:08 PM, Richard Houser <rhouser@...> wrote:
       

      Note this only works with equities/commodities that have an open interest.

      #hint:<b>Herrick Payoff Index</b>\nHelps detect accumulation and distribution, uses HIGH, LOW, VOLUME, and OPEN INTEREST
      #hint C: The value of a 1 cent move
      #hint S: Smoothing period

      declare lower;

      input C = 100;
      input S = 10;

      def M = ( high + low ) / 2; #average price
      def V = volume;
      def I = AbsValue( open_interest - open_interest[1] );
      def G = Min( open_interest, open_interest[1] );
      def K = ( ( M - M[1] ) * C * V ) * ( 1 + ( if( M > M[1], (1), (-1) ) * ( I * 2 ) / G ) );

      plot HPI = Average( K[1] + ( K - K[1] ), S );





       

      From: TOS_thinkscript@yahoogroups.com [mailto:TOS_thinkscript@yahoogroups.com] On Behalf Of pintelho
      Sent: Sunday, February 06, 2011 2:41 PM
      To: TOS_thinkscript@yahoogroups.com
      Subject: [TOS_thinkscript] Re: Herrick Payoff Index

       

       

      hi all,
      Yes it is mostly used for futures and anything with Open interest since that is a key variable.


      Formula can be found here:
      http://www.stator-afm.com/herrick-payoff-index.html

      Appreciate all the help you can give me.
      thanks,
      Jorge

      --- In TOS_thinkscript@yahoogroups.com, "anonymous_postor" <vippub@...> wrote:
      >
      > Herrick Payoff Index
      >
      > John Herrick's technical index tracks volume, price and open interest into an aggregate value that is meant to capture trends and their reversals. HPI uses daily high and low prices, volume and open interest - preferably of all contracts (futures and options) - from a period of at least three weeks. HPI applies these to prices of the most active delivery month. Instead of using closing prices, the HPI measures mean prices, which are the average consensus of value for the day. Quite simply, when volume increases, the absolute value of the HPI also increases.
      >
      > Further, you may remember that a rising open interest is a bullish signal in an uptrend and a bearish signal in a downtrend. Conversely, a falling open interest is a bearish signal in an uptrend and a bullish signal in a downtrend. A flat open interest is neutral. We can apply these principles to the HPI: when it breaks its longer-term trend line, it gives a leading signal, indicating that a price trend is likely to be broken through. When HPI crosses its center line, the price trend is confirmed.
      >
      > But we can extend these principles further: when prices reach a new low but the HPI records a higher volume than a previous decline, a buy signal is issued (this is a bullish divergence). When the HPI turns up from this second bottom, the trader has an opportunity to place a protective stop below the latest low price. The corresponding bearish divergence occurs when prices hit a new high, but the HPI reaches a lower top. The short-sell signal occurs when the HPI turns down, so the trader would use a stop above the latest high. The Herrick Payoff Index is an excellent indicator of the market's overall bullishness or bearishness. When the HPI is above its center line, bulls are in control. When the HPI lies below the center, a trader would be wise to sell short.
      >
      > http://www.investopedia.com/articles/trading/03/011703.asp
      >
      > --- In TOS_thinkscript@yahoogroups.com, Jay Thakkar jraj.thakkar.23@ wrote:
      > >
      > > Is this indicator just used for trading futures and options?
      > >
      > > Jay
      > >
      > > On Sun, Feb 6, 2011 at 12:28 AM, pintelho jorgelmouro@ wrote:
      > >
      > > >
      > > >
      > > > Hi Everybody,
      > > > Has anyone coded a Herrick Payoff Index for TOS?
      > > > This is from Alexander Elder's book Trading for a Living and it is a study
      > > > that is based on price and Open Interest.
      > > >
      > > > Any assistance would be greatly appreciated.
      > > > Cheers,
      > > > Jorge
      > > >
      > > >
      > > >
      > >
      >


    • pintelho
      Rich, thanks for the code...but I think G is supposed to be max...no?
      Message 2 of 10 , Feb 7, 2011
      View Source
      • 0 Attachment
        Rich,
        thanks for the code...but I think G is supposed to be max...no?


        --- In TOS_thinkscript@yahoogroups.com, "anonymous_postor" <vippub@...> wrote:
        >
        > <contracts (futures and options) - >
        >
        > Also options but the problem would be grabbing the respective options' symbols rather than the symbol of the underlying stock symbol.
        >
        > It would be an interesting study for options if it were easy to grab options' symbols on a given underkying stock.
        >
        > --- In TOS_thinkscript@yahoogroups.com, "Richard Houser" <rhouser@> wrote:
        > >
        > > Note this only works with equities/commodities that have an open interest.
        > >
        > > #hint:<b>Herrick Payoff Index</b>\nHelps detect accumulation and
        > > distribution, uses HIGH, LOW, VOLUME, and OPEN INTEREST
        > > #hint C: The value of a 1 cent move
        > > #hint S: Smoothing period
        > >
        > > declare lower;
        > >
        > > input C = 100;
        > > input S = 10;
        > >
        > > def M = ( high + low ) / 2; #average price
        > > def V = volume;
        > > def I = AbsValue( open_interest - open_interest[1] );
        > > def G = Min( open_interest, open_interest[1] );
        > > def K = ( ( M - M[1] ) * C * V ) * ( 1 + ( if( M > M[1], (1), (-1) ) * ( I *
        > > 2 ) / G ) );
        > >
        > > plot HPI = Average( K[1] + ( K - K[1] ), S );
        > >
        > >
        > >
        > >
        > >
        > >
        > >
        > >
        > >
        > > From: TOS_thinkscript@yahoogroups.com
        > > [mailto:TOS_thinkscript@yahoogroups.com] On Behalf Of pintelho
        > > Sent: Sunday, February 06, 2011 2:41 PM
        > > To: TOS_thinkscript@yahoogroups.com
        > > Subject: [TOS_thinkscript] Re: Herrick Payoff Index
        > >
        > >
        > >
        > >
        > >
        > > hi all,
        > > Yes it is mostly used for futures and anything with Open interest since that
        > > is a key variable.
        > > <file:///C:\DOCUME~1\jmouro\LOCALS~1\Temp\moz-screenshot-2.png>
        > >
        > > Formula can be found here:
        > > http://www.stator-afm.com/herrick-payoff-index.html
        > >
        > > Appreciate all the help you can give me.
        > > thanks,
        > > Jorge
        > >
        > > --- In TOS_thinkscript@yahoogroups.com, "anonymous_postor" <vippub@>
        > > wrote:
        > > >
        > > > Herrick Payoff Index
        > > >
        > > > John Herrick's technical index tracks volume, price and open interest into
        > > an aggregate value that is meant to capture trends and their reversals. HPI
        > > uses daily high and low prices, volume and open interest - preferably of all
        > > contracts (futures and options) - from a period of at least three weeks. HPI
        > > applies these to prices of the most active delivery month. Instead of using
        > > closing prices, the HPI measures mean prices, which are the average
        > > consensus of value for the day. Quite simply, when volume increases, the
        > > absolute value of the HPI also increases.
        > > >
        > > > Further, you may remember that a rising open interest is a bullish signal
        > > in an uptrend and a bearish signal in a downtrend. Conversely, a falling
        > > open interest is a bearish signal in an uptrend and a bullish signal in a
        > > downtrend. A flat open interest is neutral. We can apply these principles to
        > > the HPI: when it breaks its longer-term trend line, it gives a leading
        > > signal, indicating that a price trend is likely to be broken through. When
        > > HPI crosses its center line, the price trend is confirmed.
        > > >
        > > > But we can extend these principles further: when prices reach a new low
        > > but the HPI records a higher volume than a previous decline, a buy signal is
        > > issued (this is a bullish divergence). When the HPI turns up from this
        > > second bottom, the trader has an opportunity to place a protective stop
        > > below the latest low price. The corresponding bearish divergence occurs when
        > > prices hit a new high, but the HPI reaches a lower top. The short-sell
        > > signal occurs when the HPI turns down, so the trader would use a stop above
        > > the latest high. The Herrick Payoff Index is an excellent indicator of the
        > > market's overall bullishness or bearishness. When the HPI is above its
        > > center line, bulls are in control. When the HPI lies below the center, a
        > > trader would be wise to sell short.
        > > >
        > > > http://www.investopedia.com/articles/trading/03/011703.asp
        > > >
        > > > --- In TOS_thinkscript@yahoogroups.com, Jay Thakkar jraj.thakkar.23@
        > > wrote:
        > > > >
        > > > > Is this indicator just used for trading futures and options?
        > > > >
        > > > > Jay
        > > > >
        > > > > On Sun, Feb 6, 2011 at 12:28 AM, pintelho jorgelmouro@ wrote:
        > > > >
        > > > > >
        > > > > >
        > > > > > Hi Everybody,
        > > > > > Has anyone coded a Herrick Payoff Index for TOS?
        > > > > > This is from Alexander Elder's book Trading for a Living and it is a
        > > study
        > > > > > that is based on price and Open Interest.
        > > > > >
        > > > > > Any assistance would be greatly appreciated.
        > > > > > Cheers,
        > > > > > Jorge
        > > > > >
        > > > > >
        > > > > >
        > > > >
        > > >
        > >
        >
      • Richard Houser
        Apparently that depends on who you re listening to. So for instance, Elder on p. 184 of Trading for a Living says, G = today s or yesterday s open interest,
        Message 3 of 10 , Feb 7, 2011
        View Source
        • 0 Attachment

          Apparently that depends on who you're listening to. So for instance, Elder on p. 184 of Trading for a Living says, "G = today's or yesterday's open interest, whichever is less." Whilst http://www.stator-afm.com/herrick-payoff-index.html says "G = The greater of today's or yesterday's open interest." You asked for Elder, that's what you got, if you'd rather have something scrapped off the internet...well I think you can change Min to Max.

           

          Just yankin' your beazer, there seems to be agreement on the internet on "greater" but every mention looks like it's been copied from the same source, Technical Analysis of Stocks and Commodities V. 6:3(115-118) : Payoff Index by Thomas E. Aspray.

           

          John Herrick, himself, writes the formula as

           

          http://www.fmlabs.com/reference/HerrickPayoffIndex.gif

           

          If I had to lay my coin on one, I'd go with Dr. Elder and John Herrick and leave the code as it was supplied. Note Herrick doesn't bother with the +/- stuff that both Elder and Aspray do.

           

           

           

          From: TOS_thinkscript@yahoogroups.com [mailto:TOS_thinkscript@yahoogroups.com] On Behalf Of pintelho
          Sent: Monday, February 07, 2011 11:04 PM
          To: TOS_thinkscript@yahoogroups.com
          Subject: [TOS_thinkscript] Re: Herrick Payoff Index

           

           

          Rich,
          thanks for the code...but I think G is supposed to be max...no?

          --- In TOS_thinkscript@yahoogroups.com, "anonymous_postor" <vippub@...> wrote:
          >
          > <contracts (futures and options) - >
          >
          > Also options but the problem would be grabbing the respective options' symbols rather than the symbol of the underlying stock symbol.
          >
          > It would be an interesting study for options if it were easy to grab options' symbols on a given underkying stock.
          >
          > --- In TOS_thinkscript@yahoogroups.com, "Richard Houser" <rhouser@> wrote:
          > >
          > > Note this only works with equities/commodities that have an open interest.
          > >
          > > #hint:<b>Herrick Payoff Index</b>\nHelps detect accumulation and
          > > distribution, uses HIGH, LOW, VOLUME, and OPEN INTEREST
          > > #hint C: The value of a 1 cent move
          > > #hint S: Smoothing period
          > >
          > > declare lower;
          > >
          > > input C = 100;
          > > input S = 10;
          > >
          > > def M = ( high + low ) / 2; #average price
          > > def V = volume;
          > > def I = AbsValue( open_interest - open_interest[1] );
          > > def G = Min( open_interest, open_interest[1] );
          > > def K = ( ( M - M[1] ) * C * V ) * ( 1 + ( if( M > M[1], (1), (-1) ) * ( I *
          > > 2 ) / G ) );
          > >
          > > plot HPI = Average( K[1] + ( K - K[1] ), S );
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > > From: TOS_thinkscript@yahoogroups.com
          > > [mailto:TOS_thinkscript@yahoogroups.com] On Behalf Of pintelho
          > > Sent: Sunday, February 06, 2011 2:41 PM
          > > To: TOS_thinkscript@yahoogroups.com
          > > Subject: [TOS_thinkscript] Re: Herrick Payoff Index
          > >
          > >
          > >
          > >
          > >
          > > hi all,
          > > Yes it is mostly used for futures and anything with Open interest since that
          > > is a key variable.
          > > <file:///C:\DOCUME~1\jmouro\LOCALS~1\Temp\moz-screenshot-2.png>
          > >
          > > Formula can be found here:
          > > http://www.stator-afm.com/herrick-payoff-index.html
          > >
          > > Appreciate all the help you can give me.
          > > thanks,
          > > Jorge
          > >
          > > --- In TOS_thinkscript@yahoogroups.com, "anonymous_postor" <vippub@>
          > > wrote:
          > > >
          > > > Herrick Payoff Index
          > > >
          > > > John Herrick's technical index tracks volume, price and open interest into
          > > an aggregate value that is meant to capture trends and their reversals. HPI
          > > uses daily high and low prices, volume and open interest - preferably of all
          > > contracts (futures and options) - from a period of at least three weeks. HPI
          > > applies these to prices of the most active delivery month. Instead of using
          > > closing prices, the HPI measures mean prices, which are the average
          > > consensus of value for the day. Quite simply, when volume increases, the
          > > absolute value of the HPI also increases.
          > > >
          > > > Further, you may remember that a rising open interest is a bullish signal
          > > in an uptrend and a bearish signal in a downtrend. Conversely, a falling
          > > open interest is a bearish signal in an uptrend and a bullish signal in a
          > > downtrend. A flat open interest is neutral. We can apply these principles to
          > > the HPI: when it breaks its longer-term trend line, it gives a leading
          > > signal, indicating that a price trend is likely to be broken through. When
          > > HPI crosses its center line, the price trend is confirmed.
          > > >
          > > > But we can extend these principles further: when prices reach a new low
          > > but the HPI records a higher volume than a previous decline, a buy signal is
          > > issued (this is a bullish divergence). When the HPI turns up from this
          > > second bottom, the trader has an opportunity to place a protective stop
          > > below the latest low price. The corresponding bearish divergence occurs when
          > > prices hit a new high, but the HPI reaches a lower top. The short-sell
          > > signal occurs when the HPI turns down, so the trader would use a stop above
          > > the latest high. The Herrick Payoff Index is an excellent indicator of the
          > > market's overall bullishness or bearishness. When the HPI is above its
          > > center line, bulls are in control. When the HPI lies below the center, a
          > > trader would be wise to sell short.
          > > >
          > > > http://www.investopedia.com/articles/trading/03/011703.asp
          > > >
          > > > --- In TOS_thinkscript@yahoogroups.com, Jay Thakkar jraj.thakkar.23@
          > > wrote:
          > > > >
          > > > > Is this indicator just used for trading futures and options?
          > > > >
          > > > > Jay
          > > > >
          > > > > On Sun, Feb 6, 2011 at 12:28 AM, pintelho jorgelmouro@ wrote:
          > > > >
          > > > > >
          > > > > >
          > > > > > Hi Everybody,
          > > > > > Has anyone coded a Herrick Payoff Index for TOS?
          > > > > > This is from Alexander Elder's book Trading for a Living and it is a
          > > study
          > > > > > that is based on price and Open Interest.
          > > > > >
          > > > > > Any assistance would be greatly appreciated.
          > > > > > Cheers,
          > > > > > Jorge
          > > > > >
          > > > > >
          > > > > >
          > > > >
          > > >
          > >
          >

        • oceanbearing
          I coded the Herrick Payoff Ratio but the plot does not look similar to sample studies as shown in this link. This study is used with futures that have open
          Message 4 of 10 , Oct 18, 2013
          View Source
          • 0 Attachment
            I coded the Herrick Payoff Ratio but the plot does not look similar to sample studies as shown in this link. This study is used with futures that have open interest.   
            http://www.metastock.com/Customer/Resources/TAAZ/?c=3&p=61


            Below is my coding of the given formula can people comment if my implementation is correct?

            declare lower;
            input C = 100.0;
            input s = 10.0;
            def absoi = AbsValue(open_interest() - open_interest()[1]);
            def msign = if hl2 > hl2[1] then 1 else -1;
            def hoi = Highest(open_interest(), 2);

            def HPIx = (HPIx[1] + ((C * volume * (hl2 - hl2[1]) * (1 + msign * (2 * absoi / hoi)) - HPIx[1]) * s)) / 100000;
            plot HPI = HPIx;
            plot z = 0;
          Your message has been successfully submitted and would be delivered to recipients shortly.