OPEN-SOURCE SCRIPT

[RedK] Stepped Moving Average Channel (SMAC)

Cập nhật
The Stepping Moving Average Channel (SMAC) is not an indicator - It is more of a trading tool that was put together to enable a trader to take advantage of relatively fast price moves with quick incremental gain - maybe by exploiting opportunities to trade basic options (Calls, Puts) or to help with in/out-type swing trades. This is more a price-level visualization tool so please use it with this in mind, and not as a trading tool by itself.

While it looks very similar to a Donchian channel, SMAC plots a stepping channel of the moving average of the high & low prices (channel borders) - with an envelope that is at a user-specified % distance from the channel borders.

This setup, when combined with other Moving Averages and lower indicators, may make it easier for a trader to prepare for a trade with clear entry and exit price levels being planned upfront.

For example, a trader wants to capture 2% of the next move, will set the envelope to 2% and have clearer view of entry/exit price levels for such a scenario. once the trader receives confirmation (from other indicators or charts) that the price is heading in the way expected, the SMAC may make it simpler and quicker to estimate (and visualize) the entry/exit price levels and track the movement.

* The stepping feature helps remove price noise and the auto-stepping feature is designed to "snap to" those mental price levels that trader gravitate towards.
* The moving average type I used here is the Compound Ratio MA (CoRA_Wave).
* This MA type was selected because it has a very high responsiveness and good smoothness, and tracks the price values very closely.
* The MA type can be replaced within the code with any other MA as preferred.

The auto-stepping feature:
----------------------------------
  • User can override the auto-stepping by entering a manual step value
  • when the auto-stepping is active, it will attempt to pick the best step size based on the underlying price range and the timeframe selected.
  • The step selection may not be ideal in some combination of value / TF - i will continue to improve these combinations

  • Stepping can also be completely disabled - this bring SMAC back to a regular (though highly responsive) Hi/Lo MA channel with envelope
  • The Excel table snippet in the chart above shows the various step value / TF combinations.
  • Also the stepping values can be further customized by changing the appropriate part in the script.



Other features:
--------------------

* Rounding Options: The stepping calculations uses one of 2 selectable methods:
1 -- regular rounding (uses the round() function): which rounds the price up & down depending on where it is compared to the half-step value
example: a value of 17 with a step of 10 will be rounded to 20. a value of 13 in that case will be rounded to 10

2 -- Whole Step (uses the int() function): this will only consider whole/fully completed steps - if the average (hi or low) does not explicitly exceed the next step level, we will not get that next value.
example: both values of 17 and 13 with a step of 10 will be rounded to 10.

* The "Quick Table":
The Quick Table shows on the top-left - and can be disabled in the script settings - It shows the currently selected stepping mode and value - since the auto-step changes dynamically with the selected chart timeframe, this makes it easier for the trader to view the active "configuration"

overall, i hope some traders find this quick utility useful - if not to use, maybe to inspire other ideas
- please feel free to use or customize in any way you need. Feel free to share feedback and observations.
Phát hành các Ghi chú
SMAC v2 adds new features and updates:
- Added an ATR Channel Envelope:
While the Percent Envelope will be static across timeframe changes, the ATR envelope value will change with TF, and is used by many traders to set entry/exit targets or for trailing stops. Thanks for the feedback on this :)

- Cleaned up code and added explaining commentary for various elements

- Quick table now includes more stat info about the various variables

Here's a snapshot of how SMAC v2 looks like
ảnh chụp nhanh

Phát hành các Ghi chú
- Fixed a table label typo
corawaveEnvelope (ENV)Moving AveragesredkSMACTrend Analysis

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm