Parabolic

Modified on 2008/05/03 08:52 by Administrator — Categorized as: Standard Indicators

Syntax

public Parabolic(Bars bars, double accelUp, double accelDown, double accelMax, string description)
public static Parabolic Series(Bars bars, double accelUp, double accelDown, double accelMax)

Parameter Description

bars The Bars object
accelUp Acceleration during up moves
accelDown Acceleration during down moves
accelMax Maximum acceleration

Description

Welles Wilder's Parabolic SAR is actually a type of trailing stop-based system, but it's often used as an indicator. The SAR (Stop And Reverse) uses a trailing stop level that follows prices as they move up or down. The stop level increases speed based on an "Acceleration Factor". When plotted on the chart, this stop level resembles a parabolic curve, thus the indicator's name. The Parabolic function accepts 3 parameters. The first two control the Acceleration during up and down moves, respectively. The last parameter determines the maximum Acceleration.

The Parabolic assumes that you are trading a trend and therefore expects price to change over time. If you are long the Parabolic SAR will move the stop up every period, regardless of whether the price has moved. It moves down if you are short.

Interpretation


Calculation

SARt = SARc + AF * (EP - SARc), where

SARt = the stop for the next bar
SARc = the stop for the current bar
AF = Acceleration Factor
EP = Extreme Point for current trade

The AF used by Wilder is 0.02. This means move the stop 2 percent of distance between EP and the original stop. Each time the EP changes, the AF increases by 0.02 up to the maximum acceleration, 0.2 in Wilders' case. Practical values are: AF range 0.01 to 0.025, and AFmax range of 0.1 to 0.25.

If long then EP is the highest high since going long, if short then EP is the lowest low since going short.

Example

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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { double x = 0; PlotSeries( PricePane, Parabolic.Series( Bars, 0.02, 0.02, 0.2 ), Color.Red, WealthLab.LineStyle.Dots, 3 ); for(int bar = 20; bar < Bars.Count; bar++) { x = Parabolic.Series( Bars, 0.02, 0.02, 0.2 )[bar];

if (!IsLastPositionActive) { if( Low[bar] < x ) BuyAtStop( bar+1, x ); else ShortAtStop( bar+1, x ); } else { Position p = LastPosition; if( p.PositionType == PositionType.Long ) { SellAtStop( bar+1, p, x ); ShortAtStop( bar+1, x ); } else { CoverAtStop( bar+1, p, x ); BuyAtStop( bar+1, x ); } } } } } }