Click here to Login





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

Updated on 2012-06-28 10:50:31

Share |

This article will show you how to display the same stock or security on two different panes where each pane uses its own period.


Steps:

- Open a new chart then create a new pane
- Right click on the second pane then select "Edit Formula"
- Type the following formula then click on "Update Graph"

period = 3600; // One hour (3600 seconds)
close1 = TimeframeCompress(TimeframeGetSeries(period, close, LastData));
open1 = TimeframeCompress(TimeframeGetSeries(period, open, LastData));
high1 = TimeframeCompress(TimeframeGetSeries(period, high, LastData));
low1 = TimeframeCompress(TimeframeGetSeries(period, low, LastData));

PlotCandleStick1(open1, high1, low1, close1, "Timeframe: ".period, colorBlack, StyleSymbolNone);


If your have an intraday period in your chart then this formula will plot a one-hour Japanese candlestick graph.

The first line gets the period in seconds (1h = 60 * 60 = 3600 seconds)
The four next lines calculate the close, open, high, low fields in the new time frame. This is achieved by getting the new period data using "TimeframeGetSeries" then compressing it with "TimeframeCompress".
More info about this can be found here: Technical Analysis Using Multiple Timeframes

Finally, the last line plots the Japanese candlestick graph using the special function "PlotCandleStick1".











no reviews (Log in)







Other how-to articles




How to plot two different time frames in the same chart





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





How to plot the number of stock tweets per day





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 arrows below/above candlesticks on a chart





How to display the number of notes per stock





How to plot the relative performance of several stocks/indices





How to get stocks for a particular index using the global script







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.