One day I was going threw Instagram watching trading strategy making them into indicator to see if it's profitable and see if it's true what they promised I only short back test long forward test all failed accept one structure and price accepts pure price action I can't really explain it here the guy I got from explain it better then I can so took couple of his videos trans script it put it into Claude ai made couple edits while I was trading the system to point I'm happy with it dm me if you want the code unfortunately I don't not pay for TV I use the free I also made it for mt5 that's what I trade on every thing is free I don't charge on what I create especially when I didn't pay for the strategy or if it's some else strategy the createtor of the strategy Instagram is forex_cheatcodes my trading that works for me is the hour timeframe using his method and I don't use risk to reward I take 2 trades a day in the morning and at night or morning and afternoon when the market reopen morning trades I target the close gray line or until four clock close the trade same night trade close line same for after noon closes line the only time I stay in trade is when I'm watching it and move my stop loss in profits I always put my stop in profit I have originally stop loss the always move it into profit that way if it reversed full reverse I still made money you still lose money if you move stop loss to break even because you still pay commission those commissions add up they small depending on lot size but you still losing when you break even I rather win small amount to grow my account bigger then break even we trade to make profit and remember any trading system is not guaranteed to make money I'm not a financial I'm just sharing my journey you can lose all money always practice and fully understand any system before using real money I'm not liable for your losses or wins using my indicator it's for educational purpose. //@version=6
// LQ Swing Levels H4 v1.40 (Pine v6)
// Liquidity lines only. 4 Hour swing levels. 1 Hour acceptance.
// Swept / accepted lines deleted, or kept gray (setting).
// Same lines on every chart timeframe (1m up to 1D and above).
// Alerts fire only when a new line prints.
indicator("LQ Swing H4", overlay = true, max_lines_count = 500, max_labels_count = 500, max_bars_back = 500)
//=========================== INPUTS =================================
G1 = "4 Hour Levels"
objTf = input.timeframe("240", "Levels TF", group = G1)
accTf = input.timeframe("60", "Acceptance TF (deletes swept / accepted lines)", group = G1)
piv = input.int(3, "Swing length", minval = 2, group = G1)
maxLv = input.int(4, "Lines kept per side", minval = 1, maxval = 20, group = G1)
accBufM = input.float(0.15, "Acceptance buffer (ATR x)", step = 0.05, group = G1)
lw = input.int(3, "Line width", minval = 1, maxval = 5, group = G1)
cHigh = input.color(color.red, "High line", group = G1)
cLow = input.color(color.lime, "Low line", group = G1)
alertOn = input.bool(true, "Alert on new lines", group = G1)
keepOld = input.bool(false, "Keep old lines (swept / accepted) on chart", group = G1)
GV = "Visuals"
cDone = input.color(color.gray, "Old line color (swept / accepted)", group = GV)
oldMax = input.int(4, "Old lines kept per side", minval = 1, maxval = 20, group = GV)
bgOn = input.bool(true, "Tint background by H4 trend", group = GV)
cBgBull = input.color(color.new(color.rgb(10, 45, 45), 40), "Background bullish", group = GV)
cBgBear = input.color(color.new(color.rgb(55, 15, 15), 40), "Background bearish", group = GV)
showPanel = input.bool(true, "Show trend panel", group = GV)
fontIn = input.string("Small", "Label size", options = ["Tiny", "Small", "Normal"], group = GV)
ATR_LEN = 14
lblSize = fontIn == "Tiny" ? size.tiny : fontIn == "Normal" ? size.normal : size.small
objMs = timeframe.in_seconds(objTf) * 1000
accMs = timeframe.in_seconds(accTf) * 1000
chartS = timeframe.in_seconds()
// chart above the levels / acceptance TF: read every intrabar so nothing is skipped
lowerObj = chartS > timeframe.in_seconds(objTf)
lowerAcc = chartS > timeframe.in_seconds(accTf)
//=========================== TYPES / HELPERS ========================
type Level
float price
line ln
label lb
string when
f_tfName(string tf) =>
string r = tf
if tf == "D" or tf == "1D"
r := "D1"
else if tf == "W" or tf == "1W"
r := "W1"
else if not na(str.tonumber(tf))
float n = str.tonumber(tf)
r := n % 60 == 0 ? "H" + str.tostring(n / 60) : "M" + tf
r
NM = f_tfName(objTf)
f_px(float p) => str.tostring(p, format.mintick)
f_tag(int t) => str.format_time(t, "yyyy.MM.dd HH:mm", syminfo.timezone)
// Levels TF: pivot confirmed on this bar, swing time, trend, bar time
f_obj(int pl) =>
float hc = high[pl]
float lc = low[pl]
bool isH = bar_index >= 2 * pl
bool isL = isH
for k = 1 to pl
if high[pl + k] >= hc or high[pl - k] > hc
isH := false
if low[pl + k] <= lc or low[pl - k] < lc
isL := false
var float lastH = na
var float lastL = na
var int trend = 0
if isH
lastH := hc
if isL
lastL := lc
if not na(lastH) and close > lastH
trend := 1
else if not na(lastL) and close < lastL
trend := -1
float phv = isH ? hc : na
float plv = isL ? lc : na
int pt = time[pl]
[phv, plv, pt, trend, time]
// last CLOSED levels bar (no repaint)
f_objPrev(int pl) =>
[a, b, c, d, e] = f_obj(pl)
[a[1], b[1], c[1], d[1], e[1]]
f_acc() =>
[high, low, close, ta.atr(ATR_LEN), time]
f_accPrev() =>
[h, l, c, a, t] = f_acc()
[h[1], l[1], c[1], a[1], t[1]]
//=========================== STATE ==================================
var array<Level> highs = array.new<Level>()
var array<Level> lows = array.new<Level>()
var array<Level> oldHighs = array.new<Level>()
var array<Level> oldLows = array.new<Level>()
var int trendNow = 0
f_add(array<Level> arr, float p, int t, bool isHigh, float tol) =>
bool dup = false
for lv in arr
if math.abs(lv.price - p) <= tol
dup := true
if not dup
color col = isHigh ? cHigh : cLow
string when = f_tag(t)
line ln = line.new(t, p, t + objMs, p, xloc.bar_time, extend.right, col, line.style_solid, lw)
label lb = label.new(bar_index, p, NM + (isHigh ? " HIGH " : " LOW ") + f_px(p) + " | " + when, xloc.bar_index, yloc.price, color(na), label.style_label_lower_left, col, lblSize)
arr.push(Level.new(p, ln, lb, when))
if arr.size() > maxLv
Level o = arr.shift()
line.delete(o.ln)
label.delete(o.lb)
not dup
// swept / accepted: delete, or keep gray and dashed
f_retire(array<Level> arr, int idx, array<Level> old, string txt) =>
Level lv = arr.remove(idx)
if keepOld
line.set_style(lv.ln, line.style_dashed)
line.set_width(lv.ln, 1)
line.set_color(lv.ln, cDone)
label.set_text(lv.lb, NM + " " + txt + " " + f_px(lv.price) + " | " + lv.when)
label.set_textcolor(lv.lb, cDone)
old.push(lv)
if old.size() > oldMax
Level o = old.shift()
line.delete(o.ln)
label.delete(o.lb)
else
line.delete(lv.ln)
label.delete(lv.lb)
true
f_checkAcc(float h1, float l1, float c1, float atr1) =>
float buf = nz(atr1) * accBufM
if highs.size() > 0
for i = highs.size() - 1 to 0
float p = highs.get(i).price
if h1 > p and c1 < p
f_retire(highs, i, oldHighs, "SWEPT")
else if c1 > p + buf
f_retire(highs, i, oldHighs, "ACCEPTED ABOVE")
if lows.size() > 0
for i = lows.size() - 1 to 0
float p = lows.get(i).price
if l1 < p and c1 > p
f_retire(lows, i, oldLows, "SWEPT")
else if c1 < p - buf
f_retire(lows, i, oldLows, "ACCEPTED BELOW")
true
f_moveLabels(array<Level> arr, int x) =>
for lv in arr
label.set_x(lv.lb, x)
//=========================== DATA ===================================
[sPH, sPL, sPT, sTR, sOT] = request.security(syminfo.tickerid, objTf, f_objPrev(piv), lookahead = barmerge.lookahead_on)
[sAH, sAL, sAC, sAA, sAT] = request.security(syminfo.tickerid, accTf, f_accPrev(), lookahead = barmerge.lookahead_on)
m1Atr = request.security(syminfo.tickerid, "1", ta.atr(ATR_LEN)[1], lookahead = barmerge.lookahead_on)
objNew = not na(sOT) and (na(sOT[1]) or sOT != sOT[1])
accNew = not na(sAT) and not na(sAT[1]) and sAT != sAT[1]
// duplicate filter: 0.25 x M1 ATR, same on every chart TF. Falls back to acceptance ATR.
float tol = not na(m1Atr) ? m1Atr * 0.25 : nz(sAA) * 0.05
// events closed during this chart bar, oldest first
ePH = array.new<float>()
ePL = array.new<float>()
ePT = array.new<int>()
eTR = array.new<int>()
eEnd = array.new<int>()
aH = array.new<float>()
aL = array.new<float>()
aC = array.new<float>()
aA = array.new<float>()
aEnd = array.new<int>()
if lowerObj
[xPH, xPL, xPT, xTR, xOT] = request.security_lower_tf(syminfo.tickerid, objTf, f_obj(piv))
int n = xOT.size()
int lim = barstate.isconfirmed ? n : n - 1 // skip the H4 bar still forming
if lim > 0
for i = 0 to lim - 1
ePH.push(xPH.get(i))
ePL.push(xPL.get(i))
ePT.push(xPT.get(i))
eTR.push(xTR.get(i))
eEnd.push(xOT.get(i) + objMs)
else if objNew
ePH.push(sPH)
ePL.push(sPL)
ePT.push(sPT)
eTR.push(sTR)
eEnd.push(sOT + objMs)
if lowerAcc
[yH, yL, yC, yA, yT] = request.security_lower_tf(syminfo.tickerid, accTf, f_acc())
int n = yT.size()
int lim = barstate.isconfirmed ? n : n - 1 // skip the 1H bar still forming
if lim > 0
for i = 0 to lim - 1
aH.push(yH.get(i))
aL.push(yL.get(i))
aC.push(yC.get(i))
aA.push(yA.get(i))
aEnd.push(yT.get(i) + accMs)
else if accNew
aH.push(sAH)
aL.push(sAL)
aC.push(sAC)
aA.push(sAA)
aEnd.push(sAT + accMs)
//=========================== PROCESS ================================
// acceptance bars that closed before each H4 close run first, then the new pivots print
int j = 0
if tol > 0
if eEnd.size() > 0
for k = 0 to eEnd.size() - 1
while j < aEnd.size() and aEnd.get(j) <= eEnd.get(k)
f_checkAcc(aH.get(j), aL.get(j), aC.get(j), aA.get(j))
j += 1
float ph = ePH.get(k)
float pl = ePL.get(k)
int pt = ePT.get(k)
if not na(ph)
if f_add(highs, ph, pt, true, tol) and alertOn
alert(syminfo.ticker + " LQ " + NM + ": new HIGH line printed at " + f_px(ph) + " (swing " + f_tag(pt) + ")", alert.freq_once_per_bar)
if not na(pl)
if f_add(lows, pl, pt, false, tol) and alertOn
alert(syminfo.ticker + " LQ " + NM + ": new LOW line printed at " + f_px(pl) + " (swing " + f_tag(pt) + ")", alert.freq_once_per_bar)
trendNow := eTR.get(k)
while j < aEnd.size()
f_checkAcc(aH.get(j), aL.get(j), aC.get(j), aA.get(j))
j += 1
//=========================== BACKGROUND =============================
bgcolor(bgOn ? (trendNow == 1 ? cBgBull : trendNow == -1 ? cBgBear : na) : na)
//=========================== LABELS + PANEL =========================
var table panel = table.new(position.top_right, 1, 2, bgcolor = color.new(color.black, 30), frame_color = color.gray, frame_width = 1)
if barstate.islast
f_moveLabels(highs, bar_index + 3)
f_moveLabels(lows, bar_index + 3)
f_moveLabels(oldHighs, bar_index + 3)
f_moveLabels(oldLows, bar_index + 3)
if showPanel
table.cell(panel, 0, 0, "LQ SWING LEVELS (H4)", text_color = color.white, text_size = lblSize, text_halign = text.align_left)
table.cell(panel, 0, 1, NM + " levels (" + f_tfName(accTf) + " acceptance): " + (trendNow == 1 ? "BULLISH" : trendNow == -1 ? "BEARISH" : "NEUTRAL"), text_color = color.white, text_size = lblSize, text_halign = text.align_left)