Advertisement
andypartridge47

Volty Expan Close Strategy V3

Jan 17th, 2025
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. //@version=6
  2. //Noro
  3. //2018
  4.  
  5. strategy(title = 'Volty Expan Close Strategy V3', shorttitle = 'Volty 1.0', overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 100)
  6. import andyepartridge/utils/3 as utils
  7.  
  8. //Settings
  9. needlong = input(true, title = 'Long')
  10. needshort = input(false, title = 'Short')
  11. capital = input.int(100, minval = 1, maxval = 10000, title = 'Lot, %')
  12. length = input(4)
  13. numATRs = input(0.25)
  14. fromyear = input.int(1900, minval = 1900, maxval = 2100, title = 'From Year')
  15. toyear = input.int(2100, minval = 1900, maxval = 2100, title = 'To Year')
  16. frommonth = input.int(01, minval = 01, maxval = 12, title = 'From Month')
  17. tomonth = input.int(12, minval = 01, maxval = 12, title = 'To Month')
  18. fromday = input.int(01, minval = 01, maxval = 31, title = 'From day')
  19. today = input.int(31, minval = 01, maxval = 31, title = 'To day')
  20.  
  21. //Indicator
  22. atrs = ta.sma(ta.tr, length) * numATRs
  23.  
  24. //Trading
  25. size = strategy.position_size
  26. lot = 0.0
  27. lot := size == 0 ? strategy.equity / close * capital / 100 : lot[1]
  28. if not na(close[length]) and needlong
  29. if time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
  30. strategy.entry('L', strategy.long, lot, stop = close + atrs)
  31. if not na(close[length]) and needlong == false
  32. if time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
  33. strategy.entry('L', strategy.long, 0, stop = close + atrs)
  34. if not na(close[length]) and needshort
  35. if time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
  36. strategy.entry('S', strategy.short, lot, stop = close - atrs)
  37. if not na(close[length]) and needshort == false
  38. if time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
  39. strategy.entry('S', strategy.short, 0, stop = close - atrs)
  40.  
  41. utils.DrawDailyTable()
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement