diff --git a/pine/bracket_morning_panel.pine b/pine/bracket_morning_panel.pine index fb2bf34..a3e738b 100644 --- a/pine/bracket_morning_panel.pine +++ b/pine/bracket_morning_panel.pine @@ -7,7 +7,8 @@ // NG (entry 6:01 pm, at the evening reopen, for the NEXT trading day): always the SAME side as crude // (energy group: opposite sides would be hedging). Crude's side for that day is already set by the 2:30 pm // settlement, so the panel shows it from 6:00 pm. Hold to the usual 4:40 pm exit next day. -// NQ News check first (8:31): news day = 8:30 candle volume >= 4.4x the average of the 8:15-8:29 candles. +// NQ (News-day rule below is OFF by default: it failed the 2010-14 holdout. NQ then always uses the normal-day rule.) +// News check first (8:31): news day = 8:30 candle volume >= 4.4x the average of the 8:15-8:29 candles. // News day: the 8:30 candle gets the same tests as the 9:30 one (first match wins): // a. Displacement (8:31): body >= 30% of the 8:30 candle's range, wick against <= 15% -> follow the candle. // b. Drive (8:33): 8:29 close -> 8:32 close move >= 5% of daily ATR(14), given back <= 25% from the 8:30-8:32 @@ -48,6 +49,7 @@ thrInput = input.float(0.99, "Fallback threshold (%)", step = 0.01, group = grpG lookback = input.int(250, "Median lookback (trading days)", minval = 20, group = grpG, display = display.none) minDays = input.int(60, "Days before using the live median", minval = 10, group = grpG, display = display.none) +useNews = input.bool(false, "NQ news-day rule (8:30 trades)", tooltip = "OFF (default): NQ always trades the normal-day rule at 9:31 / 9:33. The news-day rule failed the 2010-14 holdout test. ON only for testing.", display = display.none) newsThr = input.float(4.4, "NQ news day: 8:30 volume vs 8:15-8:29 average (x)", step = 0.1, display = display.none) grpS = "Sizing (defaults = fresh evaluation, daily loss limit OFF)" @@ -271,21 +273,22 @@ hBranch = not nqDone1 ? "waiting for the 9:30 candle" : nqDisp != 0 ? "1. displa hEntry = nqDisp != 0 ? "9:31" : nqDone1 ? "9:33" : "9:31 / 9:33" // news day (8:30 window) -news = nwDone and not na(nwRatio) and nwRatio >= newsThr +newsSeen = nwDone and not na(nwRatio) and nwRatio >= newsThr // shown for information +news = useNews and newsSeen [aDrive, aMv, aPull] = driveOf(a3, aPre, aC3, aHi, aLo, nqAtr) newsSig = aDisp != 0 ? aDisp : not a3 ? 0 : aDrive != 0 ? aDrive : aThree newsWait = news and aDisp == 0 and not a3 // 8:31-8:32: waiting for the 8:32 candle newsTrade = news and newsSig != 0 -pending = not nwDone and not nqDone1 // before 8:31 (no 8:30 data -> treated as a normal day at 9:31) +pending = useNews ? not nwDone and not nqDone1 : not nqDone1 // news rule off: just wait for the 9:30 candle nqDir = pending or newsWait ? 0 : newsTrade ? newsSig : hDir -tag = not nwDone ? "" : (news ? "NEWS DAY" : "normal day") + " (8:30 volume " + num(nwRatio) + "x vs " + num(newsThr) + "x): " -nqBranch = pending ? "waiting for the 8:30 candle (news check at 8:31)" : +tag = not useNews ? "" : not nwDone ? "" : (news ? "NEWS DAY" : "normal day") + " (8:30 volume " + num(nwRatio) + "x vs " + num(newsThr) + "x): " +nqBranch = pending ? (useNews ? "waiting for the 8:30 candle (news check at 8:31)" : "waiting for the 9:30 candle") : newsWait ? tag + "no 8:30 displacement; waiting for the 8:32 candle" : newsTrade ? tag + (aDisp != 0 ? "a. 8:30 displacement -> follow" : aDrive != 0 ? "b. 8:30 drive " + num(aMv) + " pts from 8:29 (min " + num(0.05 * nqAtr) + "), gave back " + num(aPull) + " -> follow" : "c. 8:30 three candles same way -> follow") : tag + (news ? "no 8:30 signal -> normal rule: " : "") + hBranch -nqEntry = pending ? "8:31 / 8:33 / 9:31 / 9:33" : newsWait ? "8:33 (or 9:31 / 9:33)" : newsTrade ? (aDisp != 0 ? "8:31" : "8:33") : hEntry +nqEntry = pending ? (useNews ? "8:31 / 8:33 / 9:31 / 9:33" : "9:31 / 9:33") : newsWait ? "8:33 (or 9:31 / 9:33)" : newsTrade ? (aDisp != 0 ? "8:31" : "8:33") : hEntry // ---------- sizing ---------- [gcN, gcSp, gcTp, gcRiskUsd, gcRewUsd, gcMicro] = sizeFor(gcAtr, gcPv, gcMt, gcComm, gcCommM) @@ -359,6 +362,6 @@ alertcondition(clEntryNow and clDir == 1, "Crude LONG", "Crude bracket LONG at alertcondition(clEntryNow and clDir == -1, "Crude SHORT", "Crude bracket SHORT at 9:01 ET") alertcondition(ngEntryNow and clDir == 1, "Nat gas LONG", "Nat gas bracket LONG at 6:01 pm ET for the next trading day (same side as crude)") alertcondition(ngEntryNow and clDir == -1, "Nat gas SHORT", "Nat gas bracket SHORT at 6:01 pm ET for the next trading day (same side as crude)") -alertcondition(news and not news[1], "NQ news day", "NQ news day: 8:30 signal check (entry 8:31 / 8:33, else the normal 9:31 / 9:33 rule)") +alertcondition(useNews and news and not news[1], "NQ news day", "NQ news day: 8:30 signal check (entry 8:31 / 8:33, else the normal 9:31 / 9:33 rule)") alertcondition(nqNew and nqDir == 1, "NQ LONG", "NQ bracket LONG now") alertcondition(nqNew and nqDir == -1, "NQ SHORT", "NQ bracket SHORT now")