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の精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。