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
- The Parabolic SAR trading system uses the Parabolic level as a Stop and Reverse point. This stop is calculated for the next period. When the stop is hit, this signals to close the trade and take a new trade in the opposite direction. The system is typically always in the market.
- When price movement trades in a narrow trading range, the Parabolic SAR will whipsaw. The Parabolic is trend following indicator, it is useless in the absence of a trend. Use another indicator, such as ADXR, to determine trend strength.
- The Parabolic excels in fast moving trends that accelerate as they progress. The stops are also calculated to accelerate, hence you need to have the correct "Acceleration Factor" to match the market you are trading. Up and down accelerations parameters maybe different.
- The indicator is usually shown as a series of dots above or below the price bars. The dots are the stop levels. You should be short when the stops are above the bars and long when the stops are below the bars. When a stop is hit then trade in opposite direction.
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( Lowbar < 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 );
}
}
}
}
}
}