Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=6
- //Noro
- //2018
- 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)
- import andyepartridge/utils/3 as utils
- //Settings
- needlong = input(true, title = 'Long')
- needshort = input(false, title = 'Short')
- capital = input.int(100, minval = 1, maxval = 10000, title = 'Lot, %')
- length = input(4)
- numATRs = input(0.25)
- fromyear = input.int(1900, minval = 1900, maxval = 2100, title = 'From Year')
- toyear = input.int(2100, minval = 1900, maxval = 2100, title = 'To Year')
- frommonth = input.int(01, minval = 01, maxval = 12, title = 'From Month')
- tomonth = input.int(12, minval = 01, maxval = 12, title = 'To Month')
- fromday = input.int(01, minval = 01, maxval = 31, title = 'From day')
- today = input.int(31, minval = 01, maxval = 31, title = 'To day')
- //Indicator
- atrs = ta.sma(ta.tr, length) * numATRs
- //Trading
- size = strategy.position_size
- lot = 0.0
- lot := size == 0 ? strategy.equity / close * capital / 100 : lot[1]
- if not na(close[length]) and needlong
- if time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
- strategy.entry('L', strategy.long, lot, stop = close + atrs)
- if not na(close[length]) and needlong == false
- if time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
- strategy.entry('L', strategy.long, 0, stop = close + atrs)
- if not na(close[length]) and needshort
- if time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
- strategy.entry('S', strategy.short, lot, stop = close - atrs)
- if not na(close[length]) and needshort == false
- if time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
- strategy.entry('S', strategy.short, 0, stop = close - atrs)
- utils.DrawDailyTable()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement