OPEN-SOURCE SCRIPT

Channel Lookback: Average Moving Price (CLAMP)

已更新
How it works
This is a confirmation indicator based on moving averages. It compares the current price to a previous candle N periods ago, then smooths the result.
What makes this indicator novel is that it takes the smoothed curve and compares it to the previous value to see whether the slope is increasing or decreasing. Combined with a zero-cross baseline channel, we can compare the relative position of the curve, slope, or closing price to create entry signals. There are several hardcoded conditions that it checks, but this is easily changed.

Markets
The default values are best used on the SPY daily chart. With backtesting, it seemed to perform fairly well during the last year. It seems to be more accurate during choppy/bear markets, and very inaccurate during a trending market.
Eg, if you look at the period of growth that occurred during 2020, it basically said to keep shorting for months at a time. Not good. If you look at other markets (such as gold or uranium), it worked, but only if you inversed what the signal told you to do (eg going long when it says to go short). This is something you will have to test yourself, since every system and market is different. Please don't use this indicator by itself.

How to use
When combined with other indicators, this tells you whether to go long (green), go short (red), or no trade (gray). It is meant to be used as a confirmation indicator, so it will help verify other trade signals.
You can sometimes ignore the first grey circle and reuse the previous colored signal. There are a few markets (such as gold) I noticed this was helpful on; this will depend on your own trade rules and indicator system.
If you enable "simple mode" on the settings, it will draw only the final signal (long, short, no signal). I included this because it helps to reduce visual clutter.
發行說明
Updated to hopefully be easier to use / less clutter in the code. Usage is still pretty much the same: green dots are a long signal, red dots are a short signal. The color is determined simply by the color of the slope (blue/downward slope is a short signal, yellow/upward slope is a long signal).

You can make your own copy and attach additional rules in your own code, which can account for lines crossing, whether the dots are in one of the channels, etc.

As long as your baseline's signals agree with the color of the dots, it seems to be pretty reliable, but of course everyone trades a different system so please test it thoroughly.
發行說明
- Removed "simple mode" setting
- Added "draw shape" setting
- Instead of circles, output shapes are now triangles or crosses. The logic is the same as before but the trend is now more obvious. When the line is yellow it is a bullish trend; if the symbol is higher than the previous value, it will be an upward green triangle. If the symbol is lower than the previous value (moving against the trend), it will be a green X. This shows that a possible reversal in the trend may be forming.
Bands and ChannelsconfirmationMoving Averagesnnfx

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明