How can I set a range that refers to the previous day, i.e. yesterday, between 3:30 p.m. and 10:00 p.m.? So when I trade today I want to refer to the highs and lows of yesterday between 3:30 p.m. and 10:00 p.m.
There you go:
ONCE HH = high //today's HIGH
ONCE LL = low //today's LOW
ONCE yHH = high //yesterday's HIGH
ONCE yLL = low //yesterday's LOW
IF OpenTime >= 153000 AND OpenTime <= 220000 THEN
IF OpenTime = 153000 THEN
yHH = HH
yLL = LL
HH = high
LL = low
ENDIF
HH = max(HH,high)
LL = min(LL,low)
ENDIF
Roberto,
sorry but I really cannot understand this snippet.
Are you so kind to explain it ?
Many thanks 🙂
ONCE HH = high //today's HIGH
ONCE LL = low //today's LOW
IF OpenTime >= 153000 AND OpenTime <= 220000 THEN
IF OpenTime = 153000 THEN
HH = high // at 15h30 hh store the high of the 1st candle
LL = low // at 15h30 hh store the low of the 1st candle
ENDIF
// Every candle after 15h30 and before 22h00 update HH if High of the candle is higher than previous HH
HH = max(HH,high)
// Every candle after 15h30 and before 22h00 update LL if low of the candle is lower than previous LL
LL = min(LL,low)
ENDIF
Now as you want the range of previous day, you want to store the range of the day in previous day variables before any updates of HH and LL, so it is first thing to do at 15h30
yHH = HH
yLL = LL
Now you can draw 2 segmnents using yHH and yLL
@MaoRai54
what LucasBest wrote is correct, is that all you need to know?
Thank you, Roberto. And now we’re building a range breakout system with SL at the opposite end and a TP of 1.5*Range… would something like that be profitable?
I’ve read here below that : “If a trending stock makes a new high after 11:15-11:30am EST, there is a 75% chance of closing within 1% of High of day (HOD). Same applies for downtrend.”
https://fr.tradingview.com/script/j5fydEzi-Drip-s-11am-rule-breakout-breakdown-OG/
The If statement:
IF OpenTime >= 153000 AND OpenTime <= 220000 THEN
is ok if you want to include the candle starting at 22h in your range. In case you don’t (last candle before 22h as last candle of range), then the if statement becomes:
IF OpenTime >= 153000 AND OpenTime < 220000 THEN
Can you please code me a simple breakout system from this?
I tried with following logic in Nasdaq TF M15. But it doesn’t look really good.
Long = HH crosses over yHH
Longex = close crosses under LL and Exit=1
Short = LL crosses under yLL
Shortex = close crosses over HH and Exit=1