Pre-market High Low Indicator with Fibonacci for ThinkorSwim

H

h10

New member
Unfortunately the previous day close doesn't show up on the mobile app. However, thanks for the reply!
 
I

Ishaam

Member
VIP
@BenTen , is it possible to make two inputs for this script, so that one can specify a time from 12am EST to 8am EST as an example to look for highs and lows during this specified time period?

Code:
# Archive Name: GlobeX or Overnight High / Low v.07.2017
# Archive Section: Support Resistance
# Suggested Tos Name: GlobeX_HighLow_v2017_Mobius
# Archive Date: 5.06.2018 May 6, 2018
# Archive Notes: This looks to be a second version

# GlobeX or Overnight High / Low
# Mobius
# V01.2012
# V07.2017 Replaced Time Brackets with GetTime() function which works better with Mobile

input PlotOverNightExtremes = yes;

def h = high;
def l = low;
def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def ONhigh = if GlobeX and !GlobeX[1]
             then h
             else if GlobeX and
                     h > ONhigh[1]
                  then h
                  else ONhigh[1];
def ONhighBar = if GlobeX and h == ONhigh
                then bar
                else Double.NaN;
def ONlow = if GlobeX and !GlobeX[1]
            then l
            else if GlobeX and
                    l < ONlow[1]
                 then l
                 else ONlow[1];
def ONlowBar = if GlobeX and l == ONlow
               then bar
               else Double.NaN;
def OverNightHigh = if BarNumber() == HighestAll(ONhighBar)
                    then ONhigh
                    else OverNightHigh[1];
def OverNightLow = if BarNumber() == HighestAll(ONlowBar)
                   then ONlow
                   else OverNightLow[1];
plot ONH = if OverNightHigh > 0
           then OverNightHigh
           else Double.NaN;
ONH.SetHiding(!PlotOverNightExtremes);
ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
ONH.SetDefaultColor(Color.BLUE);
ONH.HideBubble();
ONH.HideTitle();
plot ONL = if OverNightLow > 0
           then OverNightLow
           else Double.NaN;
ONL.SetHiding(!PlotOverNightExtremes);
ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
ONL.SetDefaultColor(Color.BLUE);
ONL.HideBubble();
ONL.HideTitle();
#AddLabel(GlobeX, "GlobeX Range = " + AsDollars(ONH - ONL), Color.WHITE);
AddChartBubble(bar == ONhighBar and PlotOverNightExtremes, ONH, "ON_HIGH", Color.RED);
AddChartBubble(bar == ONlowBar and PlotOverNightExtremes, ONL, "ON_LOW", Color.GREEN, 0);
Alert((close crosses above ONH) or (close crosses below ONL), "", Alert.BAR, Sound.Bell);
# End Code GlobeX or Overnight High / Low v.07.2017
 
C

chada456

New member
Hello I am hoping someone can help out.

I am looking for an intraday scan that looks for stocks above its premarket highs. Can someone help? Thank you!
 
BenTen

BenTen

Administrative
Staff
VIP
@chada456 Use the regular scan feature with your indicator and use the crosses above or below function.
 
S

soary

Member
Hi guys, I’m not a coder so please help!

Ben, just what I needed but I read the entire thread and I’m a bit confused.

  • What is GlobeX? Sounds like it all the trading hours including after RTH close, pre-market and RTH? Please clarify bec if so, that is not what I am looking for.
  • Tom 4235 asked for “a script so a h and l are automatically drawn out” and you responded with the second script but what time period is it for? I placed it in chart and it looks like it Is basically all trading hours. The code has GlobeX and ONH and ONL so not sure and I’m not sure the difference between the 1st and the 2nd script except that the 1st has fib, so explain.
  • I would like a premarket script that shows a trendline for high and low starting from after market close hours and includes premarket high and low hours and it is not clear to me if any of these shows this or not. I want it to show during RTH and if it has Fibs make it so it’s optional and can be turned off tru user input (no show)
  • There is lots of scripts in UTS on opening range but I’m looking for a script for the after market trendlines and the pre-market range with the trendline for the 50% point of that premarket range. It can be drawn manually using TOS channel drawing tool but I’m looking for a script to do this. Can this script to plot the premarket open trendline and the Daily Open script in TOS shown below be combined to plot the 3 trendlines for a premarket range with the trendline for the 50% point of that premarket range? The 3 trendlines would be 1) This premarket open, 2) The 50% trendline between premarket market and market open and 3) market open).
  • Aftermarket and premarket can have different colors so I recognize them
  • After RTH high pink dotted low red dotted
  • Premarket to open or seconds before open high line yellow, 50% premarket middle line green, and low same yellow as the top
  • I tried the premarket range script in UTS but it only posted one trendline and I don't know for what
  • https://usethinkscript.com/threads/plot-premarket-open-trendline-in-tos-help.357/
Thanks a bunch
 
Last edited:
A

Ajsha007

New member
Hi! Amazing work you do putting out the scripts! I am wondering if you could tweak the script to have fibbonacci retracements from current Pre-market high to previous day low? Rather than pre-market low? and then one in reverse from Premarket low to yesterday hi as well? Thank you!
 
G

Ginu09

New member
Hi Ben, thanks for this! I'm getting an N/A in the globex variable. I've tried using both the commented and original code
# If you want to include the extended session in Globex, then use globex def below
#def globex = if time crosses above rte
# then bn else globex[1];

I haven't seen any feedback here of anyone else having this problem and it appears to be happening only on selective charts, i.e. today with AMRH. Any idea why this would be happening? Thanks!
 
S

Sonny

Active member
VIP
Hi,

I want to submit the following code as a chart study that shows the premarket high as a chart label. Please pass it on!

Thanks,
Sonny

Code:
def h = high;
def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def ONhigh = if GlobeX and !GlobeX[1] then h else if GlobeX and h > ONhigh[1] then h else ONhigh[1];
def ONhighBar = if GlobeX and h == ONhigh then bar else Double.NaN;
def OverNightHigh = if BarNumber() == HighestAll(ONhighBar) then ONhigh else OverNightHigh[1];
AddLabel(1, "PMH: " + OverNightHigh, Color.CYAN);
 
T

tabs999

Member
Hello can you add one thing to this script. It only shows fib premarket levels for the current day. Could you make it to shows the fib levels for however many days i have loaded and a audio alert the first time a level is touched big thanks!
 
D

desert_rat

New member
Thanks for the script.

@RandyR Hi, instead of the chart bubble, is there a way to just label the line on the left side of the chart with the name (or to move the bubble to the left side of the chart)? (the script works great and I appreciate it) Thanks
 
I

iKon

New member
Thanks for share the script.
May be you show me some simple modification this script for my 15_min_strategy.
After 15min from open (9:45) script plot 2 line - Line1 = 15min_Hi, Line2 = 15min_Low. Plot this lines in 1M timeframe.
In my grid I have 5 timeframe - 1M, 5M,15M,1H,1D. It is enough to display the lines for 1M only.
 
G

Ginu09

New member
Hi, does anyone have an issue with this code where gXhigh goes N/A at 10:45am? It's happening to me repeatedly and is repeatable using OnDemand. I'm trying to debug it but I'm not as familiar with thinkscript. @BenTen
 
D

desert_rat

New member
Hi, does anyone have an issue with this code where gXhigh goes N/A at 10:45am? It's happening to me repeatedly and is repeatable using OnDemand. I'm trying to debug it but I'm not as familiar with thinkscript. @BenTen
It works OK for me. I just checked /nq /es /ym /cl all OK.
 
G

Ginu09

New member
It works OK for me. I just checked /nq /es /ym /cl all OK.
It occurs for me after the PM high has been broken. I have added a label to display
AddLabel(yes, gXhigh, COLOR.GRAY);

It goes N/A for me.
 
D

desert_rat

New member
It occurs for me after the PM high has been broken. I have added a label to display
AddLabel(yes, gXhigh, COLOR.GRAY);

It goes N/A for me.
I understand what you are saying, I Just don't see it myself. At this moment, /nq is > PM high ( 10586.25) and I still see the globex high light green line.
 
J

John H

New member
I'm trying to plot the overnight high and low. how I've been manually drawing it is yesterdays overnight H/L are drawn from open to next open. this way i can see price interaction with these levels during market and the overnight. I was able to Frankenstein this code together but it only plots during market hours. Is there a way I can extend these lines? Sorry tried to add pictures but it said "something went wrong"

Code:
def h = high;
def l = low;
def c = close;
def na = double.NaN;

def PMhrs = RegularTradingStart (GetYYYYMMDD()) > GetTime();
def RMhrs = RegularTradingStart (GetYYYYMMDD()) < GetTime();
def PMStart = RMhrs[1] and PMhrs;
def PMHigh = CompoundValue(1, if PMStart then h else if PMhrs then Max(h, PMHigh[1]) else PMHigh[1], 0);
def PMLow = CompoundValue(1, if PMStart then l else if PMhrs then Min(l, PMLow[1]) else PMLow[1], 0);

plot zhigh = if PMhrs then na else PMHigh;
plot zlow = if PMhrs then na else PMLow;
 
N

Nica33

New member
Hi Ben! First time here. Could this be changed to show only high and low of premarket session, that starts at 4 AM EST? with the option to show only last day or all. Thank you!!
 
Thread starter Similar threads Forum Replies Date
W Pre-market scanner for stocks moving sideways? Questions 2
V Pre-Market Change PMO to PMC/RTCO Questions 1
B Pre Market Range Questions 7
I Receive alerts pre and post market? Questions 5
S Pre-Market Volume Question Questions 0
Top