Parabolic SAR |
Top Previous Next |
sar( start, increment, max [, source | sym() | inv()] [, barIndex] )
Parabolic SAR is a display of "Stop and Reverse" points for a particular market. When the market touches or crosses a point, this indicates you should reverse your position. If you are long, for example, go short. If you are short, go long. The Parabolic SAR assumes that you are always in the market.
Parameters
To Create a Series
var myStudy1 = null; var bInit = false;
function main() { var myVar;
if ( bInit == false ) {
myStudy1 = sar( 0.02, 0.02, 0.2 );
bInit = true;
}
//retrieve the current value myVar = myStudy1.getValue(0);
return( myVar ); }
To Retrieve a Single Value
function main() {
... ... myVar = sar( 0.02, 0.02, 0.2 );
//do something with the value in myVar
}
Calling Examples
//create a study that uses IBM as the symbol along with whatever bar //interval you are using in the chart where the script is loaded myStudy = sar( 0.02, 0.02, 0.2, sym( "IBM") );
//create a study that uses the 15-min bar interval, regardless of the bar //interval of the chart in which the script is loaded myStudy = sar( 0.02, 0.02, 0.2, inv(15) );
//create a study that uses the Daily bar interval, regardless of the bar //interval of the chart in which the script is loaded myStudy = sar( 0.02, 0.02, 0.2, inv("D") );
//create a study that will be based on MSFT 30-min bars, regardless of //the symbol/bar interval of the chart in which the script is loaded myStudy = sar( 0.02, 0.02, 0.2, sym( "MSFT,30" ) );
//create a study that will be based on the high. myStudy = sar( 0.02, 0.02, 0.2, high() );
//create a study that will be based on the close, using 15-min bars, regardless of //the bar interval of the chart in which the script is loaded myStudy = sar( 0.02, 0.02, 0.2, close( inv(15) ) );
|