Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Tradingview.com
- // @author GodBlessYou12/ottuzzi
- // Drop a line if you use or modify this code.
- //modified by sco77m4r7in and oh92 -- updated and fixed multi exchange error, and added addtional caution dots.
- //study(title="Godmode3.2")
- //description: Godmode3.3.3.1 Red line in range of 9 to 0 flat or pointing up, Long on blue dot
- //@version=3
- strategy(title="Bull4Life Momentom ", default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding=100, slippage=1, commission_type = strategy.commission.percent, commission_value = 0.075)
- n1 = input(27, "Channel Length")
- n2 = input(9, "Average Length")
- n3 = input(3, "Short length")
- n4 = input(187, "Percentage Line Interval")
- bottom_level = input(27, "Bottom Circle Level")
- top_level = input(90, "Top Circle Level")
- count_length = input(187, "Circle Count")
- multi = input(type=bool, defval=false, title="Multi-exchange?")
- src0 = hlc3
- src1 = security("BITFINEX:BTCUSD", period, src0), src2 = security("POLONIEX:BTCUSDT", period, src0),
- src3 = security("BITSTAMP:BTCUSD", period, src0), src4 = security("COINBASE:BTCUSD", period, src0),
- src5 = security("BITMEX:XBTUSD", period, src0), src10 = security("KRAKEN:XBTUSD", period, src0)
- tci(src) => ema((src - ema(src, n1)) / (0.025 * ema(abs(src - ema(src, n1)), n1)), n2)+50
- mf(src) => rsi(sum(volume * (change(src) <= 0 ? 0 : src), n3), sum(volume * (change(src) >= 0 ? 0 : src), n3))
- willy(src) => 60 * (src - highest(src, n2)) / (highest(src, n2) - lowest(src, n2)) + 80
- csi(src) => avg(rsi(src, n3),tsi(src0,n1,n2)*50+50)
- godmode(src) => avg(tci(src),csi(src),mf(src),willy(src))
- tradition(src) => avg(tci(src),mf(src),rsi(src, n3))
- wt1 = multi?avg(godmode(src0),godmode(src1),godmode(src2),godmode(src3),godmode(src4),godmode(src5)):tradition(src0)
- wt2 = sma(wt1,6)
- bottom = wt2<bottom_level ? wt2+5 : na
- top = wt2>top_level ? wt2-5 : na
- reversal_top = (wt1[1] > wt1[2] and wt1 <= wt1[1] and wt1 > top_level) ? wt1 : na
- reversal_bottom = (wt1[1] < wt1[2] and wt1 >= wt1[1] and wt1 < bottom_level) ? wt1 : na
- plot(wt1, color=green)
- plot(wt2, color=red)
- plot(ema((wt1-wt2)*2+50,n3), color=aqua, style=area, transp=80, histbase=50)
- plot(top, title="Caution!", color=red, style=circles, linewidth=3)
- plot(bottom, title="Caution!", color=green, style=circles, linewidth=3)
- plot(reversal_top, title="Caution!", color=black, style=circles, linewidth=4)
- plot(reversal_bottom, title="Caution!", color=blue, style=circles, linewidth=4)
- blt = ema((wt1-wt2)*2+50,n3) - wt1
- bl = blt > 0 ? 1:0
- sumpos = 100 / n4 * sum(bl,n4)
- plot(sumpos, title="Black line", color=black, linewidth=4)
- blt2 = ema((wt1-wt2)*2+50,n3) - wt2
- bl2 = blt2 > 0 ? 1:0
- sumpos2 = 100 / n4 * sum(bl2,n4)
- plot(sumpos2, color=blue, linewidth=1)
- blt3 = wt1 - wt2
- bl3 = blt3 > 0 ? 1:0
- sumpos3 = 100 / n4 * sum(bl3,n4)
- plot(sumpos3, title="Orange line", color=orange, linewidth=4)
- bottom2 = na(bottom) ? 0 : 1
- top2 = na(top) ? 0 : 1
- count_bottom = sum(bottom2, count_length)
- count_top = sum(top2, count_length)
- plot(count_bottom, color=green, linewidth=4)
- plot(count_top, color=red, linewidth=4)
- hline(top_level)
- hline(bottom_level)
- //orignal settings 9,26,13
- // === STRATEGY RELATED INPUTS ===
- tradeInvert = input(defval = false, title = "Invert Trade Direction?")
- setDifference = input(defval = 0, title = "Black/orange Difference Value", minval = 0)
- setBlackLineShortThreshold = input(defval = 0, title = "Black Line Short Threshold <=", minval = 0)
- setRedLineLongThreshold = input(defval = 0, title = "Red Line Long Threshold <=", minval = 0)
- // the risk management inputs
- inpTakeProfit = input(defval = 0, title = "Take Profit", minval = 0)
- inpStopLoss = input(defval = 0, title = "Stop Loss", minval = 0)
- inpTrailStop = input(defval = 0, title = "Trailing Stop Loss", minval = 0)
- inpTrailOffset = input(defval = 0, title = "Trailing Stop Loss Offset", minval = 0)
- // === RISK MANAGEMENT VALUE PREP ===
- // if an input is less than 1, assuming not wanted so we assign 'na' value to disable it.
- useTakeProfit = inpTakeProfit >= 1 ? inpTakeProfit : na
- useStopLoss = inpStopLoss >= 1 ? inpStopLoss : na
- useTrailStop = inpTrailStop >= 1 ? inpTrailStop : na
- useTrailOffset = inpTrailOffset >= 1 ? inpTrailOffset : na
- timeFilter = (year >= 2012) and (month > 0) and (dayofmonth > 0 and dayofmonth < 32)
- buy = timeFilter and (count_top > count_bottom)
- plot(buy? 1: 0, title="BUY", color=green, style=circles, linewidth=3)
- if buy == 1 and timeFilter
- strategy.close("Short")
- strategy.entry("Long", strategy.long)
- sell = timeFilter and (reversal_top != 0) and sumpos >= setBlackLineShortThreshold and falling(sumpos, 2)// and falling (wt1, 2) //and not falling(sumpos, 2)
- plot(sell? 1: 0, title="SELL", color=red, style=circles, linewidth=3)
- strategy.exit("Exit Long", from_entry = "Long", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
- strategy.exit("Exit Short", from_entry = "Short", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
- if reversal_bottom != 0// or sumpos < sumpos3
- strategy.close("Short")
- if count_top < count_bottom// or sumpos > sumpos3
- strategy.close("Long")
- //if sell == 1 and timeFilter
- // strategy.close("Long")
- // strategy.entry("Short", strategy.short)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement