OPEN-SOURCE SCRIPT

Mean Shift Pivot Clustering

Core Concepts

According to Jeff Greenblatt in his book "Breakthrough Strategies for Predicting Any Market", Fibonacci and Lucas sequences are observed repeated in the bar counts from local pivot highs/lows. They occur from high to high, low to high, high to low, or low to high. Essentially, this phenomenon is observed repeatedly from any pivot points on any time frame. Greenblatt combines this observation with Elliott Waves to predict the price and time reversals. However, I am no Elliottician so it was not easy for me to use this in a practical manner. I decided to only use the bar count projections and ignore the price. I projected a subset of Fibonacci and Lucas sequences along with the Fibonacci ratios from each pivot point. As expected, a projection from each pivot point resulted in a large set of plotted data and looks like a huge gong show of lines. Surprisingly, I did notice clusters and have observed those clusters to be fairly accurate.

  • Fibonacci Sequence: 1, 2, 3, 5, 8, 13, 21, 34...
  • Lucas Sequence: 2, 1, 3, 4, 7, 11, 18, 29, 47...
  • Fibonacci Ratios (converted to whole numbers): 23, 38, 50, 61, 78, 127, 161...


สแนปชอต

Light Bulb Moment

My eyes may suck at grouping the lines together but what about clustering algorithms? I chose to use a gimped version of Mean Shift because it doesn't require me to know in advance how many lines to expect like K-Means. Mean shift is computationally expensive and with Pinescript's 500ms timeout, I had to make due without the KDE. In other words, I skipped the weighting part but I may try to incorporate it in the future. The code is from Harrison Kinsley. He's a fantastic teacher!

Usage

  • Search Radius: how far apart should the bars be before they are excluded from the cluster? Try to stick with a figure between 1-5. Too large a figure will give meaningless results.
  • Pivot Offset: looks left and right X number of bars for a pivot. Same setting as the default TradingView pivot high/low script.
  • Show Lines Back: show historical predicted lines. (These can change)
  • Use this script in conjunction with Fibonacci price retracement/extension levels and/or other support/resistance levels. If it's no where near a support/resistance and there's a projected time pivot coming up, it's probably a fake out.


Notes

  • Re-painting is intended. When a new pivot is found, it will project out the Fib/Lucas sequences so the algorithm will run again with additional information.
  • The script is for informational and educational purposes only.
  • Do not use this indicator by itself to trade!
CyclesfibforecastinglucasmachinelearningmeanreversionpivotPivot points and levelsprojectionTIME

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?


และใน:

คำจำกัดสิทธิ์ความรับผิดชอบ