0
$\begingroup$

So I am attempting to calculate the Parabolic SAR over FX market data. I understand that the SAR equation is:

SARt = SARt-1 + * [EPt-1 - SARt-1]

with EPt-1 changing depending on if it is a rising or falling SAR but my question is how is the initial/prior SAR (SARt-1) calculated at first with new data or at a transition point (changing from a rising to failing SAR).

Any advice or books with the full mathematical definition would be much appreciated. Many thanks.

$\endgroup$

1 Answer 1

1
$\begingroup$

So after looking through and doing some reverse engineering of some implementations I think I have found the answer.

public static ParabolicSAR GenerateFirstSAR (ParabolicSAR sar,double[] high, double[] low) {
    if (high[0] < high[1]) {
        ...
        sar.sars.add(Math.min(low[0], low[1]));
        ...
    } else {
        ...
        sar.sars.add(Math.max(high[0], high[1]));
        ...
    }
    return sar;
}

In this high is an array of all the high points but you really only need 2 and then low is the low points. Same rule applies.

So this broken down means that for a rising condition the primary SAR is the minium value from the first 2 low points.

Math.min(low[0], low[1])

And visa versa for a failing condition.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.