NexusFi: Find Your Edge


Home Menu

 





ETF to Futures Half Gap


Discussion in ThinkOrSwim

Updated
    1. trending_up 1,669 views
    2. thumb_up 1 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread

ETF to Futures Half Gap

  #1 (permalink)
AstroTuna
Chicago, IL
 
Posts: 12 since Jan 2020
Thanks Given: 0
Thanks Received: 8

Here's a handy script. I find that half gaps are often good bounce/resistance points. That would be half of the distance between the previous days' ETF close and the next open at 930am EST.

Place it on a futures chart and see if you like it. The default setting is for SPY. So you would want to view it on the /ES chart.

 
Code
#  name: ETF_to_Futures_HalfGap

#input Choose_Underline_Equity = "";
# use GLD (for /GC), USO (for /CL), SOYB (for /ZS)
input symbol = "SPY"; #USE SPY SYMBOL IF VIEWING THE /ES CHART
#HIDES WALLS FOR PREVIOUS DAYS
input showOnlyLastPeriod = yes;



#COLLECTS OPEN PRICE FOR CHART SYMBOL
def ChartSymbol = if GetTime() crosses above RegularTradingStart(GetYYYYMMDD()) then open else ChartSymbol[1];

#COLLECTS OPEN PRICE FOR EQUITY SYMBOL
def SymbolData = if open(symbol, AggregationPeriod.DAY, "Last") then open(symbol, AggregationPeriod.DAY, "Last") else SymbolData[1];

#PLOT WALL START/END TIME
def StartTime = 0530;
def EndTime = 1600;

#COUNTER
def startCounter = SecondsFromTime(StartTime);
def endCounter = SecondsTillTime(EndTime);
def RTHPeriod = if startCounter >= 0 and endCounter >= 0 then 1 else 0;

#SESSION PLOT
def RTHPlot = if showOnlyLastPeriod then GetLastDay() <= GetDay() and GetLastYear() <= GetYear() else yes;

#---Add code to convert underlying's (ETF) half gap to its future counterpart
#----------------------ETF Yesterdays close
def Prevclose = close(symbol, AggregationPeriod.DAY, "last") [1] ;

#---------------------- Spy Half gap calc
def HG_Conv = (Prevclose + SymbolData) / 2;

#---------------------- Half Gap CONVERSION CALCULATION
def HG = (ChartSymbol / SymbolData) * HG_Conv;
plot ETF = if RTHPlot and RTHPeriod then HG else Double.NaN;
ETF.SetPaintingStrategy(PaintingStrategy.DASHES);
ETF.SetDefaultColor(Color.PINK);
ETF.SetLineWeight(4);
#---End code to convert underlying's half gap to its future counterpart

#end

Reply With Quote
Thanked by:




Last Updated on March 10, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts