Click here to Login





How to plot two different time frames in the same chart

Updated on 2012-02-18 04:11:47

Share |

Steps:

- Open a new chart by selecting "View" then "New Chart"
- Select "Daily" time frame (Bottom-Left corner)
- Right click on the chart then select "Create new pane"
- Right click on the new pane then select "Edit Formula"

We will use the "Timeframeapply" function to plot the close series in a different time frame (weekly for example)

This function gets two arguments:
Argument 1: The time frame to apply. When using EOD data, specify the number of days (Example: 7 for weekly) and when using intraday data, specify the number of seconds (Example: 60 for minute bars)
Argument 2: Time-series to calculate in the specified time frame


Example:

a = Timeframeapply(7, close);
Plot(a, "TF7", colorBlack, chartLine, StyleSymbolNone);





Click on "Update Graph" to apply the formula. You will see on the chart that the daily and weekly close time series are not synchronized. In fact, the variable returned by "Timeframeapply" is compressed; you must decompress it in order to synchronize the dates of both time series.

a = Timeframeapply(7, close);
a = Timeframedecompress(a);
Plot(a, "TF7", colorBlack, chartLine, StyleSymbolNone);





You can reference EOD data from intraday charts by specifying a negative value in the time frame argument of the "Timeframeapply" function. (Example: -1 to get daily data)








no reviews (Log in)







Other how-to articles




How to plot a stock using different periods in the same chart





How to display two stocks on the same chart





How to plot a time-series that do not update the chart scale





How to plot the ratio of two stocks





How to display the bar index of a stock on a chart





How to plot arrows below/above candlesticks on a chart





How to plot the number of stock tweets per day





How to plot the relative performance of several stocks/indices





How to scale and move the chart Y-axis







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
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.