Trading Systerm
Trading Systerm
Trading Systerm
source = close
topbots = input(true, title="Show PPO high/low triangles?")
long_term_div = input(true, title="Use long term divergences?")
div_lookback_period = input(55, minval=1, title="Lookback Period")
fastLength = input(12, minval=1, title="PPO Fast")
slowLength=input(26, minval=1, title="PPO Slow")
signalLength=input(9,minval=1, title="PPO Signal")
smoother = input(2,minval=1, title="PPO Smooth")
fastMA = ema(source, fastLength)
slowMA = ema(source, slowLength)
macd = fastMA - slowMA
macd2=(macd/slowMA)*100
d = sma(macd2, smoother) // smoothing PPO
bullishPrice = low
BottomPointsInPPO = oscMins
bearishPrice = high
priceMax = bearishPrice < bearishPrice[1] and bearishPrice[1] > bearishPrice[2] or
high[1] == high[2] and high[1] > high and high[1] > high[3] or high[1] == high[2]
and high[1] == high[3] and high[1] > high and high[1] > high[4] or high[1] ==
high[2] and high[1] == high[3] and high[1] and high[1] == high[4] and high[1] >
high and high[1] > high[5] // this line identifies tops in the price
oscMax = d < d[1] and d[1] > d[2] // this line identifies tops in the PPO
TopPointsInPPO = oscMax
// only take tops/bottoms in price when tops/bottoms are less than 5 bars away,
since 2nd most recent top/bottom in osc
y2=valuewhen(oscMax, filter2, 1) // identifies the highest high in the tops of
price with 5 bar lookback period SINCE the SECOND most recent top in PPO
y6=valuewhen(oscMins, filter, 1) // identifies the lowest low in the bottoms of
price with 5 bar lookback period SINCE the SECOND most recent bottom in PPO
y9=valuewhen(oscMins, currenttrough6, 0)
y10=valuewhen(oscMax, currenttrough7, 0)
//plot(0, color=gray)
//plot(d, color=black)
//plot(bulldiv, title = "Bottoms", color=maroon, style=circles, linewidth=3,
offset= -1)
//plot(beardiv, title = "Tops", color=green, style=circles, linewidth=3, offset= -
1)
bearishdiv1 = (y10 > y2 and oscMax and y3 < y4) ? true : false
bearishdiv2 = (delayedhigh > y2 and y3 < y4) ? true : false
bearishdiv3 = (long_term_div and oscMax and i and i2) ? true : false
bearishdiv4 = (long_term_div and i and i3) ? true : false
bullishdiv1 = (y9 < y6 and oscMins and y7 > y8) ? true : false
bullishdiv2 = (delayedlow < y6 and y7 > y8) ? true : false
bullishdiv3 = (long_term_div and oscMins and i4 and i5) ? true : false
bullishdiv4 = (long_term_div and i4 and i6) ? true : false
///////////////////////
//TMC LB
length = input(41)
showPriceTracker=input(false, type=bool)
prev(s, x) =>
y=abs(round(x))
s[y]
/////////////////////////////////////////
//FBB
length1 = input(200, minval=1)
src = input(hlc3, title="Source")
mult = input(3.0, minval=0.001, maxval=50)
basis1 = vwma(src, length1)
dev = mult * stdev(src, length1)
upper_1= basis1 + (0.236*dev)
upper_2= basis1 + (0.382*dev)
upper_3= basis1 + (0.5*dev)
upper_4= basis1 + (0.618*dev)
upper_5= basis1 + (0.764*dev)
upper_6= basis1 + (1*dev)
lower_1= basis1 - (0.236*dev)
lower_2= basis1 - (0.382*dev)
lower_3= basis1 - (0.5*dev)
lower_4= basis1 - (0.618*dev)
lower_5= basis1 - (0.764*dev)
lower_6= basis1 - (1*dev)
plot(basis1, color=fuchsia, linewidth=2)
p1 = plot(upper_1, color=white, linewidth=1, title="0.236")
p2 = plot(upper_2, color=white, linewidth=1, title="0.382")
p3 = plot(upper_3, color=white, linewidth=1, title="0.5")
p4 = plot(upper_4, color=white, linewidth=1, title="0.618")
p5 = plot(upper_5, color=white, linewidth=1, title="0.764")
p6 = plot(upper_6, color=red, linewidth=2, title="1")
p13 = plot(lower_1, color=white, linewidth=1, title="0.236")
p14 = plot(lower_2, color=white, linewidth=1, title="0.382")
p15 = plot(lower_3, color=white, linewidth=1, title="0.5")
p16 = plot(lower_4, color=white, linewidth=1, title="0.618")
p17 = plot(lower_5, color=white, linewidth=1, title="0.764")
p18 = plot(lower_6, color=green, linewidth=2, title="1")
//////////////////
//UCS RC
src1 = close
len = input(defval=25, minval=1, title="Linear Regression Length")
lrc = linreg(src1, len, 0)
plot(lrc, color = red, title = "Linear Regression Curve", style = line, linewidth =
2)