TradingView
SNOW_CITY
13 Th07 2018 20:53

Heffae Resolution Commander (RAW) 

Bitcoin / DollarBitfinex

Mô tả

This is a script to call resolutions with some math on top of your base resolution.

Using the modulo operator to quantize integer values, it works by converting the modified resolution integer to a 4 digit string value.

Use the function within your own scripts to call funny resolutions otherwise difficult to calculate.

You cannot add series expressions to the resolution value since pine does not allow "series" as a resolution for a security call
  • However, you could easily stack a crapload of these together and use an expression to switch the referenced security function for your purposes.


This is the raw timeframe output as integer, not string.
To go back to string outputs (for use in security calls etc) unslash line 52 //resvalue


For those interested in the verbose version of the timeframe mod function, showing all the steps, here is a pastebin:
pastebin.com/hR6hFnUZ

Cheers! Drop a line / comment if you enjoy or have any questions on how to integrate this into your script@!
The Modulo operator is so much fun!

tradingview.com/script/GImaEtcE-Heffae-Resolution-Commander/
Bình luận
dpanday
Will using this code and therefor make use of higher timeframes repaint?
SNOW_CITY
@dpanday, this does not influence repainting behaviour. You need to take the same measures to prevent repainting just like any other script.
dpanday
@SNOW_CITY, Can this be used to use higher timeframes and replace the security function?
SNOW_CITY
@dpanday,

Per the description:
This is the raw timeframe output as integer, not string.
To go back to string outputs (for use in security calls etc) unslash line 52 //resvalue

For higher timeframes, you will need to divide the "tmult" by 1440 and add "D" to the string, like this:

resolution = dailyres ? tostring(base_res/1440) + "D" : tostring(base_res)
SNOW_CITY
@dpanday, Look at the syntax of the function in this script:
tradingview.com/script/GImaEtcE-Heffae-Resolution-Commander/
SNOW_CITY
Another example of it being used in a script.

pastebin.com/uhGgMjgH

Modulo makes sure any remainder is truncated, you can also set the "step" function so, for example, 70 mins base * 0.5 at step 10, would be 40 instead of 35.

Especially useful for calling resolutions with fib relationships or exponential relationships
Thêm nữa