OPEN-SOURCE SCRIPT
ที่อัปเดต:

Trendicator

This is a very simple crossover script that looks at a exponential moving average with a standard length set at 20, which may be redefined by the user. A (Uptrend) buy signal is given once a candle closes above the moving average, coloring the exponential average green, and a sell signal is given once a candle closes below the moving average, coloring the exponential average red.

The goal of this indicator is to provide the user with a rather robust idea of whether the market is trending upwards or downwards, more so than providing definitive buy or sell signals. It works with symbols that do not change drastically in shorter time periods (I only trade XAU/USD).XAUUSD
เอกสารเผยแพร่
A name change was done, to give an indication as to what is expected from the indicator: Trends!

The EMA source can now be selected, with the uptrend signal now only being triggered once the entire candle closes above the selected EMA, and similarly for downtrends - Only triggered when the entire candle closes below the EMA.

Finally, the fill colors have been corrected such as not to overlap.
เอกสารเผยแพร่
Description of Changes:

  • Improved the buy and sell signal logic to ensure only one alert and label per crossover event.
  • Added flags to track buy and sell crossovers, preventing repeated signals on consecutive bars.
  • Refined the conditions to ensure that buy signals trigger only when both buy conditions are met and similarly for sell signals.
  • The script now correctly displays buy and sell labels on the chart and sends notifications only once per respective crossover, enhancing the accuracy and usability of the indicator.
เอกสารเผยแพร่
This revision builds upon the original indicator by adding several customization and flexibility features:

Multi-Timeframe Support

What It Does:
The code now allows you to specify different timeframes for your chart data and for the moving average calculations.
How It Works:
Two inputs let you choose the chart timeframe and the timeframe for the moving averages separately. The request.security function is then used to retrieve price data (using both close and open for the slow averages, and a user-defined source for the quick average) from the specified timeframes.
Benefit:
This provides broader context and more flexible trend analysis, as you can observe how signals behave across different temporal resolutions.


Toggleable Labels (Tickbox for Labels)

What It Does:
A new tickbox input lets you enable or disable the display of buy/sell labels directly on the chart.
How It Works:
When turned on, the script plots labels (with “Buy” or “Sell” text) at the appropriate crossover events. This helps you quickly identify key signal points.
Benefit:
Users who prefer a cleaner chart can disable the labels, while those who like visual markers for crossovers can enable them.


Fixed Color vs. Trend-Based Colors (Tickbox for Colors)

What It Does:
Another tickbox allows you to choose whether the moving averages should use a fixed color scheme or change dynamically based on the trend (crossover conditions).
How It Works:
With the tickbox enabled, the moving averages change color to reflect the trend—green (or lime) for an uptrend (buy signal) and red for a downtrend (sell signal).
When disabled, the moving averages maintain a fixed color regardless of crossovers.
Benefit:
This offers an easy visual cue for market direction while also providing the option to stick with a consistent, fixed color scheme if you prefer.

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