Take the square root of the selected value (lowest and or highest point).
Add (for up or subtract for down) 0.25 for every 45 degrees of rotation to the desired calculation.
Square this. Round to two decimal places.
For example: $65,000 will be scaled down to 650 for Gann calculations, and then the outputs will be rescaled (multiplied by 100 in this instance) before being drawn on the chart.
- Take the logarithm of the highest price visible on the chart. Divide this by the logarithm of 10 and subtract 3, stopping at 0. This gives the scaling magnitude.
magnitude = math.max(0, math.ceil(math.log(high_vis) / math.log(10)) - 3)- Divide the highest (or lowest) visible price on the chart by 10 raised to magnitude (10^magnitude).
high_vis / math.pow(10, magnitude)
low_vis / math.pow(10, magnitude)- Perform regular Gann calculations with these as the high and low inputs (see indicator description above for details).
- Scale up the Gann calculation outputs by multiplying by10^magnitude and draw to chart.
gann * math.pow(10, magnitude)
在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。