Skip to main content
BTC / USDT——ETH / USDT——SOL / USDT——BNB / USDT——XRP / USDT——DOGE / USDT——TON / USDT——AVAX / USDT——LINK / USDT——ADA / USDT——TRX / USDT——DOT / USDT——BTC / USDT——ETH / USDT——SOL / USDT——BNB / USDT——XRP / USDT——DOGE / USDT——TON / USDT——AVAX / USDT——LINK / USDT——ADA / USDT——TRX / USDT——DOT / USDT——
料金プラン

Parabolic SAR

Trailing stop-and-reverse trend dots — MT4, MT5, TradingView, TradeStation and MetaStock code.

Parabolic SAR is a trailing stop-and-reverse dot that accelerates toward price over time; dots below price mark an uptrend, dots above mark a downtrend. It works both as a trend filter and a dynamic trailing stop, flipping sides when price crosses it. Copy the version for your platform.

Pine Script
//@version=5
indicator("Parabolic SAR", overlay=true)
psar = ta.sar(0.02, 0.02, 0.2)
plot(psar, title="SAR", style=plot.style_cross, color=color.orange)
MQL4 · ParabolicSAR.mq4
#property indicator_chart_window
#property indicator_buffers 1

extern double SAR_Step = 0.02;
extern double SAR_Max = 0.2;
double SarBuffer[];

int OnInit() {
  SetIndexBuffer(0, SarBuffer);
  return 0;
}

int OnCalculate(const int rates_total, const int prev_calculated, const double &close[]) {
  for (int i = prev_calculated; i < rates_total; i++)
    SarBuffer[i] = iSAR(NULL, 0, SAR_Step, SAR_Max, i);
  return rates_total;
}
MQL5 · ParabolicSAR.mq5
#property indicator_chart_window
#property indicator_buffers 1

input double SAR_Step = 0.02;
input double SAR_Max = 0.2;
double SarBuffer[];

int OnInit() {
  SetIndexBuffer(0, SarBuffer);
  return INIT_SUCCEEDED;
}

int OnCalculate(const int rates_total, const int prev_calculated,
  const datetime &time[], const double &open[], const double &high[],
  const double &low[], const double &close[], const long &tick_volume[],
  const long &volume[], const int &spread[]) {
  for (int i = prev_calculated; i < rates_total; i++)
    SarBuffer[i] = iSAR(NULL, 0, SAR_Step, SAR_Max, i);
  return rates_total;
}
EasyLanguage
inputs: AfStep(0.02), AfMax(0.2);
variables: MySAR(0);
MySAR = ParabolicSAR(AfStep, AfMax);
Plot1(MySAR, "Parabolic SAR");
MetaStock
{Parabolic SAR}
psar := SAR(0.02, 0.2);
psar

To use it inside dtcharts, paste any version into the Script Converter and it becomes a native indicator on your chart.

役に立ちましたか?