Advertisement
NKactive

NK Aroon ETH

Nov 19th, 2023
211
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © NKactive
  3. // Original code from Neo
  4. // With timeframe
  5. //@version=5
  6.  
  7. strategy("NK Aroon ETH", overlay=false, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding=0, slippage=1)
  8. import EliCobra/CobraMetrics/4 as cobra
  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. plot(cobra.curve(disp_ind))
  14. cobra.cobraTable(type_table, pos_table)
  15. //
  16. // ****************************************************************************************************************************************************************
  17. //Aroon Code
  18. // ****************************************************************************************************************************************************************
  19.  
  20. // Inputs
  21. timeframe=input.timeframe(defval ='6D', group = "Aroon", tooltip = "Select a different timeframe for this series") // Use Alternative timeframe
  22. aroonlength = input.int(13, "Aroon UP", group = "Aroon")
  23. lowerlength = input.int(18,"Aroon Down", group = "Aroon")
  24. //aroonUp = input.int(8, "AroonUP lvl", group = "Aroon")
  25. //aroonDn = input.int(23,"AroonDN lvl", group = "Aroon")
  26. smoothing1 = input.int(23, "Smooths Oscilator1", group = "Aroon")
  27. //smoothing2 = input.int(75, "Smooths Oscilator", group = "Aroon")
  28.  
  29. // Get high and low from selected timeframe instead of the one on the chart
  30. TFHighBars=request.security(syminfo.tickerid,timeframe , high)
  31. TFLowBars=request.security(syminfo.tickerid,timeframe , low)
  32.  
  33. //Calculation
  34. upper = 100 * (ta.highestbars(TFHighBars, aroonlength+1) + aroonlength)/aroonlength
  35. lower = 100 * (ta.lowestbars(TFLowBars, lowerlength+1) + lowerlength)/lowerlength
  36. oscillator1 = upper - lower
  37. oscillator = ta.ema(oscillator1, smoothing1)
  38.  
  39. //Threshhold
  40. //aroonup = math.avg(upper, lower) +50 + aroonUp
  41. //aroondn = math.avg(upper, lower) -50 +aroonDn
  42. //aroonup = aroonUp
  43. //aroondn = aroonDn
  44.  
  45. // ****************************************************************************************************************************************************************
  46. // Trading Condition
  47. // ****************************************************************************************************************************************************************
  48. aroonLong = upper > lower ? true : false
  49. aroonShort = upper < lower ? true : false
  50.  
  51. // upper green
  52. // lower orange
  53. //if upper > aroonup and lower > aroondn
  54. // aroonLong := true
  55. // aroonShort := false
  56. //if upper < aroonup and lower > aroondn or upper > aroonup and lower < aroondn
  57. // aroonLong := false
  58. // aroonShort := false
  59. //if upper < aroonup and lower < aroondn
  60. // aroonLong := false
  61. // aroonShort := true
  62.  
  63. // ****************************************************************************************************************************************************************
  64. // Plots
  65. // ****************************************************************************************************************************************************************
  66.  
  67. plot(upper, color=color.green, title = "upper")
  68. plot(lower, color=color.red, title = "lower")
  69. //plot(aroonup, color=color.gray, title = "aroonup")
  70. //plot(aroondn, color=color.gray, title = "aroondn")
  71. //plot(smoothing2, color=color.blue, title="smoothing2")
  72. //plot(oscillator, color=color.yellow, title = "oscillator")
  73. //plot(oscillator1, color=color.orange, title = "oscillator1")
  74. //plot(smoothing1, color=color.gray, title = "smoothing1")
  75.  
  76. //
  77. // ****************************************************************************************************************************************************************
  78. // Call combine signals and execute buy/sell positions within timeframe
  79. //.****************************************************************************************************************************************************************
  80. // Date Range To Include
  81. startDate = timestamp("2018-01-01T00:00")
  82. endDate = time
  83. // Check if the current timestamp is within the restricted range
  84. inRestrictedRange = time >= startDate and time <= endDate
  85. //
  86. // Buy Signals on overbought and oversold
  87. //
  88. if inRestrictedRange and aroonLong // ADD OTHER BUY SIGNAL BOOLS
  89. strategy.entry("My Long Entry Id", strategy.long, 100)
  90. if inRestrictedRange and aroonShort // ADD OTHER BUY SIGNAL BOOLS
  91. strategy.entry("My Short Entry Id", strategy.short, 100)
  92.  
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
Advertisement