# ETF to Future Plot Conversion...problem w/ different Open Times

#### RickK

##### Active member
Hey All,

I've got a plot conversion tool that works very nicely on most futures charts because the futures instrument has the exact same market open time as its ETF counterpart. As you can see below, when I input 340 (QQQ value) into the indicator, I get a line plotted on the /NQ chart at 13949.46.

The problem is when I want to plot a line on /GC (who's market open time for me is 7:20am CST) from a determined line on GLD (who's open time for me is 8:30am CST). Because of the staggered opening times, the plot conversion won't work as it currently is written.

The code typically divides the 8:30 open price of the futures by the 8:30 open price of the ETF to get a factor. Then it multiplies the factor by the input value number to convert it for plotting that level on the futures chart.

Is there a way to modify this code so that it will take /GC's 8:30am open price instead of its RTH open price at 7:20? I've applied everything I know but still can't get it to work.

Thanks to anyone who chimes in!

Here's the code:
Code:
``````# ETF to Future Plot Conversion
# This indicator will plot a daily determined etf_value on its future
# counterpart's chart.

declare hide_on_daily;

input etf_value = 340.00;
input symbol = "QQQ";
input value_display = yes;
input showOnlyLastPeriod = yes;

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

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

#CONVERSION FACTOR CALCULATION
def factor = (ChartSymbol / SymbolData);

#START/END TIME
def StartTime = 0930;
def EndTime = 1600;

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

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

#PLOT
plot conversion;
conversion = if RTetf_valuelot and value_display and RTetf_valueeriod then factor * etf_value else Double.NaN;
conversion.SetDefaultColor(color.blue);
conversion.SetLineWeight(5);

#####End``````

Nevermind. Resolved.

87k+ Posts
315 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?