Advertisement
NKactive

Specialist Puell

Nov 10th, 2023 (edited)
104
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 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. //@version=5
  4.  
  5. strategy("NK Specialist Puell ETH", overlay=false, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding=0, slippage=1)
  6.  
  7. import EliCobra/CobraMetrics/4 as cobra
  8. //// PLOT DATA
  9. 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 = "🐍 𝓒𝓸𝓫𝓻𝓪 𝓜𝓮𝓽𝓻𝓲𝓬𝓼 🐍")
  10. 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 = "🐍 𝓒𝓸𝓫𝓻𝓪 𝓜𝓮𝓽𝓻𝓲𝓬𝓼 🐍")
  11. type_table = input.string("None", "Table Type", options = ["Full", "Simple", "None"], group = "🐍 𝓒𝓸𝓫𝓻𝓪 𝓜𝓮𝓽𝓻𝓲𝓬𝓼 🐍")
  12. plot(cobra.curve(disp_ind))
  13. cobra.cobraTable(type_table, pos_table)
  14. //
  15. // ****************************************************************************************************************************************************************
  16. //
  17.  
  18. //PUELL
  19. var g_pu = "PU Settings"
  20. top = input.float(1.19, step=0.01)
  21. bottom = input.float(2.03, step=0.01)
  22. miningRevenue = request.security('QUANDL:BCHAIN/MIREV', 'D', close[1], barmerge.gaps_off, barmerge.lookahead_on)
  23. ma365 = request.security('QUANDL:BCHAIN/MIREV', 'D', ta.sma(close, 365)[1], barmerge.gaps_off, barmerge.lookahead_on)
  24. puellMultiple = miningRevenue / ma365
  25. puellUp = puellMultiple < top
  26. puellDown = puellMultiple > bottom
  27.  
  28. //Plot
  29. //plot(miningRevenue, color=color.yellow)
  30. //plot(ma365, color=color.orange)
  31. plot(puellMultiple, color=color.blue)
  32. plot(top, color=color.green)
  33. plot(bottom, color=color.red)
  34. fill(hline(top), hline(bottom), color=color.new(color.gray, 80))
  35.  
  36. // ****************************************************************************************************************************************************************
  37. // Call combine signals and execute buy/sell positions within timeframe
  38. //.****************************************************************************************************************************************************************
  39. // Set Buy/Sell Condition
  40.  
  41. goLong = puellUp // add your conditions here or nothing fires
  42. goShort = puellDown // add your conditions here or nothing fires
  43.  
  44. // Date Range To Include
  45. startDate = timestamp("2018-01-01T00:00")
  46. endDate = time
  47. // Check if the current timestamp is within the restricted range
  48. inRestrictedRange = time >= startDate and time <= endDate
  49. //
  50. // Buy/Sell Signals
  51. //
  52. if inRestrictedRange and goLong
  53. strategy.entry("My Long Entry Id", strategy.long)
  54. if inRestrictedRange and goShort
  55. strategy.entry("My Short Entry Id", strategy.short)
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