Log in to see Cloud of Tags

Wealth-Lab Wiki

Psychological Index

RSS

Psychological Index: Indicator Documentation

Syntax

DataSeries PsychIndex(Bars bars, int period)

Parameter Description

bars A Bars object
period Lookback period

Description

The Psychological Index is an overbought/oversold indicator described in the June 2000 Futures Magazine. The article described the standard lookback period as 12 bars with a level of 75% or higher being an indication of an overbought market and 25% or lower being an oversold market.

Example

A system in this example is always in the market. It goes long and short by the Psychological Index's readings:

using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Indicators;

namespace WealthLab.Strategies { // Psychological Index public class PsychIndex : WealthScript { private StrategyParameter paramLookback; private StrategyParameter paramUpper; private StrategyParameter paramLower; public PsychIndex() { paramLookback = CreateParameter( "Lookback", 12, 3, 30, 1 ); paramUpper = CreateParameter( "Upper", 75, 0, 100, 1 ); paramLower = CreateParameter( "Lower", 25, 0, 100, 1 ); } protected override void Execute() { int Lookback = paramLookback.ValueInt; int Upper = paramUpper.ValueInt; int Lower = paramLower.ValueInt; PsychologicalIndex pi = PsychologicalIndex.Series( Bars, Lookback ); pi.Description = "Psychological Index";

ChartPane PsychIndexPane = CreatePane( 25, true, true ); PlotSeries( PsychIndexPane, pi, Color.Green, LineStyle.Solid, 2 ); DrawHorzLine( PsychIndexPane, Upper, Color.Blue, LineStyle.Solid, 2 ); DrawHorzLine( PsychIndexPane, Lower, Color.Red, LineStyle.Solid, 2 ); for(int bar = Lookback; bar < Bars.Count; bar++) { if ( Positions.Count == 0 ) { if ( pibar <= Lower ) BuyAtMarket( bar+1 ); else if( pibar >= Upper ) ShortAtMarket( bar+1 ); } else { Position p = LastPosition; if( p.PositionType == PositionType.Long ) { if( pibar >= Upper ) { SellAtMarket( bar+1, p ); ShortAtMarket( bar+1 ); } } else if ( pibar <= Lower ) { CoverAtMarket( bar+1, p ); BuyAtMarket( bar+1 ); } } } } } }

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.