interest rates indicator

Daxter

New member
I will paste the script here below. This is my friend's and he's not too fluent in ThinkScript and neither am I haha. Any pointers here would be much appreciated!
-----------------------------
-----------------------------
-----------------------------


# Load the data for USDJPY, OIL_CRUDE, USDGBP, USDEUR, UVXY, and VIX
input usdjpy = close("USDJPY");
input oil_crude = close("OIL_CRUDE");
input usdgbp = close("USDGBP");
input usdeur = close("USDEUR");
input uvxy = close("UVXY");
input vix = close("VIX");

# Calculate the value of the formula
def value = (usdjpy-1/oil_crude2)/usdgbp/(usdeur0.576)/(uvxy*0.000001)/24000000;

# Create an indicator that shows when there are swaps on interest rates
def swaps_on_interest_rates = if value > 0 then value else 0;

# Alert when there are swaps on interest rates
alert(swaps_on_interest_rates, "Swap alert!", alert.bar, sound.bell);

# Create a signal that shows a buy signal when there are swaps on interest rates
def buy_signal = if swaps_on_interest_rates > 0 then 1 else 0;

# Create a signal that shows a sell signal when there are no swaps on interest rates
def sell_signal = if swaps_on_interest_rates == 0 then 1 else 0;

# Plot the swaps on interest rates indicator
 
I will paste the script here below. This is my friend's and he's not too fluent in ThinkScript and neither am I haha. Any pointers here would be much appreciated!
-----------------------------
-----------------------------
-----------------------------


# Load the data for USDJPY, OIL_CRUDE, USDGBP, USDEUR, UVXY, and VIX
input usdjpy = close("USDJPY");
input oil_crude = close("OIL_CRUDE");
input usdgbp = close("USDGBP");
input usdeur = close("USDEUR");
input uvxy = close("UVXY");
input vix = close("VIX");

# Calculate the value of the formula
def value = (usdjpy-1/oil_crude2)/usdgbp/(usdeur0.576)/(uvxy*0.000001)/24000000;

# Create an indicator that shows when there are swaps on interest rates
def swaps_on_interest_rates = if value > 0 then value else 0;

# Alert when there are swaps on interest rates
alert(swaps_on_interest_rates, "Swap alert!", alert.bar, sound.bell);

# Create a signal that shows a buy signal when there are swaps on interest rates
def buy_signal = if swaps_on_interest_rates > 0 then 1 else 0;

# Create a signal that shows a sell signal when there are no swaps on interest rates
def sell_signal = if swaps_on_interest_rates == 0 then 1 else 0;

# Plot the swaps on interest rates indicator
You have a couple of small errors in your code AND TOS won't provide a couple of currency pairs in the way you are looking for so I had to invert them. I do think there is some error with the value as it doesn't seem to provide any signals. Maybe there was a copy/paste error in posting here. Check this out and let me know if you have an idea of what's wrong:

Ruby:
input usdjpy_ticker = "USD/JPY";
input oil_ticker = "/CL";
input usdgbp_ticker = "GBP/USD";
input usdeur_ticker = "EUR/USD";
input vol_ticker = "UVXY";
def usdjpy = close(symbol = usdjpy_ticker);
def oil_crude = close(symbol = oil_ticker);
def usdgbp = 1 / close(symbol = usdgbp_ticker);
def usdeur = 1 / close(symbol = usdeur_ticker);
def uvxy = close(symbol = vol_ticker);
#def vix = close("VIX");
input showLabels = no;
AddLabel(showLabels,"USDJPY: " + usdjpy,Color.WHITE);
AddLabel(showLabels,"Crude: " + oil_crude,Color.WHITE);
AddLabel(showLabels,"USDGBP: " + usdgbp,Color.WHITE);
AddLabel(showLabels,"USDEUR: " + usdeur,Color.WHITE);
AddLabel(showLabels,"UVXY: " + uvxy,Color.WHITE);
# Calculate the value of the formula
def value = (usdjpy - 1) / oil_crude / usdgbp / (usdeur * 0.576)/(uvxy*0.000001)/24000000;
 
Thank you for the input. Here is an idea that I have that can display the inputs.

------------------------------------------------------------------------------------------------------------------------------------------------------------

# Load the VIX data
input vix = close("VIX");

# Calculate the value of the formula
def value = (close("USDJPY")-1/close("OIL_CRUDE")2)/close("USDGBP")/(close("USDEUR")0.576)/(close("UVXY")*0.000001)/24000000;

# Create an indicator that shows when there are swaps on interest rates
def swaps_on_interest_rates = if value > 0 then value else 0;

# Alert when there are swaps on interest rates
alert(swaps_on_interest_rates, "Swap alert!", alert.bar, sound.bell);

# Plot the VIX data
plot vix_plot = vix;

# Create a subgraph for the swaps on interest rates indicator
new Chart(height = 150, title = "Swaps on interest rates")
plot swaps_on_interest_rates_plot = swaps_on


------------------------------------------------------------------------------------------------------------------------------------------------------------
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
206 Online
Create Post

Similar threads

Similar threads

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