Click here to Login




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

Updated on 2012-06-28





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 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 © 2012 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items