Pivot Point Bar

Modified on 2010/01/03 09:37 by Eugene — Categorized as: Community Indicators

Syntax

public PivotPointBar(Bars bars, int period, bool pivotPointHigh, bool tradeable, string description) public static PivotPointBar Series(Bars bars, int period, bool pivotPointHigh, bool tradeable)

Parameter Description

bars A Bars object
period Indicator period. How many days (bars) from today (current bar) to look backward and forward (e.g. 5 = 11 days/bars in all)
pivotPointHigh True for Pivot Point High, false for Pivot Point Low
tradeable True for tradeable indicator, false for untradeable. Set to "false" to have the indicator peak ahead (invalid for trading system purposes) like Fidelity's indicator does, or to "true" for the indicator to look only backwards, so trades could be entered based on the indicator being true or false.

Description

PivotPointBar returns the bar number of the most-recent Pivot Point. Based on Fidelity Active Trader Pro® Pivot Points when Period = 5 and Tradeable = false.

As ATP® Charting Indicators help says, Pivot Points high indicate a potential reversal if the security trades at a 10 bar high and pivot points low indicate a potential reversal if the security trades at a 10 bar low. The condition is then tested with the price indicated on the pivot point arrow. If the security trades below the price for pivot point high, you enter the position short. If the security trades above the price for the pivot point low, you enter the position long. The price indicator is the "Typical Price" indicator (H+L+C)/3.

Pivot points "look forward" and can subsequently move the points depending on how the market trades subsequent to the first indication of a potential reversal. Unfortunately, since you do not know at the time if the trend will continue, you have no way of knowing if the trade will work in advance. You can see this in action on an intra-day chart. Set the pivot point indicators and watch them show up as the day progresses. Occasionally the points will move forward in time (or disappear completely) as the trend goes against the pivot. The problem with pivot points is that they always look perfect in retrospect but involve a degree of risk. Set the indicator's boolean parameter "tradeable" to true to eliminate any peaking forward that the ATP version is affected with.

This indicator is coded by ss161 (Steve Salemy) and modified by Cone (Robert Sucher).

Example

/* Demo to duplicate Non-tradeable Pivot Point annotations in AT Pro */

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

namespace WealthLab.Strategies { public class PivotPointsDemo : WealthScript { private StrategyParameter _per; private StrategyParameter _tradeable;

public PivotPointsDemo() { _per = CreateParameter("Pivot Period",5,2,21,2); _tradeable = CreateParameter("Tradeable=1",0,0,1,1); }

protected override void Execute() { Font font = new Font("Wingdings", 8, FontStyle.Bold); string upArrow = Convert.ToChar(0x00E9).ToString(); string dnArrow = Convert.ToChar(0x00EA).ToString();

int per = _per.ValueInt;

// When tradeable = true, notice that the pivot point changes frequently bool tradeable = (_tradeable.ValueInt == 1);

DataSeries ppH_bar = PivotPointBar.Series(Bars, per, true, tradeable); DataSeries ppL_bar = PivotPointBar.Series(Bars, per, false, tradeable);

for(int bar = per; bar < Bars.Count; bar++) { if( ppH_barbar != ppH_barbar - 1 ) { AnnotateBar(dnArrow, bar, true, Color.Red, Color.Transparent, font); } else if( ppL_barbar != ppL_barbar - 1 ) { AnnotateBar(upArrow, bar, false, Color.Green, Color.Transparent, font); } } } } }