Need help to create a parabolic SAR strategy

Questions about MultiCharts and user contributed studies.
fernando43611
Posts: 33
Joined: 12 Mar 2015
Has thanked: 4 times

Need help to create a parabolic SAR strategy

Postby fernando43611 » 07 Mar 2016

The strategy is pretty simple:

1. buy when we get 2 new consecutive parabolic SAR dots below price.
2. sell short when we get 2 consecutive parabolic SAR dots above price.

The idea of buying/selling short is to use the second consecutive dot as a confirmation of trend change.

If anybody can help me, I will really appreciate it. Thanks for your time!!

beejaysea
Posts: 18
Joined: 16 Nov 2014
Been thanked: 1 time

Re: Need help to create a parabolic SAR strategy

Postby beejaysea » 12 Mar 2016

Here's a basic version of what you described.

If two consecutive bars closes are ABOVE the parabolic SAR on those bars, AND the bar previous to the to has a close BELOW it's parabolic SAR, then we buy at market on the next bar.
Opposite for short.

I added the test for the 3rd bar to ensure that this doesn't take a signal in the middle of a sequence of closes > SAR or vice-vers.

Hope this helps.

Code: Select all

inputs:
AfStep( 0.02 ), AfLimit( 0.2 ) ;

variables:
parsar(0), var0( 0 ), var1( 0 ), var2( 0 ), var3( 0 ) ;

parsar = ParabolicSAR( AfStep, AfLimit, var0, var1, var2, var3 ) ;

if BarNumber > 2 then begin
if close > var0 and close[1] > var0[1] and close[2] < var0[2] then
buy next bar at market;

if close < var0 and close[1] < var0[1] and close[2] > var0[2] then
sellshort next bar at market;
end;


Return to “MultiCharts”