Amphibiantrading

Speedometer Revisited

Speedometer Revisitedis a new way to draw custom metric speedometers and is intended to be a utility for other coders to use.

@rumpypumpydumpy originally introduced the Speedometer Toolkit in version 4 of Pine Script. Since then, Pine Script has been updated to version 5, introducing some amazing new features such as polylines and chart.points. This indicator is an example of what can be done with these newer features.

The indicator starts off with a handful of functions that will be used to create the drawings. Notes are left throughout the code explaining what each line of the functions does. My goal was to make these functions user-friendly and somewhat easy to understand. I then demonstrate two examples: one speedometer with five segments and another with three.

The first example demonstrates how to visually represent the analysts' ratings for a stock using the built-in syminfo.recommendations. The speedometer is divided into five segments, each representing a different level of analyst recommendation: strong sell, sell, hold, buy, and strong buy.

Each segment is drawn using a polyline from the createSeg function, with colors assigned as follows:
  • Red for 'Strong Sell'
  • Maroon for 'Sell'
  • Yellow for 'Hold'
  • Green for 'Buy'
  • Lime for 'Strong Buy'

The script identifies the maximum value among the analyst ratings, calculates the midpoint of the corresponding segment, and draws a needle pointing to this midpoint.

The second example employs the speedometer design to display market sentiment through the put-call ratio. The put-call ratio is a gauge of investor sentiment, where values above 1 indicate a bearish sentiment (more puts being bought relative to calls), and values below 1 suggest a bullish outlook (more calls being bought relative to puts).

The speedometer is divided into three segments, reflecting different ranges of the put-call ratio:
  • Red for a ratio greater than 1 (bearish sentiment)
  • Yellow for a ratio between 0.8 and 1 (neutral to bearish sentiment)
  • Lime for a ratio less than 0.8 (bullish sentiment)

Depending on the value of the put-call ratio, the script calculates which segment the current value falls into and determines the appropriate segment number. The script calculates the midpoint of the selected segment and draws a needle pointing to this value.

Both examples show how the speedometer can be used as a visual indicator of certain market conditions, helping traders quickly recognize trends and adjust their strategies accordingly.

A big thanks to @rumpypumpydumpy for his original Speedometer Toolbox. I hope this take on it can be useful for other coders.

Trusted Pine programmer. Send me a message for script development.
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?