casey_bowman

Lucid SAR

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 https://www.tradingview.com/script/KU6P5...

Sawcruhteez from Lucid Investment Strategies wrote the following description of the 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 trade has been initiated."

"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
trade was initiated."

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
made (if short).

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.
从常用的脚本中删除 添加到常用的脚本
Thanks bro , great job 🧿
回复
Awesome, could you add alerts to this?
回复
Hi,
Please set this up so there is an up color and a down color ex. green for up and red for down but leave it customizable I like cyan and magenta personnally

Great script
回复
casey_bowman greenticks
@greenticks, That's a great idea. Thank you! Also there are people who are color blind. I am a bit so myself, which is why green and red don't always work for me for up and down candles. You see I use blue and red in the chart above. After my vacation, I plan to add this feature, along perhaps with the expected stop for the next candle, which I've used privately so far. First in line is your suggestion.
回复
Yesterday I felt honored to see @ToneVays add the Lucid SAR indicator to his chart during his show "Trading Bitcoin", after having learned so much from him

https://www.youtube.com/watch?v=3aboI4O5A88
回复
Thank you!!
回复
For those following bitcoin, the weekly SAR for BTC/USD on Bitstamp has reversed trend this morning
回复
Great Work - Thank you for clarifying this crucial difference and sharing it - Much Appreciated
回复
@SWT, You're welcome
+1 回复
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 网站规则 版主 网站 & 经纪商解决方案 插件 图表解决方案 寻求帮助 功能请求 博客 & 新闻 常见问题 维基百科 Twitter
概述 个人资料设置 账号和账单 寻求帮助 已发表观点 粉丝 正在关注 私人消息 聊天 退出