Helium V 6.4.2 US30
Helium V 6.4.2 US30
var tb = table.new(position.top_right, 5, 6
, bgcolor = #1e222d
, border_color = #373a46
, border_width = 1
, frame_color = #373a46
, frame_width = 1)
if isMarketOpen
table.cell(tb, 0, 0, 'Helium 🎈\n🟢Online\n'+"💸PNL:
"+str.tostring(strategy.openprofit), text_color = color.white, text_size =
size.normal)
else
table.cell(tb, 0, 0, 'Helium 🎈\n🔴Offline\n'+"💸PNL:
"+str.tostring(strategy.openprofit), text_color = color.white, text_size =
size.normal)
table.merge_cells(tb, 0, 0, 4, 0)
sensitivity = input.string("Low", "Sensitivity", ["Low", "Medium", "High",
"Custom"])
sensitivty_custom = input.float(0.00, "Custom sensitivity value",step=0.01,
minval=0, maxval=10)
suppRes = input.bool(false, "Support & Resistance")
breaks = input.bool(false, "Breaks")
usePsar = input.bool(false, "PSAR")
emaEnergy = input.bool(true, "EMA Energy")
channelBal = input.bool(true, "Channel Balance")
autoTL = input.bool(false, "Auto Trend Lines")
// Functions
supertrend(_src, factor, atrLen) =>
atr = ta.atr(atrLen)
upperBand = _src + factor * atr
lowerBand = _src - factor * atr
prevLowerBand = nz(lowerBand[1])
prevUpperBand = nz(upperBand[1])
lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ?
lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ?
upperBand : prevUpperBand
int direction = na
float superTrend = na
prevSuperTrend = superTrend[1]
if na(atr[1])
direction := 1
else if prevSuperTrend == prevUpperBand
direction := close > upperBand ? -1 : 1
else
direction := close < lowerBand ? 1 : -1
superTrend := direction == -1 ? lowerBand : upperBand
[superTrend, direction]
lr_slope(_src, _len) =>
x = 0.0, y = 0.0, x2 = 0.0, xy = 0.0
for i = 0 to _len - 1
val = _src[i]
per = i + 1
x += per
y += val
x2 += per * per
xy += val * per
_slp = (_len * xy - x * y) / (_len * x2 - x * x)
_avg = y / _len
_int = _avg - _slp * x / _len + _slp
[_slp, _avg, _int]
lr_dev(_src, _len, _slp, _avg, _int) =>
upDev = 0.0, dnDev = 0.0
val = _int
for j = 0 to _len - 1
price = high[j] - val
if price > upDev
upDev := price
price := val - low[j]
if price > dnDev
dnDev := price
price := _src[j]
val += _slp
[upDev, dnDev]
// Get Components
ocAvg = math.avg(open, close)
sma1 = ta.sma(close, 5)
sma2 = ta.sma(close, 6)
sma3 = ta.sma(close, 7)
sma4 = ta.sma(close, 8)
sma5 = ta.sma(close, 9)
sma6 = ta.sma(close, 10)
sma7 = ta.sma(close, 11)
sma8 = ta.sma(close, 12)
sma9 = ta.sma(close, 13)
sma10 = ta.sma(close, 14)
sma11 = ta.sma(close, 15)
sma12 = ta.sma(close, 16)
sma13 = ta.sma(close, 17)
sma14 = ta.sma(close, 18)
sma15 = ta.sma(close, 19)
sma16 = ta.sma(close, 20)
psar = ta.sar(0.09, 0.11, 1)
[middleKC1, upperKC1, lowerKC1] = ta.kc(close, 80, 10.5)
[middleKC2, upperKC2, lowerKC2] = ta.kc(close, 80, 9.5)
// Calculate Keltner Channels with different parameters
[middleKC3, upperKC3, lowerKC3] = ta.kc(close, 80, 8)
[middleKC4, upperKC4, lowerKC4] = ta.kc(close, 80, 3)
// Calculate VWAP
vwap = ta.vwap(close)
if isMarketOpen
if bull and not na(buy) and not alertTriggered
if reverse
strategy.entry("Sell", strategy.short)
else
strategy.entry("Buy @"+str.tostring(close), strategy.long)
alert("New Buy Label Created @ "+str.tostring(close),
alert.freq_once_per_bar_close)
alertTriggered := true
else if not bull
alertTriggered := false
if bear and not na(sell) and not alertTriggered
if reverse
strategy.entry("Buy @"+str.tostring(close), strategy.long)
else
strategy.entry("Sell @"+str.tostring(close), strategy.short)
alert("New Sell Label Created @"+str.tostring(close),
alert.freq_once_per_bar_close)
alertTriggered := true
else if not bear
alertTriggered := false
else
if not swinging_allowed
strategy.close_all("EOD")
// Plot Pivot High and Pivot Low
plot(pivotHigh, "Resistance", not suppRes or ta.change(pivotHigh) ? na : red, 2,
offset=-(barsR + 1), editable=false)
plot(pivotLow, "Support", not suppRes or ta.change(pivotLow) ? na : green, 2,
offset=-(barsR + 1), editable=false)