04 pivoti: reparate 6 defecte, plus o eroare de sens preluata din harvest
Verificare independenta fata de harvest/ si transcrieri. Toate punctele confirmate in surse inainte de reparatie, niciunul contestat. Conținut: - citat compus cu sensul rasturnat, scos: documentul ii punea in gura "rejectat sub pivotul de an, asta nu-mi place". In transcriere, la 25.08 el spune despre exact acea situatie "asta imi place"; "nu-mi place" e din 29.07 si e despre volumul in distributie negativa. Coloana NU are acum un citat real, din 03.09, iar 29.07 e adaugata la Surse. - "timeframe-urile instituționale" sunt, la el, monthly si weekly (04.09, citat), nu quarterly si anual. Documentul 05 le definea deja corect, deci cele doua se contraziceau. - pasajul despre wedge nu mai e prezentat ca regula explicita: el vrea volum mai mare, iar breakout-ul masiv il leaga de reintrarea in MBT-10. - "proiectie neutra": imperativul "trateaza-le la fel" a devenit deducție marcata, si indicatia e declarata in completari, nu doar legatura. EROARE IN SURSA, gasita pe drum: harvest/2026-08-25.md l.15 da ca Trigger NU "pretul ramane sub pivotul de an (reject)", dar in transcriere (l.9) el zice "Reject-a si sub pivotul de an, stochasticul s-a dus aproape de oversold, asta imi place". Rescris dupa transcriere, cu nota in Surse ca recolta greseste acolo. Distinctia reala e stochasticul: sub pivotul de an cu oversold ii place, cu overbought e semnal contra (02.09). Desen: - svg9: toate cele patru etichete de swing stateau SUB linia pivotului desi candelele erau deasupra - exact pe dos fata de regula pe care o ilustrau. - svg10: etichetele din dreapta erau decalate cu o poziție fata de liniile lor. Cauza era in spread() din PChart: SMA-20 se termina exact pe linia pivot Q3 si impingerea mergea doar in jos, deci fiecare eticheta de sub ea aluneca. Acum etichetele care se ating se asaza centrat in jurul poziției lor naturale, iar peste 3px de linia lor PChart trage o linie de legatura. Semnatura si interfata clasei sunt neschimbate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MtSTyTmt6AbCL9j5ajEDm1
This commit is contained in:
@@ -39,12 +39,16 @@ class Seg:
|
||||
|
||||
def spread(items, gap=14):
|
||||
"""[(y, ...)] -> aceleași, cu y-urile împinse ca două etichete să nu se atingă"""
|
||||
items = sorted(items, key=lambda t: t[0])
|
||||
out = []
|
||||
for it in items:
|
||||
y = it[0] if not out else max(it[0], out[-1][0] + gap)
|
||||
out.append((y,) + tuple(it[1:]))
|
||||
return out
|
||||
# grupurile care se ating se centrează pe media pozițiilor naturale (nu doar împinse în jos),
|
||||
# altfel o etichetă care coincide cu linia de deasupra decalează toate etichetele de sub ea
|
||||
groups = [] # [start_y, [items]]
|
||||
for it in sorted(items, key=lambda t: t[0]):
|
||||
groups.append([it[0], [it]])
|
||||
while len(groups) > 1 and groups[-2][0] + gap * len(groups[-2][1]) > groups[-1][0]:
|
||||
last = groups.pop()
|
||||
its = groups[-1][1] + last[1]
|
||||
groups[-1] = [sum(t[0] - gap * k for k, t in enumerate(its)) / len(its), its]
|
||||
return [(g[0] + gap * k,) + tuple(t[1:]) for g in groups for k, t in enumerate(g[1])]
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -89,6 +93,10 @@ class PChart(Chart):
|
||||
for m in saved_ma if m.text]
|
||||
placed = {id(s): y for y, s in spread(out_lab)}
|
||||
placed.update({id(s): y for y, s in spread([(self._y(s.price) + 4, s) for s in segs if s.label_at == "lm"])})
|
||||
for y, s in out_lab: # etichetă mutată de pe linia ei: legătură scurtă până la ea
|
||||
if abs(placed[id(s)] - y) > 3:
|
||||
extra.append(f'<line x1="{xr - 6:.1f}" y1="{y - 4:.1f}" x2="{xr - 1:.1f}" '
|
||||
f'y2="{placed[id(s)] - 4:.1f}" stroke="{s.color}" stroke-width="1"/>')
|
||||
for s in segs:
|
||||
x0, x1, y = self._cx(s.i0) - self.gap / 2, self._cx(s.i1) + self.gap / 2, self._y(s.price)
|
||||
dash = f' stroke-dasharray="{s.dash}"' if s.dash else ""
|
||||
@@ -397,7 +405,7 @@ ch = PChart(candles=cds,
|
||||
Level(entry, f"intrare {f2(entry)}", GREEN, label_at="left"),
|
||||
Level(tp, f"TP {f2(tp)} = 2R", BLUE, label_at="left")],
|
||||
marks=[Mark(4, "pullback", GRAY, "below", dy=8),
|
||||
Mark(14, "5 rejecturi deasupra pivotului", ORANGE, "below", dy=18),
|
||||
Mark(14, "5 rejecturi", ORANGE, "above", dy=-16),
|
||||
Mark(BD, "buy doji", GREEN, "above", dy=-4),
|
||||
Mark(hit, "TP", BLUE, "above")],
|
||||
scale=22, pad_bot_px=14, title="Exemplu construit (fără ticker) — weekly, pivot quarterly",
|
||||
@@ -443,7 +451,7 @@ ch = PChart(candles=cds,
|
||||
Level(PQ, f"pivot quarterly {PQ:.2f}", PURPLE, label_at="right"),
|
||||
Level(sl, f"SL {f2(sl)}", RED, label_at="right")],
|
||||
marks=[Mark(6, "reject sub pivot: NU", RED, "above", dy=-16),
|
||||
Mark(HM, "hammer", PURPLE, "below", dy=8),
|
||||
Mark(HM, "hammer", PURPLE, "below", dy=0),
|
||||
Mark(BD, "buy doji", GREEN, "above", dy=-6)],
|
||||
scale=26, pad_bot_px=12, vol_h=70, title="Exemplu construit (fără ticker) — daily",
|
||||
caption="Nu cumperi rejectul de sub pivotul monthly. Cumperi mai jos, în pivotul quarterly.", **STYLE)
|
||||
@@ -483,9 +491,8 @@ ch = PChart(candles=cds,
|
||||
Level(entry, f"intrare {f2(entry)}", GREEN, label_at="right"),
|
||||
Level(tp, f"TP {f2(tp)} = 2R", BLUE, label_at="left")],
|
||||
marks=[Mark(3, "downtrend", GRAY, "above", dy=-10),
|
||||
Mark(14, "5 rejecturi sub pivot", RED, "above", dy=-40),
|
||||
Mark(DJ, "doji peste", "#333", "below", dy=4),
|
||||
Mark(BD, "buy doji", GREEN, "above", dy=-4)],
|
||||
Mark(12, "5 rejecturi sub pivot", RED, "above", dy=-40),
|
||||
Mark(BD, "doji + buy doji", GREEN, "above", dy=-4)],
|
||||
scale=24, title="Exemplu construit (fără ticker) — weekly, pivot quarterly",
|
||||
caption="Cinci respingeri, apoi două close-uri peste pivot și buy doji: acum pivotul e suport.", **STYLE)
|
||||
svg_ = ch.render()
|
||||
@@ -532,10 +539,10 @@ ch = PChart(candles=cds,
|
||||
Seg(Q, 2 * Q - 1, p2["P"], f"pivot Q2 {f2(p2['P'])}", ORANGE, "left", 14),
|
||||
Seg(2 * Q, 38, p3["P"], f"pivot Q3 {f2(p3['P'])}", ORANGE)],
|
||||
seps=[Q, 2 * Q],
|
||||
marks=[Mark(lows[0], "low", RED, "below", dy=8),
|
||||
Mark(lows[1], "HL", GREEN, "below", dy=22),
|
||||
Mark(lows[2], "HL", GREEN, "below", dy=30),
|
||||
Mark(lows[3], "HL", GREEN, "below", dy=14),
|
||||
marks=[Mark(lows[0], "low", RED, "above", dy=-2),
|
||||
Mark(lows[1], "HL", GREEN, "above", dy=-2),
|
||||
Mark(lows[2], "HL", GREEN, "above", dy=-2),
|
||||
Mark(lows[3], "HL", GREEN, "above", dy=-2),
|
||||
Mark(hh[1], "vârf Q2", BLUE, "above"),
|
||||
Mark(brk, "breakout", GREEN, "above", dy=-4)],
|
||||
mas=[MA(20, GRAY, dash="4 3", text="SMA-20")],
|
||||
|
||||
Reference in New Issue
Block a user