Peterbolic SAR

The Peterbolic SAR indicator is based on Peter Brandt's 3 Day Trailing Stop Rule. The yellow triangles indicate setup candles, and the green and red triangles represent trigger candles to buy and sell, respectively.

Sawcruhteez asked me to create the code for this SAR . Gabriel Harber came up with the name for the SAR . Peter Brandt gave his permission to use his name.

For more information, see Sawcruhteez Streamz: Live Coaching Sessionz with Gabriel Harber - Trading Peterbolic SAR

and Peter Brandt's original description of the 3DTSR
Oct 02
Release Notes: Overview

The Peterbolic SAR was developed using the 3 Day Rule that Peter Brandt outlined on page 50 of Diary of a Commodity Trader.

Below is the exact quote from the book:

“The first step to the exit strategy is to identify the highest day of the move (bull trend). Of course, it will change as new highs are made. The high day in the Dow was August 28 (2009). The setup day occurs on any day a market closes below the low of the high day. This occurred on August 31. The trigger and exit then takes place when the low of the setup day is penetrated. This occurred on September 1.”

If it is a bear trend then the setup occurs any day a market closes above the high of the low day. The trigger then takes place when the high of the setup day is penetrated. Note that Peter uses this on the daily chart but we have found it to be very useful on all time frames.

It was designed as a trailing stop loss system, but I believe it can be used as a SAR (Stop And Reversal). Instead of simply exiting a position this can be used to signal a full reversal (cover long & immediately go short or cover short and immediately go long). As a result it has been named the Peterbolic SAR instead of the 3 Day Rule.

As a result if trading this system one would expect to always be either long or short. Nevertheless that isn’t how it has to be traded. It would certainly be feasible to only take long signals when the trend is bullish and vice versa. It can also be used exclusively as a stop loss, as Peter intended.

In the past Sawcruhteez has relied on Welles Wilder’s Parabolic SAR to trail stop losses but has never been able to use that as a full Stop and Reversal system, as Welles intended. After preliminary backtesting Sawcruhteez is inclined to believe that the Peterbolic SAR will be a better way to trail stops as well as being a profitable to signal entries in the opposite direction.


Yellow triangle is the setup. If it is below the candle it is a buy setup. If it is above the candle it is a sell setup.

Red triangle is the sell trigger. Green triangle is the buy trigger.

If a setup is not followed by a trigger then there is no exit or entry signaled. Signals only occur on the trigger. Note that the trigger does not require a close above or below the setup, those levels only need to be penetrated intra candle. Therefore hard stop losses can be placed after the setup occurs.

If it is a sell setup then a stop loss for longs can be entered one tick below the low of the setup candle. If it is a buy setup then a hard stop loss for shorts can be placed one tick above the high of the setup candle.

If trading as a full Stop And Reversal then stop loss orders would be entered for 200% of the current position size. On the large majority of crypto exchanges this would close out the existing position and enter equal exposure in the other direction, otherwise known as flipping the position.
Oct 03
Release Notes: Fix - The labels for style options "Target to Sell", "Setup to Sell", "Target to Buy", and "Setup to Buy" have been corrected
Oct 10
Release Notes: Fix for a bug that Sawcruhteez found
Issue #3

Description of bug

Say there's a downtrend with a setup candle in play. If, in a candle following the setup candle, there is first a price that triggers an uptrend and then a price that is higher than the previous high for the downtrend, then this is treated as a new high for the downtrend instead of as a trigger for the change to an uptrend.

Newly implemented rule

If a trigger happens in a candle, even if there's a new extreme point, too, then the candle is a trigger candle and the trend changes

Import tool

This release also includes an import tool written in Rust that allows the PineScript functions to be maintained separately from template scripts. I run this import tool to generate the released scripts. Anywhere there's a line with an import statement in the templates, a function is plugged in from a function file
Remove from Favorite Scripts Add to Favorite Scripts


Thank you for all the hard work that went into this and for sharing it with us.
Any way to set alerts on this?
In my opinion, peterbolic sar does not work properly - when you look at candles no matter what the period (1 hour or 1 day), you almost always buy at a green triangle at a high price and at a red triangle you sell at a lower price. You make a loss accordingly. Then you lose again because the green triangle lights up buying and buying at a higher price than you sold last time. Not to mention that with every sale there are some dangers! Do you really think this pererpolic sar is effective? thanks
has anyone backtested this yet?
I am the Author of the LBLS (LongBuyLongSellIndicator) indicator which is one of the notable indicator in tradingview for auto trading ,noticed this indicator by chance.
i like your V4 coding skills ,the indicator is good looking .I am checking your pine code what exactly it is and how best it can turn the trade to be very profitable.

Thanks for sharing the code as well here .Keep up the good work.

Shouldn't the last but one candle be a set-up candle to the upside?
casey_bowman CoenKuijpers
@CoenKuijpers, Please look at this image. The second to last candle (on the right) has a new low. During a downtrend, the setup, if it happens, happens at the close of a candle following this new low. Each new low during this trend cannot be a setup candle. The last candle does become a setup in fact at the close of the day. One must wait until the close of the candle.
CoenKuijpers casey_bowman
@casey_bowman, I understand that. But said candle (second to last) also made a new high and even closed above the third to last candle, which would make it a set up candle. Or are you saying that if the candle also has a low below its forelast candle it will invalidate the set up?
How can I see a chart with 4 hour candles? thanks
Home Stock Screener Forex Screener Crypto Screener Economic Calendar Shows How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Help Center Refer a friend Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Refer a friend My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out