MarcoValente

Intraday TS ,BB + Buy/Sell +Squeeze Mom.+ adx-dmi

Intraday 5+ min indicator/strategy. Mix of indicator as BB, Ema , Roc , adx/dmi with buy and TP/SL point. All in 1 indicator easy to use . Just look the color chnge and the shape add the the bars
نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الكود في منشور تحكمه قواعد الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟
//Created By Marco 25 03 2016
// Intraday 5 min
study(title="Intraday TS ,BB + Buy/Sell +Squeeze Mom.+ adx-dmi", shorttitle="Intraday (5 min+) Strategy", overlay=true)
bblenght = input(46, 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 ? lime : aqua
highlightLow  = isUnderBBBottom ? lime : aqua

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


colorBuyTP = close>=take_profit_buy ? lime : fuchsia
colorSellTP = close<=take_profit_sell ? lime : fuchsia
colorBuyTP2 = close>=take_profit2_buy ? lime : fuchsia
colorSellTP2 = close<=take_profit2_sell ? lime : fuchsia

barcolor((high >= lowerBB and low <= upperBB) ? aqua : na)
barcolor((high < sell_limit_entry and low > take_profit_sell) ? orange : na)
barcolor((low > buy_limit_entry and high < take_profit_buy) ? orange : na)
barcolor(high >= take_profit_buy and not(na(buy_limit_entry)==1) ? fuchsia : low <= take_profit_sell and not(na(sell_limit_entry)==1) ? fuchsia : na)
//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)
plot( take_profit_buy, title="Buy TP 1:1", style=circles, linewidth=2, color=colorBuyTP, transp=20)
plot( take_profit_sell, title="Short TP 1:1", style=circles, linewidth=2, color=colorSellTP, transp=20)
plot( take_profit2_buy, title="Buy TP2 1:2", style=circles, linewidth=2, color=colorBuyTP2, transp=20)
plot( take_profit2_sell, title="Short TP2 1:2", style=circles, linewidth=2, color=colorSellTP2, transp=20)
fill(bbup, bbdo, color=aqua, transp=87)

////study("plotarrow example", overlay=true)
compra= isOverBBTop ? high_range==high_range[1] ? high_range+0.001: 1: 0
vendi = isUnderBBBottom ? low_range==low_range[1] ? low_range-0.001: 1 : 0
codiff = compra ==1 ? compra: 0
codiff2 = vendi ==1 ? vendi :0
plotarrow(codiff,colorup=green,transp=40)
plotarrow(codiff2*-1,colordown=orange,transp=40)
//Squeeze Mom

length = input(20, title="BB Length")
mult = input(2.0,title="BB MultFactor")
lengthKC=input(20, title="KC Length")
multKC = input(1.5, title="KC MultFactor")

useTrueRange = input(true, title="Use TrueRange (KC)", type=bool)

basis1 = sma(source, length)
dev1 = mult * stdev(source, length)
upperBB1 = basis1 + dev1
lowerBB1 = basis1 - dev1


// Calculate KC
ma = sma(source, lengthKC)
range = useTrueRange ? tr : (high - low)
rangema = sma(range, lengthKC)
upperKC = ma + rangema * multKC
lowerKC = ma - rangema * multKC

sqzOn  = (lowerBB1 > lowerKC) and (upperBB1 < upperKC)
sqzOff = (lowerBB1 < lowerKC) and (upperBB1 > upperKC)
noSqz  = (sqzOn == false) and (sqzOff == false)

val = linreg(source  -  avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),sma(close,lengthKC)), 
            lengthKC,0)

bcolor = iff( val > 0, 
            iff( val > nz(val[1]), lime, green),
            iff( val < nz(val[1]), red, maroon))
scolor = noSqz ? blue : sqzOn ? black : gray 
plot(midBB, color=bcolor, style=linebr, linewidth=3)
plot(midBB, color=scolor, style=cross, linewidth=2)

//study(title="Directional Movement Index", shorttitle="DMI")
len = input(14, minval=1, title="DI Length")
lensig = input(14, title="ADX Smoothing", minval=1, maxval=50)
up = change(high)
down = -change(low)
trur = rma(tr, len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / trur)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / trur)
sum = plus + minus 
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)

//study(title="plotshape example 1", overlay=true)
dataup= plus >= minus and adx>=29
datadw=minus>=plus and adx>=29
datast=adx<=20
plotshape(dataup,style=shape.triangleup,location=location.abovebar,color=green)
plotshape(datadw,style=shape.triangledown,location=location.belowbar,color=maroon)
plotshape(datast,style=shape.diamond,color=red)

التحليلات ذات الصلة