OPEN-SOURCE SCRIPT

Motion Line

Cập nhật
This script plots the Motion Line, a concept explained in Glenn Neely's River Trading Technology, on the go.

Due to the limitations on Pine Script at the time of writing this script, plotting Motion Line on Violent Outside-bars does not follow the main procedure...

For example on this occasion, the snapshot below displays how exactly the Motion Line should be drawn when a Violent Outside-bar condition is met:
ảnh chụp nhanh

But this is how the script handles it:
ảnh chụp nhanh
The first connection point to the Violent Outside-bar is ignored and the line is continued from second point of connection. In such situations a different color is applied on the Motion Line.
Phát hành các Ghi chú
- Resolved inconsistencies on Violent Outside Bars.
- Added trader entries and stop losses for all types.
- Introduced experimental options!

Experimental Options:
- Modifying this section will impact the Motion Line's behavior. You are advised not to change any setting under this section if you wish to retain the original line.

- Violent and Normal OB settings allow user to specify how the direction of the bars is calculated (requires setting the ratio for range-related options)
- You can choose to invalidate the Inside Bar condition after a specific number of Inside Bars and a ratio of the bar to the previous important bar is reached. The script will then resume drawing the Motion Line from the nth Inside Bar if the ratio requirement is met.
- The Post IB setting allows to choose the previous close price for when the Inside Bar sequence is finished.
- Often the script will choose a counter-trend direction for Normal Outside Bars, if the Normal OB setting is changed, resulting in a condition where the bar crosses the turning point. This behavior qualifies the Outside Bar as Violent. Users can choose to prevent the transition from Normal OB to Violent OB or specify which of the related settings will be used if the transition takes place.
Phát hành các Ghi chú
Bug fixes and optimizations
Phát hành các Ghi chú
What's new?
- New option in Violent & Normal Outside Bar settings: Direction based on Order of Occurrence (of high and low).
This option enables the script to indicate the direction of the bars based on lower timeframe data. It is the default setting for Violent Outside Bars.

- Channeling!

Both new features utilize the new timeframe system. The user must specify the settings for Main, Lower, 1st to 3rd, Higher Timeframes, and the TF Switch Factor for the script to work properly. The Main TF is the timeframe on which the Motion Line is based. It is usually set to the chart timeframe. The 1st to 3rd TFs are the NRT timeframes.

Since channeling is based on the next higher timeframe, the Higher TF is necessary for channeling on the 3rd TF. To maintain operational consistency, the script selects timeframes based on the TF Switch Factor as follows: channeling will be based on the 1st TF if the Main TF (in seconds) is smaller than the 1st TF (in seconds) divided by the TF Switch Factor. Otherwise, the script will check if the Main TF (in seconds) is smaller than the 2nd TF (in seconds) divided by the TF Switch Factor. This process will continue up to the highest timeframe (the Higher TF). If the conditions are not met, a runtime error will occur.

Similarly, to fetch lower timeframe data for the Main TF, the script starts from the highest timeframe and checks if the Main Timeframe is greater than the timeframe multiplied by the TF Switch Factor. If this condition is met, that timeframe is used as the lower timeframe to fetch bar data. If the Main TF is smaller than the Lower TF, a runtime error will occur, as will happen when the indicator cannot fetch the desired data. In the latter, changing the Lower TF (usually to a higher timeframe) may fix the error. If this does not help, it is possible to use the same timeframe for both Lower TF and Main TF. In this case, the indicator estimates the order based on the relationship between close price and bar range on a logarithmic scale.
Phát hành các Ghi chú
Fixed the incorrect prioritizing of cotemporal entries.
Phát hành các Ghi chú
Changed the default setting for the Violent Outside Bar to "Direction based on Momentum."
Unfortunately, the error I initially thought might be rare has turned out to be quite common, especially with intraday timeframes. The Data Request Failure that many users are experiencing after the last update stems from the fact that TV allows indicators to access only a limited number of intrabars, claimed to be 100,000. However, it seems that the actual limit may be much lower, or I might be doing something wrong. Either way, I changed the default setting to help inexperienced users avoid this error. Don't forget to reapply the indicator.

For those who wish to use the "Direction based on Order of Occurrence" for either of the outside bar types, the option is still available. Currently, the only fix that maintains the functionality of the feature is to use an Initiation Time that is close enough to fall within the intrabar limits.

Clarification:
- The Main Timeframe doesn't need to be necessarily changed. The option is only provided for occasional customization.
- All timeframes, except the Main Timeframe must be in ascending order.
- TF Switch Factor must not exceed the minimum ratio between two adjacent timeframes, except the Main Timeframe.
- The Lower Timeframe is not used for channeling and will NOT take effect if none of the Outside Bar Settings are set to "Direction based on Order of Occurrence" otherwise it has to be set to a lower timeframe than the Main Timeframe AND the chart timeframe.

Feel free to DM or comment any issues.
Phát hành các Ghi chú
Fixed:
Persistent historical buffer error
Some other minor bugs

Known bugs (to be fixed):
Channel misalignment (Occasional)
Multiple channels appearing at once (Occasional)
Phát hành các Ghi chú
Fixed channel misalignment which was caused by false adressing of the turning points when the main timeframe and the channel timeframe counters didn't start on the same bar.
Phát hành các Ghi chú
Fixed the deficiency causing multiple channels to plot together
Fixed the fault that I made in the previous fix :)

Now you can use Bars Back to limit the calculations to newer bars (Thanks to lakshayvaid for the idea)
Added a center line for Time and Bias channels
multitimeframetradingTrend 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