Advertisement
NKactive

alter_mann Alligator

Nov 17th, 2023
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 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 and alter_mann
  3. //@version=5
  4.  
  5. strategy("alter_mann Alligator", overlay=false, initial_capital=10000, 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. // alter_mann Alligator
  18. // ****************************************************************************************************************************************************************
  19.  
  20. // Inputs
  21. timeframeAligator=input.timeframe(defval ='1D', group = "Alligator", tooltip = "Select a different timeframe for this series") // Use Alternative timeframe
  22. jawLength = input(13, "Jaw Length")
  23. teethLength = input(8, "Teeth Length")
  24. lipsLength = input(5, "Lips Length")
  25.  
  26. // Request close from alternate timeframe
  27. altClose = request.security(syminfo.tickerid, timeframeAligator, close)
  28.  
  29. jaw = ta.sma(altClose, jawLength)
  30. teeth = ta.sma(altClose, teethLength)
  31. lips = ta.sma(altClose, lipsLength)
  32.  
  33. // Strategy logic
  34. longCondition = lips > teeth and teeth > jaw
  35. shortCondition = lips < teeth and teeth < jaw
  36.  
  37. // Plotting
  38. plot(jaw, "Jaw", color.blue)
  39. plot(teeth, "Teeth", color.red)
  40. plot(lips, "Lips", color.green)
  41.  
  42. // ****************************************************************************************************************************************************************
  43. // Call combine signals and execute buy/sell positions within timeframe
  44. //.****************************************************************************************************************************************************************
  45. // Date Range To Include
  46. startDate = timestamp("2018-01-01T00:00")
  47. endDate = time
  48. // Check if the current timestamp is within the restricted range
  49. inRestrictedRange = time >= startDate and time <= endDate
  50. //
  51. // Buy Signals on overbought and oversold
  52. //
  53. if inRestrictedRange and longCondition// ADD OTHER BUY SIGNAL BOOLS
  54. strategy.entry("My Long Entry Id", strategy.long, 100)
  55. if inRestrictedRange and shortCondition// ADD OTHER BUY SIGNAL BOOLS
  56. strategy.entry("My Short Entry Id", strategy.short, 100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement