Parabolic SAR (PSAR)

Overview

Parabolic SAR (SAR - stop and reverse) is a method devised by J. Welles Wilder, Jr, to find trends in market prices or securities. It may be used as a trailing stop loss based on prices tending to stay within a parabolic curve during a strong trend.

AnyChart Stock allows you to add PSAR indicator with desired step periods to any of your charts.

Mathematical description of the indicator please see at: Mathematical Description of Technical Indicators

to top

Adding indicator

To add any indicator to the chart, you need to use Data Provider with the fields required by the indicator. When such Data Provider is ready - you can add indicator to the chart.

Preparing Data Provider

PSAR indicator needs Data Provider with high and low fields.

Sample XML of Data Provider, which can be used to create PSAR indicator:

XML/JSON Syntax
Plain code
03     <data_provider data_set="dataSet1" id="dp1">
04       <fields>
05         <field type="High" column="2" approximation_type="High" />
06         <field type="Low" column="3" approximation_type="Low" />
07         <field type="Close" column="4" approximation_type="Close" />
08       </fields>
09     </data_provider>
01{
03    {
04      dataSet: "dataSet1",
05      id: "dp1",
06      fields: [
07        {
08          type: "High",
09          column: 2,
10          approximationType: "High"
11        },
12        {
13          type: "Low",
14          column: 3,
15          approximationType: "Low"
16        },
17        {
18          type: "Close",
19          column: 4,
20          approximationType: "Close"
21        }
22      ]
23    }
24  ]
25}

to top

Indicator Declaration

As soon as Data Provider is ready you can add an indicator to a chart.

PSAR indicator is usually used as an Overlay indicator and displayed on the same chart with data series (stock data). So we should declare it in the chart where series is displayed.

XML for PSAR declaration:

XML/JSON Syntax
Plain code
01 <chart>
03     <technical_indicator type="PSAR" data_provider="dpMsft" />
05 </chart>
01{
03    {
04      type: "PSAR",
05      dataProvider: "dpMsft"
06    }
07  ]
08}

Live sample of the chart with PSAR indicator:

Live Sample:  Technical Indicators - Adding PSAR Indicator

to top

Indicator parameters

Parabolic SAR Indicator has two specific parameters. They are set in <psar_indicator> node, where all settings for PSAR indicator are set.

XML for setting PSAR periods:

XML/JSON Syntax
Plain code
01{
02  type: "PSAR",
03  dataProvider: "dpMsft",
04  psarIndicator: {
05    stepPeriod: 0.08,
06    maxStepPeriod: 0.60
07  }
08}

Live sample below shows Parabolic SAR(0.08,0.6):

Live Sample:  Technical Indicators - PSAR Parameters

to top

Visualization

To visualize and tune visualization of technical indicators AnyChart Stock Component uses the same methods as for the data series.

By default PSAR is shown as series of square markers, but you can use almost any of available series types to show it on the chart .

PSAR indicator settings are contained in <psar_indicator> node, also in this node you can put <series> subnode - this node defines how exactly indicator is displayed on the chart. This node is identical to <series> node used to describe data series, so you can do with indicator anything you can do with series.

Sample XML for changing indicator visualization:

XML/JSON Syntax
Plain code
01 <technical_indicator type="PSAR" data_provider="dpMsft">
02   <psar_indicator step_period="0.02" max_step_period="0.20">
03     <series type="Marker" color="#A6511E">
04       <marker type="Circle">
05         <states>
06           <normal size="3" />
07           <hover size="8" />
08         </states>
09       </marker>
10       <name><![CDATA[Parabolic SAR(0.02,0.20)]]></name>
11     </series>
12   </psar_indicator>
01{
02  type: "PSAR",
03  dataProvider: "dpMsft",
04  psarIndicator: {
05    stepPeriod: 0.02,
06    maxStepPeriod: 0.20,
07    series: {
08      type: "Marker",
09      color: "#A6511E",
10      marker: {
11        type: "Circle",
12        states: {
13          normal: {
14            size: 3
15          },
16          hover: {
17            size: 8
18          }
19        }
20      },
21      name: "Parabolic SAR(0.02,0.20)"
22    }
23  }
24}

As you can see we set periods and change marker type.

Live sample below shows settings described above:

Live Sample:  Technical Indicators - PSAR Visualization Settings

to top