Click here to Login

                                                   Indicator based on another symbol in another timeframe


Dave Walton
2013-07-10 03:03:01

I'm trying to calculate the 30 month T-score of an external symbol (^GSPC) to use as a filter within a system operating on a daily timeframe. Nothing I try seems to work. Is this doable and if so, how? If I use the TimeFrameGetSeries1 function and then do calculations on it, I don't get the results I expect.

2013-07-10 03:09:51


You can get close series of an external symbol by typing:
a = TimeFrameGetSeries1("^GSPC", 1, close, LastData);

After that you can apply any indicator. Example:
b = sma(a, 25*30); // 30-Month moving average

Dave Walton
2013-07-11 02:18:07


An easy way to do it that I've since found is to create a custom function that calls GetSeries() and does the calculations. Then within the trading strategy the TimeFrameApply() and TimeFrameDecompress() functions can be used on the custom function. Very simple.

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Adaptive Trading Indicator based on the Return of Past Trades
Trading Rules based on the Relative Strength Index - RSI Indicato...
Short to Long-Term Volatility Indicator based on High/Low Trading...
Buy Indicator
Short Indicator

How-to Lessons
How to copy the data/settings of an account to another account
How to add trades from one portfolio to another one
How to quickly select stocks based on the last value of a databas...
How to create a moving average of an indicator
How to create a volatility-based Stop - Dynamic stop based on the...

Related Forum Threads
How do I refer to the close price of another symbol in a formula?
How to trade one symbol based on indicators of another?
Calling a Function from another Function
Building an indicator in smaller timeframe to use in larger timef...
STOP/Profit targets based on the indicator value at the time of e...

Blog Posts
Update Chart Layout based on Active Ticker Symbol
Update Chart Layout based on Active Ticker Symbol - Part 2
Fundamental Stock Analysis: Rank stocks based on a valuation rati...
Detect chart patterns using the auto support/resistance indicator
Ranking stocks based on their correlation with the S&P 500 Index

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2020
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.