# Automatic Opening Range and Fibonacci Levels # By Prospectus @ http://readtheprospectus.wordpress.com # Inspired by Trader-X @ http://traderx.blogspot.com # # This Thinkscript is designed to plot the OR high, low, # 50% fib retrace, and fib extensions for the current day. # This will only work correctly on time-based charts, # where the OR timeframe is divisible by the bar period # e.g. 30 minute OR, 10 min bars. An extra fib extension # may be used if desired to create a target zone. # def na=double.nan; # # Define time that OR begins (in hhmm format, # 0930 is the default): # input ORBegin = 0930; # # Define time that OR is finished (in hhmm format, # 10:00 is the default): # input OREnd = 0940; # # Input first and second fib extension levels # (default 1.382, 1.621): # Input FibExt1=1.382; Input FibExt2=1.621; # # Show Today only? (Default Yes) # input ShowTodayOnly={"No", default "Yes"}; def s=ShowTodayOnly; # # Show Second fib extension? (Default No) # input ShowFibExt2={default "No", "Yes"}; def sf2=ShowFibExt2; # # Create logic for OR definition: # Def ORActive = if secondstilltime(OREnd)>0 AND secondsfromtime(ORBegin)>=0 then 1 else 0; # # Create logic to paint only current day post-open: # def today=if s==0 OR getday()==getlastday() AND secondsfromtime(ORBegin)>=0 then 1 else 0; # # Track OR High: # Rec ORHigh = if ORHigh[1]==0 or ORActive[1]==0 AND ORActive==1 then high else if ORActive AND high>ORHigh[1] then high else ORHigh[1]; # # Track OR Low: # Rec ORLow = if ORLow[1]==0 or ORActive[1]==0 AND ORActive==1 then low else if ORActive AND low