Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2011-11 | Put/Call Ratio Indicators (Vervoort)


Traders' Tip text

Wealth-Lab users should install the CBOE Provider extension from Wealth-Lab.com to easily access and update Put/Call Ratio data directly from the CBOE website. The script simply plots the now-formalized PCRI indicators from our ever-expanding TASCIndicator Library. TransformSeries is a routine required only to plot an unscaled version of the Slow PCRI in the 0 to 100 oscillator range of the Fast PCRI and IFT versions of the indicator.

Figure 1. Plots of the raw, but “clipped” P/C Ratio data (bottom) and the three PCRI indicators presented in the article.

Note: The indicators were added to the TASCIndicators library, version 2011.10.0.0

using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using TASCIndicators; //Requires CBOE provider extensions from www.wealth-lab.com

namespace WealthLab.Strategies { public class PutCallRatioIndicator : WealthScript { StrategyParameter _rsiPeriod; StrategyParameter _wmaPeriod; StrategyParameter _devs; StrategyParameter _slowRainbowPeriod; StrategyParameter _wmaSlow; StrategyParameter _rsiPer; public PutCallRatioIndicator() { _rsiPeriod = CreateParameter("Fast RSI Period", 5, 2, 30, 1); _wmaPeriod = CreateParameter("Fast WMA Period", 5, 2, 10, 1); _devs = CreateParameter("SD Multiple", 1.3, 1, 2, 0.1); _slowRainbowPeriod = CreateParameter("Slow Rbw Period", 4, 1, 10, 1); _wmaSlow = CreateParameter("Slow Smooth Period", 2, 1, 10, 1); _rsiPer = CreateParameter("Slow IF RSI Period", 8, 1, 20, 1); } // Transforms a series for unscaled plotting (translated from WL4 Code Library, Dexter Brunet) public DataSeries TransformSeries( DataSeries ds, double a1, double a2, double b1, double b2) { string sName = ds.Description + "(No Scale)"; if (Math.Abs(a1 - a2) > 0.00001) { double a = (b1 - b2)/(a1 - a2); double b = (b2 * a1 - a2 * b1)/(a1 - a2); DataSeries s = ds * a; s += b; s.Description = sName; return s; } else return ds; } protected override void Execute() { // Access the raw P/C Ratio data //DataSeries pcrEQ = GetExternalSymbol("CBOE Put/Call Ratio", "EQUITYPC", true).Close; DataSeries pcrEQ = GetExternalSymbol("EQUITYPC", true).Close; /* Create and plot indicators */ HideVolume(); DataSeries fastPCRI = PCRiFast.Series(pcrEQ, _rsiPeriod.ValueInt, _wmaPeriod.ValueInt); DataSeries uBand = BBandUpper.Series(fastPCRI, 200, 1.3); DataSeries lBand = BBandLower.Series(fastPCRI, 200, 1.3); DataSeries slowPCRI = PCRiSlow.Series(pcrEQ, _slowRainbowPeriod.ValueInt, _wmaSlow.ValueInt); ChartPane rsiPane = CreatePane(40, false, true); PlotSeries(rsiPane, fastPCRI, Color.Black, LineStyle.Solid, 2); PlotSeries(rsiPane, uBand, Color.Blue, LineStyle.Dashed, 1); PlotSeries(rsiPane, lBand, Color.Blue, LineStyle.Dashed, 1); // Transform slowPCRI for plotting in same pane as fastPCRI int n = Bars.Count - 1; DataSeries slowT = TransformSeries(slowPCRI, Lowest.Value(n, slowPCRI, n - 30), Highest.Value(n, slowPCRI, n - 30), 0, 100); PlotSeries(rsiPane, slowT, Color.Red, LineStyle.Solid, 2); DataSeries pcri_IF = PCRiSlowIFT.Series(pcrEQ, _slowRainbowPeriod.ValueInt, _wmaSlow.ValueInt, _rsiPer.ValueInt); PlotSeries(rsiPane, pcri_IF, Color.Blue, LineStyle.Solid, 2); ChartPane pcPane = CreatePane(40, false, true); PlotSeries(pcPane, pcrEQ, Color.Black, LineStyle.Solid, 2, "P/C Ratio (raw, clipped)"); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.

ScrewTurn Wiki. Some of the icons created by FamFamFam.