This is a long only strategy for the 5m US tech 100 . Works well with c.2.5 profit factor.
I am not a coder so would appreciate if someone could put this in ProRealTime code for me .
//Disbale Signal Repainting
disableRepainting = input.bool(defval = true, title = "Disable Signal Repainting", group = "Repainting Settings")
////Session Settings Inputs
useSession = input.bool(defval = true, title = "Use Session", group = "Session Settings")
closeEverything = input.bool(defval = true, title = "Close all orders/positions if session ends", group = "Session Settings")
customTimeZone = input.string(defval = "America/New_York", title = "Custom Time Zone", group = "Session Settings", inline = "a1")
useCustomTimeZone = input.bool(defval = true, title = "On/Off", group = "Session Settings", inline = "a1")
timeSession = input.session(defval = "0940-1605", title = "Session Time", group = "Session Settings", tooltip = "Use the checkboxes to select " +
"on which days of the week this session is active. The session " +
"has to be active on at least one day.")
monSession = input.bool(true, title="Mon ", group = "Session Settings", inline="d1")
tueSession = input.bool(true, title="Tue ", group = "Session Settings", inline="d1")
wedSession = input.bool(true, title="Wed ", group = "Session Settings", inline="d1")
thuSession = input.bool(true, title="Thu ", group = "Session Settings", inline="d1")
friSession = input.bool(true, title="Fri   ", group = "Session Settings", inline="d2")
satSession = input.bool(false, title="Sat  ", group = "Session Settings", inline="d2")
sunSession = input.bool(false, title="Sun ", group = "Session Settings", inline="d2")
// Custom Time Zone Logic
timeZone = useCustomTimeZone ? customTimeZone : syminfo.timezone
// Make a days of week string based on the value of the checkboxes
sessionDays = ""
if sunSession
sessionDays += "1"
if monSession
sessionDays += "2"
if tueSession
sessionDays += "3"
if wedSession
sessionDays += "4"
if thuSession
sessionDays += "5"
if friSession
sessionDays += "6"
if satSession
sessionDays += "7"
// Make the session string by joining the time with the days
tradingSession = timeSession + ":" + sessionDays
//Session Logic
t = time(timeframe.period, tradingSession, timeZone)
inSession = not na(t) and useSession
outSession = na(t) and useSession
bgcolor(inSession ? color.new(color.green, transp = 95) : na)
////VWAP indicator
//VWAP Inputs
vwapSource = input.source(defval = close, title = "VWAP Source", group = "VWAP Settings")
//Calculate Indicator
vwap = ta.vwap(vwapSource)
////EMA Indicator
//EMA Inputs
emaLength = input.int(defval = 555, title = "EMA Lenght", group = "EMA Settings")
emaSource = input.source(defval = close, title = "EMA Source", group = "EMA Settings")
//Calculate Indicator
ema = ta.ema(emaSource, emaLength)
////BB Indicator
//BB Inputs
bbSource = input.source(defval = close, title = "BBands Source", group = "Bollinger Bands Settings")
bbLength1 = input.int(defval = 20, title = "BBands Lenght 1", minval = 1, group = "BBands 1")
devUp1 = input.float(defval = 2, title = "BBands DevUp 1", minval = 1, step = 0.1, group = "BBands 1")
devDn1 = input.float(defval = 2, title = "BBands DevDown 1", minval = 1, step = 0.1, group = "BBands 1")
bbLength2 = input.int(defval = 10, title = "BBands Lenght 2", minval = 1, group = "BBands 2")
devUp2 = input.float(defval = 1.2, title = "BBands DevUp 2", minval = 1, step = 0.1, group = "BBands 2")
devDn2 = input.float(defval = 1.2, title = "BBands DevDown 2", minval = 1, step = 0.1, group = "BBands 2")
/////////Additional MA
// TEMA
tema(src, length) =>
v2 = ta.ema(src, length)
v = 3 * (v2 - ta.ema(v2, length)) + ta.ema(ta.ema(v2, length), length) // Triple Exponential
v
// KAMA
kama(src, length) =>
k = 0.0
volatility = math.sum(math.abs(src-src[1]), length)
change = math.abs(src-src[length-1])
er = volatility != 0 ? change/volatility : 0
sc = math.pow((er*(0.666666-0.064516))+0.064516, 2)
k := nz(k[1])+(sc*(hl2-nz(k[1])))
k
// TRIMA
trima(src, length) =>
trima = ta.sma(ta.sma(src, math.ceil(length / 2)), math.floor(length / 2) + 1)
trima
//DEMA
dema(src, length) =>
e1 = ta.ema(src, length)
e2 = ta.ema(e1, length)
dema = 2 * e1 - e2
dema
//MA Switcher
maType = input.string(defval = "SMA", title = "BBands MA Type", options = ["EMA", "SMA", "VWMA", "WMA", "TRIMA", "HMA", "KAMA", "TEMA", "DEMA"], group = "Bollinger Bands Settings")
getMA(src, length) =>
ma = float(na)
if maType == "EMA"
ma := ta.ema(src, length)
if maType == "SMA"
ma := ta.sma(src, length)
if maType == "VWMA"
ma := ta.vwma(src, length)
if maType == "WMA"
ma := ta.wma(src, length)
if maType == "TRIMA"
ma := trima(src, length)
if maType == "HMA"
ma := ta.hma(src, length)
if maType == "KAMA"
ma := kama(src, length)
if maType == "T3"
ma := tema(src, length)
if maType == "DEMA"
ma := dema(src, length)
ma
//Calculate BB Indicator
middleLine1 = getMA(bbSource, bbLength1)
upperBand1 = (middleLine1 + (devUp1 * (ta.stdev(bbSource, bbLength1))))
lowerBand1 = (middleLine1 - (devDn1 * (ta.stdev(bbSource, bbLength1))))
middleLine2 = getMA(bbSource, bbLength2)
upperBand2 = (middleLine2 + (devUp2 * (ta.stdev(bbSource, bbLength2))))
lowerBand2 = (middleLine2 - (devDn2 * (ta.stdev(bbSource, bbLength2))))
upperBandDifference = upperBand1 - upperBand2
maxDifference = 100
ratio = 100 - (100 * (upperBandDifference / maxDifference))
////Condition Logic
VWAP_condition = vwapSource > vwap
EMA_condition = emaSource > ema
above95 = ratio > 89
closeAboveBothUpperBands = bbSource > upperBand1 and bbSource > upperBand2
entryCondition = above95 and VWAP_condition and EMA_condition and closeAboveBothUpperBands
exitConditionRegular = (upperBand2 - bbSource) / bbSource > 0.006
//Define position direction
isLong = strategy.position_size > 0
isShort = strategy.position_size < 0
noPosition = strategy.position_size == 0
//Strategy Entries
if entryCondition and (inSession or not useSession) and noPosition and (barstate.isconfirmed or not disableRepainting)
strategy.entry("Long", strategy.long)
if exitConditionRegular and (inSession or not useSession) and isLong and (barstate.isconfirmed or not disableRepainting)
strategy.close("Long")
if outSession and closeEverything
strategy.cancel_all()
strategy.close_all()