kurtsmock

Mod and Round To Tick Function

kurtsmock Cập nhật   
I have not found this function anywhere on Tradingview but it can be very useful in setting orders in a strategy and non-integer boundaries for certain indicator designs. Its a bit underwhelming, but in other languages you can call a mod() function and the output will be the remainder of the integer.

If you want to set an order at a specific tick value, particularly in futures, you can't set it at a specific tick when using calculated values like ATR or Standard Deviation without a function like this.

It can also be used to clean up certain band/envelope style indicators if you want to have a straight line, but don't want to simply round to an integer.

Credit for the round to tick aspect goes to the eternal fountain of resources, the Backtesting & Trading Engine script from @pinecoders

This is just another tool to throw in the box for when you might need it.
Phát hành các Ghi chú:
Update to v5... I thought I did that already... guess not. =) We got it now.
Its pretty much irrelevant now because of math.round_to_mintick() But the code still works. If you are putting it to a string you can use str.tostring(x, format.mintick) to make it so your decimal places display consistently even if they are zeros. It looks a lot better.

Mã nguồn mở

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

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

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

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