# Lucid SAR

12081 뷰
I wrote this script after having listened to Hyperwave with Sawcruhteez and Tyler Jenks of Lucid Investments Strategies LLC on July 3, 2019. They felt that the existing built-in Parabolic SAR indicator was not doing its calculations properly, and they hoped that someone might help them correct this. So I tried my hand at it, learning Pine Script as I went. I worked on it through the early morning hours and finished it by 4 am on July 4, 2019. I've added a few bits of code since, adding the rule regarding the SAR not advancing beyond the high (low) of the prior two candles during an uptrend (downtrend), but the core script is as it was.

This code is open source under the MIT license. If you have any improvements or corrections to suggest, please send me a pull request via the github repository https://github.com/casey-bowman/sar

For more details on the initial script, see   Parabolic SAR , where the quotes are from Section II of J. Welles Wilder, Jr.'s book New Concepts in Technical Trading Systems (1978)

--------------------------------------------------------------------------------------------------------------------------

Parabolic SAR

"The Parabolic Time / Price System derives its name from the fact that when charted, the
pattern formed by the stops resembles a parabola, or if you will, a French Curve. The system
allows room for the market to react for the first few days after a trade is initiated and then the
stop begins to move up more rapidly. The stop is not only a function of price but also a function
of time
.

"The stop never backs up. It moves an incremental amount each day, only in the direction which

"The stop is also a function of price because the distance the stop moves up is relative to the
favorable distance the price has moved... specifically, the most favorable price reached since the

A. The calculation for a bullish Parabolic SAR is:

Tomorrow’s SAR = Today’s SAR + AF (EP - Today’s SAR )

"Acceleration Factor ( AF ) is one of a progression of numbers beginning at 0.02 and ending at
0.20. The AF is increased by 0.02 each period that a new high is made" (if long) or new low is

EP is the "Extreme Price Point for the trade made so far. If Long, EP is the extreme high price for
the trade; if Short, EP is the extreme low price for the trade.”

Most websites will provide the above calculation for the Parabolic SAR but almost all of them
leave out this crucial detail:

B. "Never move the SAR into the previous day’s range or today’s range

"1. If Long, never move the SAR for tomorrow above the previous day’s low or
today’s low
. If the SAR is calculated to be above the previous day’s low or
today’s low, then use the lower low between today and the previous day as
the new SAR . Make the next days calculations based upon this SAR .

"2. If Short, never move the SAR for tomorrow below the previous day’s high or
today’s high
. If the SAR is calculated to be below the previous days’ high or
today’s high, then use the higher high between today and the previous day
as the new SAR . Make the next days calculations based upon this SAR ."

When a Bullish SAR is broken then it gets placed at the SIP (significant point) of the prior trend.
In otherwords it is placed above the current candle and at the price that was the SIP.

The inverse is true for the first Bullish SAR .

"This system is a true reversal system; that is, every stop point is also a reverse point." If breaking
through a bearish SAR (one above price) that simultaneously signals to close a short and go
long.
Oct 12
릴리즈 노트: Issue #4

Added ability to handle multiple reversals in the current and subsequent candles

Also used new import tool, written in Rust, to generate the script from parts

## 코멘트

Note the comments in the scripts on the new branding under the name "Lucid SAR"

The original copyright and MIT open source license remain the same (though I may transfer the copyright to my bitcoin LLC once it is formed)

This is as agreed to with Lucid Investment Strategies LLC on July 9, 2019

https://lucidinvestmentstrategies.com/
응답
casey_bowman
@casey_bowman, I am not sure what are you copyrighting here exactly. :) You did not invent a new indicator. You just did math based on someone else instructions that's freely available.
Never the less, still awesome work. Thanks
응답
alskdj
@alskdj, I think you confused „copyright“ with „patent“. You automatically have the copyright of any piece of source code you write regardless of what it does.
응답
I added "overlay" thanks to a suggestion by Nakitxu, so that the indicator appears in the main pane immediately when added
응답
It turns out that ALL of the SAR indicators EVERYWHERE which Lucid Investment Strategies has checked are not working properly (per the algorithm in Wilder's book), except for mine. Here's today's video where they discuss this. I've set the start time so you can go right to that discussion - "Hyperwave - Bitcoin is Pulling Back, Alts Are in Danger of Breaking Down" https://youtu.be/r8LiKTtIW-g?t=2922
응답
Thanks for sharing!
응답
wroclai
@wroclai, You're welcome! Hopefully by making this open source, this implementation will become most dependable
응답
Fantastic indicator and excellent work! Appreciate the time and effort you have put into this. Well done and thank you. I will definitely be using this one.
응답
SkyGolem
@SkyGolem, Thanks! :)
응답
Using the Peterbolic SAR indicator, the weekly has also triggered a reversal in trend for bitcoin on Bitstamp.
응답