Click here to Login




How to plot two different time frames in the same chart

Updated on 2012-02-18





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 comments (Log in)

Back







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.