TridentBull

Supp_Resis_Fibo

459 3 61
Supp_Resis_Fibo
Remove from Favorite Scripts Add to Favorite Scripts
//Created By Marco 25 03 2016
// All Credit goes to Marco "Original Code Creator"
study(title="Supp_Resis_Fibo", overlay=true)
bblenght = input(34, minval=1, title="Bollinger Bars Lenght")
bbstdev = input(0.35, minval=0.1,step=0.05, title="Bollinger Bars Standard Deviation")
tp =input(0.0,defval=0.0,step=0.1,title ="percentuale take profitto")

//Calculate BB 55 0.2
source = close
basis = sma(source, bblenght)
dev = bbstdev * stdev(source, bblenght)
upperBB = basis + dev
lowerBB = basis - dev
midBB=(upperBB+lowerBB)/2
//is over the top?
isOverBBTop = low > upperBB ? true : false
isUnderBBBottom = high < lowerBB ? true : false
newisOverBBTop = isOverBBTop != isOverBBTop[1]
newisUnderBBBottom = isUnderBBBottom != isUnderBBBottom[1]
//receive high and low range
high_range = valuewhen(newisOverBBTop,high,0)
low_range = valuewhen(newisUnderBBBottom,low,0)

bblow = valuewhen(newisOverBBTop,(lowerBB/0.00005) *  0.00005,0)
bbhigh = valuewhen(newisUnderBBBottom,(((upperBB*1000)/5)+5) * 5/1000,0)

//take it only if over the BB limit
buy_limit_entry = isOverBBTop ? high_range==high_range[1] ? high_range+0.001: na : na
sell_limit_entry = isUnderBBBottom ? low_range==low_range[1] ? low_range-0.001: na : na

take_profit_buy=  isOverBBTop ? high_range==high_range[1] ? (buy_limit_entry + buy_limit_entry-bblow)+(buy_limit_entry + buy_limit_entry-bblow)*tp/500 : na : na 
take_profit_sell= isUnderBBBottom ? low_range==low_range[1] ?(sell_limit_entry -(bbhigh-sell_limit_entry))-(sell_limit_entry-(bbhigh-sell_limit_entry))*tp/500 : na : na

take_profit2_buy=  isOverBBTop ? high_range==high_range[1] ? buy_limit_entry + 2*(buy_limit_entry-bblow)+(buy_limit_entry + 2*(buy_limit_entry-bblow))*tp/500 : na : na 
take_profit2_sell= isUnderBBBottom ? low_range==low_range[1] ? sell_limit_entry - 2*(bbhigh-sell_limit_entry)-(sell_limit_entry - 2*(bbhigh-sell_limit_entry))*tp/500 : na : na

stop_loss_buy = isOverBBTop ? high_range==high_range[1] ? bblow : na : na 
stop_loss_sell = isUnderBBBottom ? low_range==low_range[1] ? bbhigh : na : na

highlightHigh = isOverBBTop ? white : white
highlightLow  = isUnderBBBottom ? white : white

colorLineUp = buy_limit_entry ? blue : blue
colorLineDown = sell_limit_entry ? red : red


//plot Statements
bbup=plot(upperBB, title="BB Upper Band", style=linebr, linewidth=2, color=highlightHigh)
bbdo=plot(lowerBB, title="BB Bottom Band", style=linebr, linewidth=2, color=highlightLow)
plot( buy_limit_entry, title="Buy Entry", style=linebr, linewidth=2, color=colorLineUp, transp=80)
plot( sell_limit_entry, title="Short Entry", style=linebr, linewidth=2, color=colorLineDown, transp=80)
plot( stop_loss_buy, title="Buy Stop", style=circles, linewidth=2, color=maroon, transp=0)
plot( stop_loss_sell, title="Short Stop", style=circles, linewidth=2, color=maroon, transp=20)

/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
len=input(34)
vwaphigh=highest(vwap,len)
vwaplow=lowest(vwap,len)
VaHD=vwaphigh-(vwaphigh-vwaplow)*0.15
VaLD=vwaplow+(vwaphigh-vwaplow)*0.15
PoCD=VaHD-(VaHD-VaLD)*0.618


spread=vwap
vwap_15 = security(tickerid, '5', spread)
vwap_240 = security(tickerid, '240', spread)

up=crossover(low,VaHD)
down=crossover(VaLD,high)
plotshape(down, style=shape.triangledown,style=size.large,
          location=location.abovebar, color=red,text="Sell")
plotshape(up, style=shape.triangleup,style=size.large, 
          location=location.belowbar, color=green,text="Buy")



up0=crossover(vwap_240,PoCD)
down0=crossover(PoCD,vwap_240)

plotshape(down0, style=shape.triangledown,style=size.large,
          location=location.abovebar, color=red,text="Short")
plotshape(up0, style=shape.triangleup,style=size.large, 
          location=location.belowbar, color=green,text="Long")
shero
8 months ago
how to use this macro ?
Reply
AlexNimerciag
8 months ago
Hy!

I want to create a script based on candlestick color. For examle 1=green, 0=red.
I want my script to recognize, for example when the pattern 01101101010 was formed.

It is possible to do this on tradingview charts?
Reply
vaicru PRO
8 months ago
Only 15 min. timeframe ?
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out