QQQ to NQ converter

davidbudhoo

New member
VIP
Hey everyone, I've been trying to write a script that will convert the QQQ prices over the NQ chart. So far I did get the lines to draw. Is there any way I add the ability of the QQQ price to show up just above the line. I use teh QQ lines as resistance or support lines on the NQ when trading based on option flow and institutional flow from QQQ. Thsi is the code I have so far

Code:
# QQQ Resistance Levels on NQ
# This script plots user-defined QQQ resistance levels on an NQ chart by converting the QQQ prices to NQ equivalents.


# Define your QQQ resistance levels here.
# You can change these to any values you want.
input qqqResistance1 = 630.00;
input qqqResistance2 = 632.00;
input qqqResistance3 = 634.00;
input qqqResistance4 = 637.00;
input qqqResistance5 = 640.00;

# Fetch the closing prices for QQQ and NQ.
def qqqClose = close("QQQ");
def nqClose = close; # 'close' refers to the active chart's symbol, which is NQ in this case.

# Avoid division by zero by setting the ratio to 1 if QQQ price is 0.
def ratio = if qqqClose != 0 then nqClose / qqqClose else 1;

# Calculate the corresponding NQ price for each QQQ resistance level.
def nqResist1 = qqqResistance1 * ratio;
def nqResist2 = qqqResistance2 * ratio;
def nqResist3 = qqqResistance3 * ratio;
def nqResist4 = qqqResistance4 * ratio;
def nqResist5 = qqqResistance5 * ratio;

# Plot the converted resistance levels as horizontal lines.
plot R1 = nqResist1;
plot R2 = nqResist2;
plot R3 = nqResist3;
plot R4 = nqResist4;
plot R5 = nqResist5;

# Set the appearance for the plotted lines.
R1.SetDefaultColor(Color.RED);
R2.SetDefaultColor(Color.RED);
R3.SetDefaultColor(Color.RED);
R4.SetDefaultColor(Color.RED);
R5.SetDefaultColor(Color.RED);

R1.SetLineWeight(2);
R2.SetLineWeight(2);
R3.SetLineWeight(2);
R4.SetLineWeight(2);
R5.SetLineWeight(2);


Thanks
 
Last edited by a moderator:

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
880 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

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?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top