This commit is contained in:
wvr committed 2026-11-24 10:08:46 -06:00
1 parent 1492a2ef16
commit 4fc7931a39
2 files changed
+68 -58

No files matched your search

+68 -58
View File
@@ -344,60 +344,70 @@ nqEntry = pending ? (useNews ? "8:31 / 8:33 / 9:31 / 9:33" : "9:31 / 9:33") :
// ---------- display ----------
var table t = table.new(position.top_right, 13, 17, bgcolor = color.new(color.black, 15), border_width = 1)
grpD = "Display"
posIn = input.string("Top right", "Table position", options = ["Top right", "Top center", "Top left", "Middle right", "Middle center", "Middle left", "Bottom right", "Bottom center", "Bottom left"], group = grpD, display = display.none)
szMIn = input.string("Normal", "Text size: market rows", options = ["Tiny", "Small", "Normal", "Large", "Huge"], group = grpD, display = display.none)
szAIn = input.string("Small", "Text size: account rows and notes", options = ["Tiny", "Small", "Normal", "Large", "Huge"], group = grpD, display = display.none)
alIn = input.string("Center", "Text alignment", options = ["Center", "Left", "Right"], group = grpD, display = display.none)
toSize(string v) => v == "Tiny" ? size.tiny : v == "Small" ? size.small : v == "Large" ? size.large : v == "Huge" ? size.huge : size.normal
toPos(string v) => v == "Top center" ? position.top_center : v == "Top left" ? position.top_left : v == "Middle right" ? position.middle_right : v == "Middle center" ? position.middle_center : v == "Middle left" ? position.middle_left : v == "Bottom right" ? position.bottom_right : v == "Bottom center" ? position.bottom_center : v == "Bottom left" ? position.bottom_left : position.top_right
szMain = toSize(szMIn)
szAcc = toSize(szAIn)
hAl = alIn == "Left" ? text.align_left : alIn == "Right" ? text.align_right : text.align_center
var table t = table.new(toPos(posIn), 13, 17, bgcolor = color.new(color.black, 15), border_width = 1)
if barstate.islast
hdr = array.from("Market", "Entry (ET)", "Side", "Why", "ATR(14)", "Contracts", "Risk USD", "Reward USD", "Stop (pts)", "Target (pts)")
for i = 0 to 9
table.cell(t, i, 0, hdr.get(i), text_color = color.white, bgcolor = color.new(color.gray, 60))
table.cell(t, i, 0, hdr.get(i), text_color = color.white, bgcolor = color.new(color.gray, 60), text_size = szMain, text_halign = hAl)
table.cell(t, 0, 1, "Gold", text_color = color.white)
table.cell(t, 1, 1, "8:21", text_color = color.white)
table.cell(t, 2, 1, sideText(goldDir), text_color = sideColor(goldDir))
table.cell(t, 0, 1, "Gold", text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 1, 1, "8:21", text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 2, 1, sideText(goldDir), text_color = sideColor(goldDir), text_size = szMain, text_halign = hAl)
table.cell(t, 3, 1, goldDone ? "locked at 8:19: gap " + num(goldGap) + "% vs " + num(thr) + "% (" + thrSrc + ")" :
"waiting for 8:19 | live gap " + num(gap) + "% vs " + num(useAuto and not na(aThr) and not autoBad ? aThr : thrInput) + "%", text_color = color.white)
table.cell(t, 4, 1, num(gcAtr), text_color = color.white)
table.cell(t, 5, 1, str.tostring(gcN) + (gcMicro ? " MGC" : ""), text_color = gcMicro ? color.yellow : color.white)
table.cell(t, 6, 1, usd(gcRiskUsd), text_color = color.red)
table.cell(t, 7, 1, usd(gcRewUsd), text_color = color.lime)
table.cell(t, 8, 1, pts(gcSp), text_color = color.new(color.red, 40))
table.cell(t, 9, 1, pts(gcTp), text_color = color.new(color.lime, 40))
"waiting for 8:19 | live gap " + num(gap) + "% vs " + num(useAuto and not na(aThr) and not autoBad ? aThr : thrInput) + "%", text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 4, 1, num(gcAtr), text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 5, 1, str.tostring(gcN) + (gcMicro ? " MGC" : ""), text_color = gcMicro ? color.yellow : color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 6, 1, usd(gcRiskUsd), text_color = color.red, text_size = szMain, text_halign = hAl)
table.cell(t, 7, 1, usd(gcRewUsd), text_color = color.lime, text_size = szMain, text_halign = hAl)
table.cell(t, 8, 1, pts(gcSp), text_color = color.new(color.red, 40), text_size = szMain, text_halign = hAl)
table.cell(t, 9, 1, pts(gcTp), text_color = color.new(color.lime, 40), text_size = szMain, text_halign = hAl)
table.cell(t, 0, 2, "Crude", text_color = color.white)
table.cell(t, 1, 2, "9:01", text_color = color.white)
table.cell(t, 2, 2, sideText(clDir), text_color = sideColor(clDir))
table.cell(t, 3, 2, "yesterday: settle " + num(clSettle) + " vs 9:00 close " + num(clOpen), text_color = color.white)
table.cell(t, 4, 2, num(clAtr), text_color = color.white)
table.cell(t, 5, 2, str.tostring(clN) + (clMicro ? " MCL" : ""), text_color = clMicro ? color.yellow : color.white)
table.cell(t, 6, 2, usd(clRiskUsd), text_color = color.red)
table.cell(t, 7, 2, usd(clRewUsd), text_color = color.lime)
table.cell(t, 8, 2, pts(clSp), text_color = color.new(color.red, 40))
table.cell(t, 9, 2, pts(clTp), text_color = color.new(color.lime, 40))
table.cell(t, 0, 2, "Crude", text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 1, 2, "9:01", text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 2, 2, sideText(clDir), text_color = sideColor(clDir), text_size = szMain, text_halign = hAl)
table.cell(t, 3, 2, "yesterday: settle " + num(clSettle) + " vs 9:00 close " + num(clOpen), text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 4, 2, num(clAtr), text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 5, 2, str.tostring(clN) + (clMicro ? " MCL" : ""), text_color = clMicro ? color.yellow : color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 6, 2, usd(clRiskUsd), text_color = color.red, text_size = szMain, text_halign = hAl)
table.cell(t, 7, 2, usd(clRewUsd), text_color = color.lime, text_size = szMain, text_halign = hAl)
table.cell(t, 8, 2, pts(clSp), text_color = color.new(color.red, 40), text_size = szMain, text_halign = hAl)
table.cell(t, 9, 2, pts(clTp), text_color = color.new(color.lime, 40), text_size = szMain, text_halign = hAl)
table.cell(t, 0, 3, "Nat gas", text_color = color.white)
table.cell(t, 1, 3, "6:01 pm (prev. eve)", text_color = color.white)
table.cell(t, 2, 3, sideText(clDir), text_color = sideColor(clDir))
table.cell(t, 3, 3, "crude's side for the trading day that opens at 6 pm (no hedging)", text_color = color.white)
table.cell(t, 4, 3, num(ngAtr), text_color = color.white)
table.cell(t, 5, 3, str.tostring(ngN) + (ngMicro ? " QG" : ""), text_color = ngMicro ? color.yellow : color.white)
table.cell(t, 6, 3, usd(ngRiskUsd), text_color = color.red)
table.cell(t, 7, 3, usd(ngRewUsd), text_color = color.lime)
table.cell(t, 8, 3, pts(ngSp), text_color = color.new(color.red, 40))
table.cell(t, 9, 3, pts(ngTp), text_color = color.new(color.lime, 40))
table.cell(t, 0, 3, "Nat gas", text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 1, 3, "6:01 pm (prev. eve)", text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 2, 3, sideText(clDir), text_color = sideColor(clDir), text_size = szMain, text_halign = hAl)
table.cell(t, 3, 3, "crude's side for the trading day that opens at 6 pm (no hedging)", text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 4, 3, num(ngAtr), text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 5, 3, str.tostring(ngN) + (ngMicro ? " QG" : ""), text_color = ngMicro ? color.yellow : color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 6, 3, usd(ngRiskUsd), text_color = color.red, text_size = szMain, text_halign = hAl)
table.cell(t, 7, 3, usd(ngRewUsd), text_color = color.lime, text_size = szMain, text_halign = hAl)
table.cell(t, 8, 3, pts(ngSp), text_color = color.new(color.red, 40), text_size = szMain, text_halign = hAl)
table.cell(t, 9, 3, pts(ngTp), text_color = color.new(color.lime, 40), text_size = szMain, text_halign = hAl)
table.cell(t, 0, 4, "NQ", text_color = color.white)
table.cell(t, 1, 4, nqEntry, text_color = color.white)
table.cell(t, 2, 4, sideText(nqDir), text_color = sideColor(nqDir))
table.cell(t, 3, 4, nqBranch, text_color = color.white)
table.cell(t, 4, 4, num(nqAtr), text_color = color.white)
table.cell(t, 5, 4, str.tostring(nqN) + (nqMicro ? " MNQ" : ""), text_color = nqMicro ? color.yellow : color.white)
table.cell(t, 6, 4, usd(nqRiskUsd), text_color = color.red)
table.cell(t, 7, 4, usd(nqRewUsd), text_color = color.lime)
table.cell(t, 8, 4, pts(nqSp), text_color = color.new(color.red, 40))
table.cell(t, 9, 4, pts(nqTp), text_color = color.new(color.lime, 40))
table.cell(t, 0, 4, "NQ", text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 1, 4, nqEntry, text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 2, 4, sideText(nqDir), text_color = sideColor(nqDir), text_size = szMain, text_halign = hAl)
table.cell(t, 3, 4, nqBranch, text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 4, 4, num(nqAtr), text_color = color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 5, 4, str.tostring(nqN) + (nqMicro ? " MNQ" : ""), text_color = nqMicro ? color.yellow : color.white, text_size = szMain, text_halign = hAl)
table.cell(t, 6, 4, usd(nqRiskUsd), text_color = color.red, text_size = szMain, text_halign = hAl)
table.cell(t, 7, 4, usd(nqRewUsd), text_color = color.lime, text_size = szMain, text_halign = hAl)
table.cell(t, 8, 4, pts(nqSp), text_color = color.new(color.red, 40), text_size = szMain, text_halign = hAl)
table.cell(t, 9, 4, pts(nqTp), text_color = color.new(color.lime, 40), text_size = szMain, text_halign = hAl)
endTxt = not endOn ? "" : needUsd <= endThr ? "ENDGAME: needs " + usd(needUsd) + " -> 1:1 stop (" + usd(needUsd) + "). Set back to 0 for other accounts. " : "ENDGAME: needs " + usd(needUsd) + " -> target " + usd(needUsd) + ", stop all the room. Set back to 0 for other accounts. "
note = endTxt + "Stop = exactly the room (no cost allowance; a stop-out ends the account either way). Target includes commission. Type as shown. Yellow = micros. Per-account sizes: account rows below. Skip holidays and early closes."
table.cell(t, 0, 5, note, text_color = color.new(color.white, 30), text_size = size.small)
table.cell(t, 0, 5, note, text_color = color.new(color.white, 30), text_size = szAcc, text_halign = hAl)
table.merge_cells(t, 0, 5, 12, 5)
// ---------- account table (per-account sizing for manual trading) ----------
@@ -533,7 +543,7 @@ if barstate.islast
if barstate.islast and showAcct
hdr2 = array.from("#", "Account", "Market", "Stage", "Side", "Entry (ET)", "Risk USD", "Reward USD", "Contracts", "Stop (pts)", "Target (pts)", "Reward : risk", "Note")
for i = 0 to 12
table.cell(t, i, 6, hdr2.get(i), text_color = color.white, bgcolor = color.new(color.gray, 60), text_size = size.small)
table.cell(t, i, 6, hdr2.get(i), text_color = color.white, bgcolor = color.new(color.gray, 60), text_size = szAcc, text_halign = hAl)
int rr = 6
for k = 0 to 9
mk = aMkt.get(k)
@@ -623,21 +633,21 @@ if barstate.islast and showAcct
mic := m1
sfx = not mic ? "" : mk == "Gold" ? " MGC" : mk == "Crude" ? " MCL" : mk == "NQ" ? " MNQ" : " QG"
txt = bad ? color.gray : color.white
table.cell(t, 0, r, str.tostring(k + 1), text_color = color.white, text_size = size.small)
table.cell(t, 1, r, aName.get(k), text_color = color.white, text_size = size.small)
table.cell(t, 2, r, mk, text_color = color.white, text_size = size.small)
table.cell(t, 3, r, aSize.get(k) + " " + aStg.get(k), text_color = isF ? color.aqua : color.white, text_size = size.small)
table.cell(t, 4, r, bad ? "-" : sideText(side), text_color = bad ? color.gray : sideColor(side), text_size = size.small)
table.cell(t, 5, r, bad ? "-" : ent, text_color = txt, text_size = size.small)
table.cell(t, 6, r, bad ? "-" : usd(rU), text_color = bad ? color.gray : color.red, text_size = size.small)
table.cell(t, 7, r, bad ? "-" : usd(wU), text_color = bad ? color.gray : color.lime, text_size = size.small)
table.cell(t, 8, r, bad ? "-" : str.tostring(n) + sfx, text_color = mic ? color.yellow : txt, text_size = size.small)
table.cell(t, 9, r, bad ? "-" : pts(sp), text_color = bad ? color.gray : color.new(color.red, 40), text_size = size.small)
table.cell(t, 10, r, bad ? "-" : pts(tp), text_color = bad ? color.gray : color.new(color.lime, 40), text_size = size.small)
table.cell(t, 11, r, bad or na(rU) or rU <= 0 ? "-" : str.tostring(wU / rU, "#.##") + " : 1", text_color = txt, text_size = size.small)
table.cell(t, 12, r, note, text_color = bad ? color.orange : color.new(color.white, 30), text_size = size.small)
table.cell(t, 0, r, str.tostring(k + 1), text_color = color.white, text_size = szAcc, text_halign = hAl)
table.cell(t, 1, r, aName.get(k), text_color = color.white, text_size = szAcc, text_halign = hAl)
table.cell(t, 2, r, mk, text_color = color.white, text_size = szAcc, text_halign = hAl)
table.cell(t, 3, r, aSize.get(k) + " " + aStg.get(k), text_color = isF ? color.aqua : color.white, text_size = szAcc, text_halign = hAl)
table.cell(t, 4, r, bad ? "-" : sideText(side), text_color = bad ? color.gray : sideColor(side), text_size = szAcc, text_halign = hAl)
table.cell(t, 5, r, bad ? "-" : ent, text_color = txt, text_size = szAcc, text_halign = hAl)
table.cell(t, 6, r, bad ? "-" : usd(rU), text_color = bad ? color.gray : color.red, text_size = szAcc, text_halign = hAl)
table.cell(t, 7, r, bad ? "-" : usd(wU), text_color = bad ? color.gray : color.lime, text_size = szAcc, text_halign = hAl)
table.cell(t, 8, r, bad ? "-" : str.tostring(n) + sfx, text_color = mic ? color.yellow : txt, text_size = szAcc, text_halign = hAl)
table.cell(t, 9, r, bad ? "-" : pts(sp), text_color = bad ? color.gray : color.new(color.red, 40), text_size = szAcc, text_halign = hAl)
table.cell(t, 10, r, bad ? "-" : pts(tp), text_color = bad ? color.gray : color.new(color.lime, 40), text_size = szAcc, text_halign = hAl)
table.cell(t, 11, r, bad or na(rU) or rU <= 0 ? "-" : str.tostring(wU / rU, "#.##") + " : 1", text_color = txt, text_size = szAcc, text_halign = hAl)
table.cell(t, 12, r, note, text_color = bad ? color.orange : color.new(color.white, 30), text_size = szAcc, text_halign = hAl)
if rr == 6
table.cell(t, 0, 7, "No accounts entered: fill Account 1-10 in Settings (Market not Off).", text_color = color.new(color.white, 30), text_size = size.small)
table.cell(t, 0, 7, "No accounts entered: fill Account 1-10 in Settings (Market not Off).", text_color = color.new(color.white, 30), text_size = szAcc, text_halign = hAl)
table.merge_cells(t, 0, 7, 12, 7)
// ---------- alerts (set to "Once Per Bar") ----------