pine
This commit is contained in:
1 parent
b157fcc600
commit
81b74d9b36
1 file changed
+10
-7
@@ -7,7 +7,8 @@
|
|||||||
// NG (entry 6:01 pm, at the evening reopen, for the NEXT trading day): always the SAME side as crude
|
// 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
|
// (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.
|
// 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):
|
// 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.
|
// 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
|
// 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)
|
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)
|
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)
|
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)"
|
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"
|
hEntry = nqDisp != 0 ? "9:31" : nqDone1 ? "9:33" : "9:31 / 9:33"
|
||||||
|
|
||||||
// news day (8:30 window)
|
// 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)
|
[aDrive, aMv, aPull] = driveOf(a3, aPre, aC3, aHi, aLo, nqAtr)
|
||||||
newsSig = aDisp != 0 ? aDisp : not a3 ? 0 : aDrive != 0 ? aDrive : aThree
|
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
|
newsWait = news and aDisp == 0 and not a3 // 8:31-8:32: waiting for the 8:32 candle
|
||||||
newsTrade = news and newsSig != 0
|
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
|
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): "
|
tag = not useNews ? "" : 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)" :
|
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" :
|
newsWait ? tag + "no 8:30 displacement; waiting for the 8:32 candle" :
|
||||||
newsTrade ? tag + (aDisp != 0 ? "a. 8:30 displacement -> follow" :
|
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" :
|
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") :
|
"c. 8:30 three candles same way -> follow") :
|
||||||
tag + (news ? "no 8:30 signal -> normal rule: " : "") + hBranch
|
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 ----------
|
// ---------- sizing ----------
|
||||||
[gcN, gcSp, gcTp, gcRiskUsd, gcRewUsd, gcMicro] = sizeFor(gcAtr, gcPv, gcMt, gcComm, gcCommM)
|
[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(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 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(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 LONG", "NQ bracket LONG now")
|
||||||
alertcondition(nqNew and nqDir == -1, "NQ SHORT", "NQ bracket SHORT now")
|
alertcondition(nqNew and nqDir == -1, "NQ SHORT", "NQ bracket SHORT now")
|
||||||
Reference in new issue
Block a user