TradingView
dime
2 Th04 2017 16:42

Bars Since VIX Median 

VOLATILITY S&P 500TVC

Mô tả

BARS SINCE VIX17 Median by dime (v1.0 release) 04/02/2017
(Inspired by "Bars Since the last RSI Extreme" from DRodriguezFX)

This indicator is useful in tracking how many daily bars since the VIX was last at a historically 'normal' range.

Currently the VIX has been in a period of low volatility for a period of 98 daily bars since the VIX was last at the 17 historical median.

Bình luận
hanahmet
hi.
After selling, he will buy when it rises by %BUY from the last bar to the instant value.
After buying, it will sell when it drops by %SALES from the most recently bought bar to the instant value.

it will sell when it goes down 3% after the last buy trade (from the lowest bar), and buy when it goes up 2% after the last sell trade (from the highest bar).
I don't want to go back 7 bars. Using the "barsince" command, I want to go to the most recently traded bar.

study("My_Proje", shorttitle="AHAP", overlay=false)
length=input(7)
get_buy=input(3)
get_sell=input(3)
highest_peak=highest(length)
bottom_hole=lowest(length)
buy=close>bottom_hole+(bottom_hole/100*get_buy)?1:0
sell=close<highest_peak-(highest_peak/100*get_sell)?1:0
plot(buy,color=green)
plot(sell, color=red)

I tried to do it, it didn't work. Because I need to add barssince command. This command always gave an error. I would be glad if you help.

Thanks in advance. . .
Thêm nữa