Advertisement
DannyIdle

TradingView Strategy

Oct 3rd, 2023 (edited)
893
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | Cryptocurrency | 0 0
  1. //@version=2
  2. strategy(title='Sniper & Strategy by CSBender_', shorttitle='Sniper & Strategy by CSBender_', overlay=true, pyramiding=0, initial_capital=1, currency=currency.USD)
  3. //============ signal Generator ==================================//
  4. Piriod=input('720')//630
  5. ch1 = security(tickerid, Piriod, open)
  6. ch2 = security(tickerid, Piriod, close)
  7. longCondition = crossover(ch2,ch1)
  8. shortCondition = crossunder(ch2,ch1)
  9. if (longCondition)
  10. strategy.entry(".", strategy.long)
  11. plotshape(longCondition, style=shape.labelup, color=lime, text="Señal de\nCompra\nActivada", textcolor=black, location=location.belowbar)
  12. if (shortCondition)
  13. strategy.entry(".", strategy.short)
  14. plotshape(shortCondition, style=shape.labeldown, color=red, text="Señal de\nVenta\nActivada", textcolor=black)
  15. //============ Directional Projection ==================================//
  16. channel3=input(false, title="Connect Projection High/Low")
  17. tf2 = input('1', title="Trend Projection TF / Mins/D/W")
  18. M2 = input('ATR')
  19. P2 = input(13.00, type=float)
  20. W2 = input(1)
  21. pf2 = pointfigure(tickerid, 'close', M2, P2, W2)
  22. spfc2 = security(pf2, tf2, close)
  23. p22=plot(channel3?spfc2:spfc2==nz(spfc2[1])?spfc2:na, color=blue, linewidth=2, style=linebr, title="Projection", offset=0)
  24. //====================colour bar======================
  25. mysignal = ema(close, 13) - ema(close, 26)
  26. barcolor(mysignal[0] > mysignal[1] ? green : red)
  27. //============ Trend colour ema 1 y 2 ==================================//
  28. src0 = close, len0 = input(13, minval=1, title="EMA 1")
  29. ema0 = ema(src0, len0)
  30. direction = rising(ema0, 2) ? +1 : falling(ema0, 2) ? -1 : 0
  31. plot_color = direction > 0 ? lime: direction < 0 ? red : na
  32. plot(ema0, title="EMA", style=line, linewidth=2, color = plot_color)
  33. //============ ema 2 ==================================//
  34. src02 = close, len02 = input(21, minval=1, title="EMA 2")
  35. ema02 = ema(src02, len02)
  36. direction2 = rising(ema02, 2) ? +1 : falling(ema02, 2) ? -1 : 0
  37. plot_color2 = direction2 > 0 ? lime: direction2 < 0 ? red : na
  38. plot(ema02, title="EMA Signal 2", style=line, linewidth=2, color = plot_color2)
  39. //=============Hull MA ==================================//
  40. show_hma = input(false, title="Display Hull MA Set:")
  41. hma_src = input(close, title="Hull MA's Source:")
  42. hma_base_length = input(8, minval=1, title="Hull MA's Base Length:")
  43. hma_length_scalar = input(5, minval=0, title="Hull MA's Length Scalar:")
  44. hullma(src, length)=>wma(2*wma(src, length/2)-wma(src, length), round(sqrt(length)))
  45. plot(not show_hma ? na : hullma(hma_src, hma_base_length+hma_length_scalar*6), color=black, linewidth=2, title="Hull MA")
  46. //============ Supertrend Generator ==================================//
  47. Factor=input(1, minval=1,maxval = 000, title="Trend Transition Signal")
  48. Pd=input(1, minval=1,maxval = 100)
  49. Up=hl2-(Factor*atr(Pd))
  50. Dn=hl2+(Factor*atr(Pd))
  51. TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up
  52. TrendDown=close[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn
  53. Trend = close > TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],0)
  54. plotarrow(Trend == 1 and Trend[1] == -1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=1000, minheight=50, transp=85)
  55. plotarrow(Trend == -1 and Trend[1] == 1 ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=1000, minheight=50, transp=85)
  56. //============ Trend Generator ==================================//
  57. slow = 8
  58. fast = 5
  59. vh1 = ema(highest(avg(low, close), fast), 5)
  60. vl1 = ema(lowest(avg(high, close), slow), 8)
  61. e_ema1 = ema(close, 1)
  62. e_ema2 = ema(e_ema1, 1)
  63. e_ema3 = ema(e_ema2, 1)
  64. tema = 1 * (e_ema1 - e_ema2) + e_ema3
  65. e_e1 = ema(close, 8)
  66. e_e2 = ema(e_e1, 5)
  67. dema = 2 * e_e1 - e_e2
  68. signal = tema > dema ? max(vh1, vl1) : min(vh1, vl1)
  69. is_call = tema > dema and signal > low and (signal-signal[1] > signal[1]-signal[2])
  70. is_put = tema < dema and signal < high and (signal[1]-signal > signal[2]-signal[1])
  71. plotshape(is_call ? 1 : na, title="BUY ARROW", color=green, text="B", style=shape.arrowup, location=location.belowbar)
  72. plotshape(is_put ? -1 : na, title="SELL ARROW", color=red, text="S", style=shape.arrowdown)
  73. //============ END ==================================//
Advertisement
Comments
  • hemal9022
    241 days
    # text 0.12 KB | 0 0
    1. i founded all types of premium tradingview indicators codes available on telegram - https://t.me/tradingview_premium_indicator
Add Comment
Please, Sign In to add comment
Advertisement