Baseline Summation [racer8]

747 lượt xem
Baseline Summation is a trend indicator that takes the summation of the true ranges above the current close and subtracts that from the summation of the true ranges below the current close over 30 periods back. The result is then smoothed out with a smoothing parameter and plotted. Green means buy, red means sell. Enjoy :)
Phát hành các Ghi chú: Added feature that colors price bars according to indicator.
Phát hành các Ghi chú: ...
Baseline Summation has now been simplified from 123 lines to 29 lines of code.
And finally, the Baseline Summation parameter is no longer fixed at 35 period lookback...it can be changed to whatever the user prefers.
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích

Bình luận

Hi racer8, you could simplify your code using for loops

Baseline() =>
_first = close - low
_second = close - high
_third = 0.

for i = 1 to 35
_first := _first + (high <= close ? tr : 0)
_second := _second + (low >= close ? -tr : 0)
_third := _third + (high > close ? (low < close ? (close - low) + (close - high) : 0 ) : 0)
summation = _first + _second + _third

BaselineSummation = Baseline()
BaselineColor = BaselineSummation > 0 ? color.green : color.red
plot(BaselineSummation, "BaselineSummation", BaselineColor)
bgcolor(BaselineColor, transp=80)
+2 Phản hồi
racer8 Mango2Juice
@Mango2Juice, Thank you very much. I actually contacted LucF regarding this issue, and he's provided a solution as well. But I will definitely consider implementing your solution.
Phản hồi
This is great, thanks for sharing.
Although I have a question, would not be better to declare high, low, close just once? like CLOSE = close, HIGH = high and LOW = low? Wouldn`t this make script faster? Asking this because I want to combine this code with what I have and already having dozens and looking to improve the loading speed. Thanks in advance
+1 Phản hồi
racer8 CUBYC
@CUBYC, yea, everyone is noticing how redundant the amount of lines of code I have in this script, and they are right. It will be fixed...coders like Mango2Juice & LucF have already provided solutions to this, and I will pick the best one to replace the current code I have for Baseline Summation. Stay tuned.
+1 Phản hồi
CUBYC racer8
@racer8, Great news, can`t wait and would be really helpful. Thanks again mate
Phản hồi
racer8 CUBYC
@CUBYC, Done, your wish has been granted.
+1 Phản hồi
CUBYC racer8
@racer8, BRILIANT!!
+1 Phản hồi
great work, thanks for sharing!
+1 Phản hồi
racer8 blackcat1402
@blackcat1402, maybe this will inspire you to create something ;)
+1 Phản hồi
@racer8, indeed, it give me some hints in mind :D
Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Cách thức hoạt động Tính năng Biểu đồ Trả phí Giới thiệu bạn Quy tắc Áp dụng Trung tâm Trợ giúp Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Blog & Tin tức Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Xu Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất