ZachPirangi

------ This is it UPDATED

30
// IB/
strategy(title='------ This is it UPDATED', shorttitle='----This is it UPDATED', overlay=true, pyramiding=1, initial_capital=1000, currency=currency.USD)

//IB-----------------------------//
len = 33
src = input(close, title="IB")
out = sma(src, len)
last8h = highest(close, 12)
lastl8 = lowest(close, 12)
bearish = cross(close,out) == 1 and falling(close, 1)
bullish = cross(close,out) == 1 and rising(close, 1)
channel2=input(false, title="Bar Channel On/Off")
ul2=plot(channel2?last8h:last8h==nz(last8h)?last8h:na, color=black, linewidth=1, style=linebr, title="IB", offset=0)
ll2=plot(channel2?lastl8:lastl8==nz(lastl8)?lastl8:na, color=black, linewidth=1, style=linebr, title="IN", offset=0)
//fill(ul2, ll2, color=black, transp=95, title="Candle body resistance Channel")

//-----------------IB
RST = input(title='IB:', type=integer, defval=10)
RSTT = valuewhen(high >= highest(high, RST), high, 0)
RSTB = valuewhen(low <= lowest(low, RST), low, 0)
RT2 = plot(RSTT, color=RSTT != RSTT ? na : red, linewidth=1, offset=+0)
RB2 = plot(RSTB, color=RSTB != RSTB ? na : green, linewidth=1, offset=0)

//--------------------IB------------------------------------------------//
src0 = close, len0 = input(12, minval=1, title="EMA 1")
ema0 = ema(src0, len0)
direction = rising(ema0, 2) ? +1 : falling(ema0, 2) ? -1 : 0
plot_color = direction > 0 ? lime: direction < 0 ? red : na
plot(ema0, title="EMA", style=line, linewidth=1, color = plot_color)

//-------------------- IB------------------------------------------------//
src02 = close, len02 = input(20, minval=1, title="EMA 2")
ema02 = ema(src02, len02)
direction2 = rising(ema02, 2) ? +1 : falling(ema02, 2) ? -1 : 0
plot_color2 = direction2 > 0 ? lime: direction2 < 0 ? red : na
plot(ema02, title="EMA Signal 2", style=line, linewidth=1, color = plot_color2)

//=============IB//
show_hma = input(false, title="IB:")
hma_src = input(close, title="IB:")
hma_base_length = input(8, minval=1, title="IB:")
hma_length_scalar = input(5, minval=0, title="IB:")
hullma(src, length)=>wma(2*wma(src, length/2)-wma(src, length), round(sqrt(length)))
plot(not show_hma ? na : hullma(hma_src, hma_base_length+hma_length_scalar*5), color=black, linewidth=2, title="Hull MA")


rangeup = close+tr
rangedown = close-tr
over() => high > rangeup and close > open
under() => low < rangedown and close < open


//============ IB ==================================//
Piriod=input('720')
ch1 = security(tickerid, Piriod, open)
ch2 = security(tickerid, Piriod, close)

longCondition = crossover(security(tickerid, Piriod, close),security(tickerid, Piriod, open))
//if (longCondition )
// strategy.entry("IB", strategy.long, when = over())

shortCondition = crossunder(security(tickerid, Piriod, close),security(tickerid, Piriod, open))
//if (shortCondition)
// strategy.entry("IB Short", strategy.short, when = under())
//if(over())
// strategy.exit("IB Short")
//if(under())
// strategy.exit("IB Long")
//strategy.exit("IB", loss = 10)
//strategy.exit("IB Long", loss = 10)


strategy.entry("CBL", strategy.long, when = over() and time >= (timestamp(2016, 02, 06, 08, 29)) and time < (timestamp(2016, 02, 11, 00, 00)))
strategy.entry("CBS", strategy.short, when = under() and time >= (timestamp(2016, 02, 06, 08, 29)) and time < (timestamp(2016, 02, 11, 00, 00)))


strategy.exit(id="IB",from_entry="CBL", when = under() or shortCondition, loss=19)
strategy.exit(id="IB",from_entry="CBS", when = over() or longCondition, loss=19)

///////////////////////////////////////////////////////////////////////////////////////////



نص برمجي مفتوح المصدر

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

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

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

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟