TradingView
zinovin
27. Apr. 2017 05:39

Hubba Hubba Style Signals 

British Pound/Japanese YenFXCM

Beschreibung

The indicator shows signals for "Hubba Hubba Style" strategy (binary options). It is the best to use one with "Value Chart and RSI2 with Alert" indicator. I recommend to use TF5 and expiration time till 5 min.
Also HHS_Sig can show Bollinger Bands, Resistance and support lines based on William's fractals
Kommentare
zinovin
//@version=2
//Created by Alexander Zinovin
//Used code of LazyBear's and TheMightyChicken's Value Chart
study("Hubba Hubba Style Signals", shorttitle="HHS_Sig", overlay=true)
// Inputs
length = input(5, title="HHS length")
extTop = input(8, title="HHS Extreme level top")
extBot = input(-8, title="HHS Extreme level bottom")
// Define "n" as the number of periods and keep a minimum value of 2 for error handling.
show_rs = input(true, title="Res/Sup on/off", type=bool)
//n = input(title="Res/Sup Periods", defval=2, minval=2, type=integer)
n = 2
// Source
src_r = input(title="Resistance's source", type=source, defval=high)
src_s= input(title="Support's source", type=source, defval=low)

// Resistance and Support
dnFractal = (high[n-2] < high[n]) and (high[n-1] < high[n]) and (high[n+1] < high[n]) and (high[n+2] < high[n]) ? src_r[n]: fixnan(dnFractal[1])
upFractal = (low[n-2] > low[n]) and (low[n-1] > low[n]) and (low[n+1] > low[n]) and (low[n+2] > low[n]) ? src_s[n] : fixnan(upFractal[1])

// Plot the fractals as shapes on the chart.
plot(show_rs?dnFractal:na,title= "Support level", style=circles, color=blue, linewidth=3, transp=10)
plot(show_rs?upFractal:na,title= "Resistance level", style=circles, color=red, linewidth=3, transp=10)
// plotshape(dnFractal, title= "D", style=shape.circle, location=location.absolute, color=blue, transp=10) // Down Arrow above candles
// plotshape(upFractal, title="U", style=shape.circle, location=location.absolute, color=orange, transp=10) // Up Arrow below candles

// Bollinger Bands
show_bb = input(true, title="BB on/off", type=bool)
length_bb= input(20, title="BB length", minval=1)
mult = input(2.0, title="BB StdDev", minval=0.001, maxval=50)
price=close

basis = sma(price, length_bb)
dev = mult * stdev(price, length_bb)

upper = basis + dev
lower = basis - dev

plot(show_bb?basis:na, title="BB Basis", color=blue, linewidth=2)
p1 = plot(show_bb?upper:na, title="BB Upper band", color=green, linewidth=2)
p2 = plot(show_bb?lower:na, title="BB Lower band", color=green, linewidth=2)
fill(p1, p2, title="BB Fill", color=green, transp=90)

// Value Chart Calculations
prev(s,i) =>
y=abs(round(i))
s[y]
varp = round(length/5)
h_f = length > 7
vara=h_f ? highest(high,varp)-lowest(low,varp) : 0
varr1 = h_f ? iff(vara==0 and varp==1,abs(close-prev(close,-varp)),vara) : 0
varb=h_f ? prev(highest(high,varp),-varp+1)-prev(lowest(low,varp),-varp) : 0
varr2 = h_f ? iff(varb==0 and varp==1,abs( prev(close,-varp)-prev(close,-varp*2) ),varb) : 0
varc=h_f ? prev(highest(high,varp),-varp*2)-prev(lowest(low,varp),-varp*2) : 0
varr3 = h_f ? iff(varc == 0 and varp==1,abs(prev(close,-varp*2)-prev(close,-varp*3)),varc) : 0
vard = h_f ? prev(highest(high,varp),-varp*3)-prev(lowest(low,varp),-varp*3) : 0
varr4 = h_f ? iff(vard == 0 and varp==1,abs(prev(close,-varp*3)-prev(close,-varp*4)),vard) : 0
vare = h_f ? prev(highest(high,varp),-varp*4)-prev(lowest(low,varp),-varp*4) : 0
varr5 = h_f ? iff(vare == 0 and varp==1,abs(prev(close,-varp*4)-prev(close,-varp*5)),vare) : 0
cdelta = abs(close - prev(close,-1))
var0 = (not h_f) ? iff((cdelta > (high-low)) or (high==low),cdelta,(high-low)) : 0
lrange=h_f ? ((varr1+varr2+varr3+varr4+varr5)/5)*.2 : sma(var0,5)*.2
mba = sma( (high+low)/2,length)
vOpen = (open-mba)/lrange
vClose = (close-mba)/lrange
vHigh = (high-mba)/lrange
vLow = (low-mba)/lrange

// Plots

plotarrow(vClose[1]>extTop[1] and vClose<extTop? -1 : vClose[1]<extBot[1] and vClose>extBot? 1 : na, title="HHS Signal", colorup=green, colordown=red)

//plotchar(open > dnFractal and vClose[1]>extTop[1] and vClose<extTop, title="Expiration down", location=location.abovebar, color=black, char="3", size=size.small)
//plotchar(open < upFractal and vClose[1]<extBot[1] and vClose>extBot, title="Expiration up", location=location.belowbar, color=black, char="3", size=size.small)
//plotshape(vClose[1]>extTop[1] and vClose<extTop, style=shape.arrowdown, location=location.abovebar, color=red, size=size.large)
//plotshape(vClose[1]<extBot[1] and vClose>extBot, style=shape.arrowup, location=location.belowbar, color=green, size=size.large)
AnhMinhNguyen
@zinovin
Hello, may I have access to your script? Thank you very much!
This copy paste not work :(
salexes
Would love to know the source code for it, to convert it to an MT4 indicator.
salexes
@salexes, is it possible to add an alert in this indicator?
salexes
@salexes, I just started to use trading view, how to create a script for strategy tester on here? I am not familar with the coding language here.
zinovin
@salexes,
I think you should be able to see the code of indicator. I am using this indicators in binary options. As I understood the strategy script functions intended for conventional trading, not for binary options. Also you can find via Google original indicators for Hubba-Hubba Style Strategy for MT4 platform.
salexes
@zinovin, Hello thank you for your answer, this message is shown here: The source code of this study is protected. You can add it to your favorites and use it, but you cannot view or modify the script.

So sadly I can not see it, could you maybe send it to me ?

BTW: Great work!

kind regards,
salexes
obstak
Does this Repaint?
tamphamft
@obstak, it is repain. dkm
JoacimKarlsen
May i please have access to your script please? best regards.
Mehr