Tradespot

ADW - Colour Trend

Tradespot ที่อัปเดต:   
Colour Trend is an indicator that will give you a visual representation of the trend in a selected market, and alert you when the trend changes. The green colour represents a bullish trend (prices are going up), the red colour represents a bearish trend (prices are going down), and silver represents a neutral trend (prices are relatively stable). The script calculates these trends based on the relative price levels and their moving averages.

Below is a breakdown of the script so you can better understand how these trends are defined.

  • Function f_p(_length, price): This function calculates the price relative to its highest and lowest point over the given `_length` of time. This calculation is normalized by multiplying it by 100, giving us a percentage-like measure.
  • User Inputs: The length of the period (default 12), you can choose to show or hide bar colours (default is true).
  • Variables cycle_avg, cycle_counter, cycle_count, cycle_trend, cycle_col: These variables are used to calculate the trend cycles. The `cycle_avg` is the average trend cycle, `cycle_counter` keeps track of the current trend cycle, `cycle_count` counts the total number of cycles, `cycle_trend` keeps track of the direction of the cycle (1 for up, -1 for down), and `cycle_col` defines the colour of the current cycle.
  • Variables ph, pl, avg, mean: These variables calculate the price level relative to the highest and lowest prices (`ph` and `pl`), the average of these two levels (`avg`), and the cumulative average of the price level (`mean`).
  • Conditionals for cycle trend: The if-statements are checking whether the price level has reached a trend extreme and then updating the trend cycle, colour, count, and average accordingly.
  • Variable col and bar color: The variable `col` is used to define the colour of the bars based on the average price level. If the `show_barcolor` is true, the colour is determined based on the `avg` value.
  • Alert Conditions: These are conditions that will send alerts to the user when the trend changes. Specifically, the alerts occur when the colour changes from non-green to green (bull trend), from non-red to red (bear trend), or from non-silver to silver (no trend).
เอกสารเผยแพร่:
  • Initialised variables to 'na' for consistency
  • Simplified alert conditions for readability
เอกสารเผยแพร่:
Updated license

Wizard money evangelist 🪄✨
สคริปต์โอเพนซอร์ซ

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

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

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

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