Guest User

Untitled

a guest
Jan 25th, 2024
68
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. //@version=5
  2. // This Pine Scriptโ„ข code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  3. // ยฉ rabiha_
  4.  
  5. //23.1 dran weiterarbeiten
  6.  
  7. import EliCobra/CobraMetrics/4 as cobra
  8.  
  9. //// PLOT DATA
  10. disp_ind = input.string ("None" , title = "Display Curve" , tooltip = "Choose which data you would like to display", options=["Strategy", "Equity", "Open Profit", "Gross Profit", "Net Profit", "None"], group = "๐Ÿ ๐“’๐“ธ๐“ซ๐“ป๐“ช ๐“œ๐“ฎ๐“ฝ๐“ป๐“ฒ๐“ฌ๐“ผ ๐Ÿ")
  11. pos_table = input.string("Middle Left", "Table Position", options = ["Top Left", "Middle Left", "Bottom Left", "Top Right", "Middle Right", "Bottom Right", "Top Center", "Bottom Center"], group = "๐Ÿ ๐“’๐“ธ๐“ซ๐“ป๐“ช ๐“œ๐“ฎ๐“ฝ๐“ป๐“ฒ๐“ฌ๐“ผ ๐Ÿ")
  12. type_table = input.string("None", "Table Type", options = ["Full", "Simple", "None"], group = "๐Ÿ ๐“’๐“ธ๐“ซ๐“ป๐“ช ๐“œ๐“ฎ๐“ฝ๐“ป๐“ฒ๐“ฌ๐“ผ ๐Ÿ")
  13.  
  14. plot(cobra.curve(disp_ind))
  15. cobra.cobraTable(type_table, pos_table)
  16.  
  17. strategy(title="STC", shorttitle="Stoch", format=format.price, precision=2, overlay = true, initial_capital = 100000, slippage = 1,pyramiding = 1, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
  18.  
  19.  
  20. //Time Range
  21. startDate = input.time(defval = timestamp( "01 january 2018"), title= "Start Date", group = "Date period")
  22.  
  23. //STC ////conditions////
  24.  
  25. //longCondition= A and/or B and/or C
  26.  
  27. //shortCondition= A and/or B and/or C
  28.  
  29.  
  30. /////Entry conditions////
  31. longCondition = ta.stoch(close, high, low, STCFastLengh, 3) < 20
  32.  
  33. shortCondition = ta.stoch(close, high, low, STCSlowLengh, 3) > 80
  34.  
  35.  
  36. //Enter long position//
  37.  
  38. if (longCondition and time >= startDate and barstate.isconfirmed)
  39. strategy.entry("long", strategy.long)
  40.  
  41.  
  42. //Enter short position
  43. if (shortCondition and time >= startDate and barstate.isconfirmed)
  44. strategy.entry("short", strategy.short)
  45.  
  46.  
  47.  
  48. ////FAST/SLOW lenghts///
  49.  
  50. STClenght= input.int(14, title = "STClenght", minval=1)
  51.  
  52. STCFastLenght=input.int(14, title = "STC Fast Lenght", minval=1)
  53.  
  54. STCSlowLenght= input.int(3, title = "STC Slow lenght", minval=1)
  55.  
  56. ////imputs STC//////
  57.  
  58. periodK = input.int(14, title="%K Length", minval=1, tooltip = "lenght %K")
  59. smoothK = input.int(1, title="%K Smoothing", minval=1,tooltip = "Smoothing %K")
  60. periodD = input.int(3, title="%D Smoothing", minval=1, tooltip = "Smoothing %D")
  61.  
  62.  
  63. k = ta.sma(ta.stoch(close, high, low, periodK), smoothK)
  64. d = ta.sma(k, periodD)
  65.  
  66. //Plot STC//
  67. plot(k, title="%K", color=#32f50c)
  68. plot(d, title="%D", color=#ff2600)
  69. h0 = hline(80, "Upper Band", color=#787B86)
  70. hline(50, "Middle Band", color=color.new(#787B86, 50))
  71. h1 = hline(20, "Lower Band", color=#787B86)
  72. fill(h0, h1, color=color.rgb(33, 150, 243, 90), title="Background")
Advertisement
Comments
  • # text 0.12 KB | 0 0
    1. download all types of premium tradingview indicators codes available on telegram - https://t.me/tradingview_premium_indicator
Add Comment
Please, Sign In to add comment