# ForNataly

609 1
Indicator for Binary Options. In work, ver 1.0.0.2
study(title="ForNataly", shorttitle= "ForNataly", overlay=true)

bf_period = 10 //период Болли
bf_period20 = 40 //период Болли
bf_stddev = 2
bf_profit = 0.1
bf_rsi = 40
bf_rsi_inner = 0

bf_middle = sma(close, bf_period)
bf_20 = sma(close, bf_period20)
rsi_ = rsi(close, 14)
st = stoch(close, high, low, 25)
bf_top = bf_middle + (stdev(close, bf_period) * bf_stddev)
bf_bottom = bf_middle - (stdev(close, bf_period) * bf_stddev)
bf_height = ((high + bf_spread) - (low - bf_spread)) * bf_profit
bf_short_entry = low - bf_spread
bf_short_stop = high + bf_spread
bf_short_exit = bf_short_entry - bf_height

bf_long_entry = high + bf_spread
bf_long_stop = low - bf_spread
bf_long_exit = bf_long_entry + bf_height

bf_long = close < bf_middle ? (close > bf_bottom ? true : false) : false
bf_short = close > bf_middle ? (close < bf_top ? true : false) : false

bf_lowest = low == lowest(bf_period / 2) ? ( low < bf_bottom ? true : false ) : false
bf_highest = high == highest(bf_period / 2) ? ( high > bf_top ? true : false ) : false

bf_rsi_long = rsi(close, 20) > (50 + bf_rsi_inner) ? (rsi(close, 20) < (50 + bf_rsi) ? true : false) : false
bf_rsi_short = rsi(close, 20) < (50 - bf_rsi_inner) ? (rsi(close, 20) > (50 - bf_rsi) ? true : false) : false
bf_go_long = bf_long ? ( bf_lowest ? ( bf_long_exit < (bf_middle - bf_spread) ? (bf_rsi_short ? true : false) : false ) : false ) : false
bf_go_short = bf_short ? ( bf_highest ? ( bf_short_exit > (bf_middle + bf_spread) ? (bf_rsi_long ? true : false) : false ) : false ) : false
bf_enter = bf_go_long ? bf_long_entry : ( bf_go_short ? bf_short_entry : bf_enter[1] )
bf_exit = bf_go_long ? bf_long_exit : ( bf_go_short ? bf_short_exit : bf_exit[1] )
bf_stop = bf_go_long ? bf_long_stop : ( bf_go_short ? bf_short_stop : bf_stop[1] )
//plot(bf_enter == bf_enter[bf_period] ? na : bf_enter, title="Entry", color=blue, style=circles, linewidth=2)
StochAndRSIup = rsi_>70 and st >80
StochAndRSIdown = rsi_ <30 and st <20

barcolor(StochAndRSIup   ? yellow : na)
barcolor(StochAndRSIdown  ? yellow : na)

//////////////////////////////////////////////////////////////////////
//Считаем стохастика
len = 14
smoothK = 3
smoothD = 3
upLine = 90
lowLine = 20

sbc = true
sbh = false
sch = false
sl = true
sac = false
sacl = false

//Stoch formula
k = sma(stoch(close, high, low, len), smoothK)
d = sma(k, smoothD)

//Necessary for Highlight Bars
aboveLine = k > upLine ? 1 : 0
belowLine = k < lowLine ? 1 : 0

//Only Necessary if you want you want Stochastic Croses
//Definition for Cross when Above High-Low lines
crossUp = (k[1] < d[1] and k[1] < lowLine[1]) and (k > d)  ? 1 : 0
crossDn = (k[1] > d[1] and k[1] > upLine[1]) and (k < d) ? 1 : 0

//Only Necessary if you want you want Stochastic Croses
//Definition for Cross that doesn't have to be above or below High and Low line.
crossUpAll = (k[1] < d[1] and k > d) ? 1 : 0
crossDownAll = (k[1] > d[1] and k < d) ? 1 : 0

overBought() => sbc and aboveLine
overSold() => sbc and belowLine

resStochUp = sl and crossUp
resStochDown = sl and crossDn

//plotchar(StochAndRSIup ? 1 : na, title="На продажу по RSI", char='↓', location=location.abovebar, color=blue, transp=0, offset=0)
//plotchar(StochAndRSIdown ? 1 : na, title="На покупку по RSI", char='↑', location=location.abovebar, color=blue, transp=0, offset=0)

finalUp = StochAndRSIup or  resStochUp
finalDown = resStochDown or StochAndRSIdown

plotarrow(finalUp ? crossUp : na, title="Строгое соответствие на покупку", colorup=gray, maxheight=30, minheight=30, transp=0)
plotchar(finalUp ? crossUp : na, title="Buy Entry", offset=0, char='К', location=location.abovebar, color=lime, transp=0)

plotarrow(finalDown ? crossDn : na, title="Строгое соответствие на продажу", colorup=gray, maxheight=30, minheight=30, transp=0)
plotchar(finalDown ? crossDn : na, title="Short Entry", offset=0, char='П', location=location.abovebar, color=red, transp=0)

//plotchar(sacl and crossUpAll ? crossUpAll : na, title="Слабачок на продажу", char='↓', location=location.belowbar, color=lime, transp=0, offset=0)
//plotchar(sacl and crossDownAll ? crossDownAll : na, title="Слабачок на покупку", char='↑', location=location.abovebar, color=red, transp=0, offset=0)
///////////////////////////////////////////////////////////////////////
//plotchar(finalUp ? crossUp : na, title="Строгое соответствие на покупку", char='↑', location=location.belowbar, color=lime, transp=0, offset=0)
//plotchar(finalDown ? crossDn : na, title="Строгое соответствие на продажу", char='↓', location=location.abovebar, color=red, transp=0, offset=0)


fix for the arrows, it needs one plotarrow:

finalUp = StochAndRSIup or resStochUp ? crossUp : na
finalDown = resStochDown or StochAndRSIdown? crossDn : na
arrow=finalUp ? 1 : finalDown ? -1 : na
plotarrow(arrow, colorup=gray, maxheight=30, minheight=30, transp=0)
English
English (UK)
English (IN)
Deutsch
Français
Español
Italiano
Polski
Türkçe
Русский
Português
Bahasa Indonesia
Bahasa Melayu
ภาษาไทย
Tiếng Việt

한국어

Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter